def main(): param = sys.argv[1] if param == 'weather': weather() pass else: stocks_path = gl.ROOT + '/log/StockCode' Stock.get_stocks(stocks_path, 60*10) now = datetime.datetime.now().strftime("%Y-%M-%d") lib.mailer.mail(now + " stock has updated completely.") pass
def setup_class(cls): cls.ml = Stock('ML.PA', 'Michelin', 90, 100) # print(cls.ml) # affiche methode __str__ # s = str(cls.ml) # print(s) # print(cls.ml.__repr__()) print(repr(cls.ml)) # affiche MLPA
def test_save_to_cache(self): self.assertFalse(os.path.exists('cache/GOOG_2012-05-25')) Stock.save_to_cache('GOOG', None) self.assertTrue(os.path.exists('cache/GOOG_2012-05-25')) os.remove('cache/GOOG_2012-05-25')
def test_get_from_cache_available(self): shutil.copy('tests/fixtures/GOOG_2012-05-25', 'cache/GOOG_2012-05-25') self.assertIsNotNone(Stock.get_from_cache('GOOG')) os.remove('cache/GOOG_2012-05-25')
def test_get_from_cache_not_available(self): self.assertIsNone(Stock.get_from_cache('GOOG'))
def setUp(self): self.built_in_date = datetime.date datetime.date = NewDate self.goog = Stock('GOOG', get_historical_prices) self.backtest = BackTest() self.backtest.stock = self.goog
def setup_class(cls): cls.pf = Portefeuille('ordinaire') cls.act1 = Stock('ML.PA', 'Michelin', 90, 100) cls.act2 = Stock('FP.PA', 'Total', 10, 10) cls.act3 = Stock('SGO.PA', 'Saint_Gobain', 10, 10)
def test(cls): stock = Stock('sz002405') cls.scan(stock)
def test_instantiation_with_cache(self): shutil.copy('tests/fixtures/GOOG_2012-05-25', 'cache/GOOG_2012-05-25') self.assertIsNotNone(Stock('GOOG', raise_if_called)) os.remove('cache/GOOG_2012-05-25')
def test_instantiation_no_cache(self): self.assertFalse(os.path.exists('cache/GOOG_2012-05-25')) self.assertIsNotNone(Stock('GOOG', get_historical_prices)) self.assertTrue(os.path.exists('cache/GOOG_2012-05-25')) os.remove('cache/GOOG_2012-05-25')
print(warrant.option.upper() + ' ' + warrant.underlying.upper() + ' @' + str(warrant.strikePrice) + ' ' + warrant.expiry) print('ISIN: ' + warrant.isin.upper()) print('Shares: ' + str(warrant.shares)) print('Market Price: ' + str(warrant.marketPrice)) print('Net Total: ' + str(warrant.netTotal)) print(' - Brokerage Fee: ' + str(warrant.brokerageFee)) print(' - Taxes: ' + str(warrant.taxes)) print('Total: ' + str(warrant.total)) shutil.copy(sourceFolder + file, destinationFolder + warrant.file) os.remove(sourceFolder + file) print('File moved') if pdfType is 'stock': stock = Stock(pdf) print('\nStock') print(file) print(stock.file) print(stock.date + ' ' + stock.time) print(stock.orderType.upper()) print(stock.underlying) print('ISIN: ' + stock.isin.upper()) print('Shares: ' + str(stock.shares)) print('Market Price: ' + str(stock.marketPrice)) print('Net Total: ' + str(stock.netTotal)) print(' - Brokerage Fee: ' + str(stock.brokerageFee)) print(' - Taxes: ' + str(stock.taxes)) print('Total: ' + str(stock.total))