def setUp(self): TestSetUpDB.setUp(self) self.pos_files = glob(test_pos_path + '/*.csv') self.pos_files = self.pos_files + [ os.path.join(test_path, '2014-11-25', '2014-11-25-PositionStatement.csv'), os.path.join(real_path, '2015-02-27', '2015-02-28-PositionStatement.csv') ] pos_file = self.pos_files[0] self.date = os.path.basename(pos_file)[0:10] self.pos_data = open(pos_file).read() self.statement = models.Statement( date=self.date, account_statement='None', position_statement=self.pos_data, trade_activity='None', ) self.statement.save() self.save_pos = models.SavePositionStatement( date=self.date, statement=self.statement, file_data=self.pos_data, )
def setUp(self): TestSetUpDB.setUp(self) self.ta_files = glob(test_ta_path + '/*.csv') self.ta_files = [ os.path.join(real_path, '2015-02-27', '2015-02-28-TradeActivity.csv') ]
def setUp(self): TestSetUpDB.setUp(self) self.underlying = Underlying( symbol='SPX', company='S&P 500 Index' )
def setUp(self): TestSetUpDB.setUp(self) underlying = Underlying( symbol='AAPL', company='Apple Inc.' ) underlying.save() self.position_set = PositionSet( name='EQUITY', spread='LONG_STOCK', status='OPEN', underlying=underlying, start_date='2015-04-13' ) self.position_set.save() self.stage = PositionStage() self.stage.stage_name = 'PROFIT' self.stage.stage_expression = '{price_a} < {current_price}' self.stage.price_a = 127.85 self.stage.amount_a = 0.0 self.stage.left_status = 'decreasing' self.stage.left_expression = '{price_a} < {new_price} < {old_price}' self.stage.right_status = 'profiting' self.stage.right_expression = '{price_a} < {old_price} < {new_price}' self.stage.position_set = self.position_set
def setUp(self): TestSetUpDB.setUp(self) underlying = Underlying(symbol='AAPL', company='Apple Inc.') underlying.save() self.position_set = PositionSet(name='EQUITY', spread='LONG_STOCK', status='OPEN', underlying=underlying, start_date='2015-04-13') self.position_set.save() self.stage = PositionStage() self.stage.stage_name = 'PROFIT' self.stage.stage_expression = '{price_a} < {current_price}' self.stage.price_a = 127.85 self.stage.amount_a = 0.0 self.stage.left_status = 'decreasing' self.stage.left_expression = '{price_a} < {new_price} < {old_price}' self.stage.right_status = 'profiting' self.stage.right_expression = '{price_a} < {old_price} < {new_price}' self.stage.position_set = self.position_set
def setUp(self): TestSetUpDB.setUp(self) underlying = Underlying(symbol='AAPL', company='Apple Inc.') underlying.save() self.position_set = PositionSet(name='EQUITY', spread='LONG_STOCK', status='OPEN', underlying=underlying, start_date='2015-04-13') self.position_set.save() self.opinion = PositionOpinion() self.opinion.position_set = self.position_set #self.opinion.date = '2015-04-19' # auto set day +1 BDay self.opinion.direction = 'BULL' self.opinion.decision = 'HOLD' self.expected_keys = [ 'position_set', 'direction', 'direction_result', 'decision_result', 'analysis', 'description', ]
def setUp(self): TestSetUpDB.setUp(self) # set date self.date = '2015-04-28' # create underlying self.underlying = Underlying(symbol='AAPL', company='APPLE INC') # create position set self.position_set = PositionSet() self.position_set.underlying = self.underlying self.position_set.name = 'EQUITY' self.position_set.spread = 'LONG_STOCK' self.position_set.start_date = datetime.strptime( '2015-04-13', '%Y-%m-%d').date() self.position_set.stop_date = datetime.strptime( '2015-04-28', '%Y-%m-%d').date() self.position_set.save() # create position opinion self.position_opinion = self.create_opinion( date=Profiler.move_bday(self.date, 1), position_set=self.position_set, direction='BULL') # create profiler now self.profiler = Profiler(position_set=self.position_set, date=self.date)
def setUp(self): TestSetUpDB.setUp(self) self.date = '2014-11-14' self.account_statement = SimpleUploadedFile( '2014-11-15-AccountStatement.csv', open( os.path.join(test_path, '2014-11-15', '2014-11-15-AccountStatement.csv')).read()) self.position_statement = SimpleUploadedFile( '2014-11-15-PositionStatement.csv', open( os.path.join(test_path, '2014-11-15', '2014-11-15-PositionStatement.csv')).read()) self.trade_activity = SimpleUploadedFile( '2014-11-15-TradeActivity.csv', open( os.path.join(test_path, '2014-11-15', '2014-11-15-PositionStatement.csv')).read()) self.value_data = dict(date=self.date) self.file_data = dict(account_statement=self.account_statement, position_statement=self.position_statement, trade_activity=self.trade_activity)
def setUp(self): TestSetUpDB.setUp(self) self.forex = Forex( symbol='GBP/JPY', description='GBPound/Japanese Yen Spot', )
def setUp(self): TestSetUpDB.setUp(self) # set date self.date = "2015-04-28" # create underlying self.underlying = Underlying(symbol="AAPL", company="APPLE INC") # create position set self.position_set = PositionSet() self.position_set.underlying = self.underlying self.position_set.name = "EQUITY" self.position_set.spread = "LONG_STOCK" self.position_set.start_date = datetime.strptime("2015-04-13", "%Y-%m-%d").date() self.position_set.stop_date = datetime.strptime("2015-04-28", "%Y-%m-%d").date() self.position_set.save() # create position opinion self.position_opinion = self.create_opinion( date=Profiler.move_bday(self.date, 1), position_set=self.position_set, direction="BULL" ) # create profiler now self.profiler = Profiler(position_set=self.position_set, date=self.date)
def setUp(self): TestSetUpDB.setUp(self) self.date = '2014-07-24' self.items = { 'commissions_ytd': 1575.08, 'futures_commissions_ytd': 0.0, 'net_liquid_value': 3693.94, 'option_buying_power': 2206.94, 'stock_buying_power': 5063.58 } self.statement = models.Statement( date=self.date, account_statement='All raw file data keep here...', position_statement='None', trade_activity='None', ) self.statement.save() self.account_summary = models.AccountSummary( statement=self.statement, date=self.date, **self.items ) self.cls_var = self.account_summary self.expect_keys = ( 'futures_commissions_ytd', 'stock_buying_power', 'commissions_ytd', 'date', 'net_liquid_value', 'option_buying_power' )
def setUp(self): TestSetUpDB.setUp(self) self.date = '2014-11-14' self.account_statement = SimpleUploadedFile( '2014-11-15-AccountStatement.csv', open( os.path.join(test_path, '2014-11-15', '2014-11-15-AccountStatement.csv')).read()) self.position_statement = SimpleUploadedFile( '2014-11-15-PositionStatement.csv', open( os.path.join(test_path, '2014-11-15', '2014-11-15-PositionStatement.csv')).read()) self.trade_activity = SimpleUploadedFile( '2014-11-15-TradeActivity.csv', open( os.path.join(test_path, '2014-11-15', '2014-11-15-PositionStatement.csv')).read()) self.value_data = dict(date=self.date) self.file_data = dict( account_statement=self.account_statement, position_statement=self.position_statement, trade_activity=self.trade_activity)
def setUp(self): TestSetUpDB.setUp(self) underlying = Underlying( symbol='AAPL', company='Apple Inc.' ) underlying.save() self.position_set = PositionSet( name='EQUITY', spread='LONG_STOCK', status='OPEN', underlying=underlying, start_date='2015-04-13' ) self.position_set.save() self.opinion = PositionOpinion() self.opinion.position_set = self.position_set #self.opinion.date = '2015-04-19' # auto set day +1 BDay self.opinion.direction = 'BULL' self.opinion.decision = 'HOLD' self.expected_keys = [ 'position_set', 'direction', 'direction_result', 'decision_result', 'analysis', 'description', ]
def setUp(self): TestSetUpDB.setUp(self) # create user User.objects.create_superuser(username='******', email='*****@*****.**', password='******')
def setUp(self): """ open three file and save it into table then get data """ TestSetUpDB.setUp(self) self.ready_file2(real_date='2014-11-17', file_date='2014-11-18') self.ready_file2(real_date='2014-11-18', file_date='2014-11-19') self.ready_file2(real_date='2014-11-24', file_date='2014-11-25') self.assertGreaterEqual(Statement.objects.count(), 1) self.statement = Statement.objects.last() # create instance now self.save_day_stat = SaveStatDay(statement=self.statement) self.expected_keys = [ 'name', 'total_order_count', 'working_order_count', 'filled_order_count', 'cancelled_order_count', 'total_holding_count', 'profit_holding_count', 'loss_holding_count', 'pl_open_sum', 'profit_open_sum', 'loss_open_sum', 'pl_day_sum', 'profit_day_sum', 'loss_day_sum', 'bp_effect_sum' ]
def setUp(self): TestSetUpDB.setUp(self) self.symbol = 'AAPL' self.date = '2015-01-29' self.strike = 120 self.expire_date = 'MAR 15' self.contract = 'CALL' self.option_code = 'AAPL150320C120' # save option contract self.option_contract = OptionContract() self.option_contract.symbol = self.symbol self.option_contract.data = { 'ex_month': 'MAR', 'ex_year': 15, 'option_code': self.option_code, 'right': 100, 'contract': self.contract, 'special': 'Weeklys', 'strike': '120', 'others': '' } self.option_contract.save() # save option self.option = Option() self.option.data = {'mark': 14.75, 'last': 14.85, 'ask': 14.9, 'bid': 14.55, 'date': '2015-04-02', 'delta': 0.97, 'dte': 0, 'extrinsic': 0.085, 'gamma': 0.01, 'impl_vol': 159.66, 'intrinsic': 14.64, 'open_int': 0.0, 'prob_itm': 96.86, 'prob_otm': 3.14, 'prob_touch': 6.18, 'theo_price': 0.0, 'theta': -0.25, 'vega': 0.0, 'volume': 0.0} self.option.option_contract = self.option_contract self.option.date = '2015-01-29' self.option.save()
def setUp(self): TestSetUpDB.setUp(self) self.statement = Statement( date='2014-11-14', account_statement='account statement data', position_statement='position statement data', trade_activity='trade activity data')
def setUp(self): TestSetUpDB.setUp(self) self.save_app_model = SaveAppModel( date='2014-11-14', statement=None, file_data='' )
def setUp(self): TestSetUpDB.setUp(self) self.future = Future(lookup='ES', symbol='SPX', description='E-mini S&P 500 Index Futures', session='ETH', expire_date='DEC 14', spc='1/50')
def setUp(self): TestSetUpDB.setUp(self) # create user User.objects.create_superuser( username='******', email='*****@*****.**', password='******' )
def setUp(self): TestSetUpDB.setUp(self) self.future = Future( lookup='ES', symbol='SPX', description='E-mini S&P 500 Index Futures', session='ETH', expire_date='DEC 14', spc='1/50')
def setUp(self): TestSetUpDB.setUp(self) self.acc_files = glob(os.path.join(test_acc_path, '*.csv')) self.acc_files = self.acc_files + [ os.path.join(test_path, '2014-11-19', '2014-11-19-AccountStatement.csv'), os.path.join(test_path, '2014-11-25', '2014-11-25-AccountStatement.csv'), os.path.join(real_path, '2015-02-27', '2015-02-28-AccountStatement.csv') ] self.save_acc = None
def setUp(self): TestSetUpDB.setUp(self) self.symbol = 'AAPL' self.date = '2015-01-29' self.strike = 120 self.expire_date = 'MAR 15' self.contract = 'CALL' self.option_code = 'AAPL150320C120' # save option contract self.option_contract = OptionContract() self.option_contract.symbol = self.symbol self.option_contract.data = { 'ex_month': 'MAR', 'ex_year': 15, 'option_code': self.option_code, 'right': 100, 'contract': self.contract, 'special': 'Weeklys', 'strike': '120', 'others': '' } self.option_contract.save() # save option self.option = Option() self.option.data = { 'mark': 14.75, 'last': 14.85, 'ask': 14.9, 'bid': 14.55, 'date': '2015-04-02', 'delta': 0.97, 'dte': 0, 'extrinsic': 0.085, 'gamma': 0.01, 'impl_vol': 159.66, 'intrinsic': 14.64, 'open_int': 0.0, 'prob_itm': 96.86, 'prob_otm': 3.14, 'prob_touch': 6.18, 'theo_price': 0.0, 'theta': -0.25, 'vega': 0.0, 'volume': 0.0 } self.option.option_contract = self.option_contract self.option.date = '2015-01-29' self.option.save()
def setUp(self): TestSetUpDB.setUp(self) self.symbol = 'IBM' self.date = '2015-04-02' self.source = 'tos_thinkback' self.items = {'high': 99.99, 'last': 99.64, 'volume': 6097146.0, 'low': 98.89, 'date': self.date, 'open': 99.44, 'net_change': 0.49} self.stock = Stock() self.stock.symbol = self.symbol self.stock.source = self.source self.stock.data = self.items self.stock.save() print Stock.objects.count()
def setUp(self): TestSetUpDB.setUp(self) self.user = User.objects.create_superuser( username='******', email='*****@*****.**', password='******') self.date = '2014-11-14' self.account_statement = SimpleUploadedFile( '2014-11-15-AccountStatement.csv', open( os.path.join(test_path, '2014-11-15', '2014-11-15-AccountStatement.csv')).read()) self.position_statement = SimpleUploadedFile( '2014-11-15-PositionStatement.csv', open( os.path.join(test_path, '2014-11-15', '2014-11-15-PositionStatement.csv')).read()) self.trade_activity = SimpleUploadedFile( '2014-11-15-TradeActivity.csv', open( os.path.join(test_path, '2014-11-15', '2014-11-15-TradeActivity.csv')).read())
def setUp(self): TestSetUpDB.setUp(self) self.user = User.objects.create_superuser(username='******', email='*****@*****.**', password='******') self.date = '2014-11-14' self.account_statement = SimpleUploadedFile( '2014-11-15-AccountStatement.csv', open( os.path.join(test_path, '2014-11-15', '2014-11-15-AccountStatement.csv')).read()) self.position_statement = SimpleUploadedFile( '2014-11-15-PositionStatement.csv', open( os.path.join(test_path, '2014-11-15', '2014-11-15-PositionStatement.csv')).read()) self.trade_activity = SimpleUploadedFile( '2014-11-15-TradeActivity.csv', open( os.path.join(test_path, '2014-11-15', '2014-11-15-TradeActivity.csv')).read())
def setUp(self): TestSetUpDB.setUp(self) self.symbol = 'IBM' self.date = '2015-04-02' self.source = 'tos_thinkback' self.items = { 'high': 99.99, 'last': 99.64, 'volume': 6097146.0, 'low': 98.89, 'date': self.date, 'open': 99.44, 'net_change': 0.49 } self.stock = Stock() self.stock.symbol = self.symbol self.stock.source = self.source self.stock.data = self.items self.stock.save() print Stock.objects.count()
def setUp(self): TestSetUpDB.setUp(self) self.items = {} self.test_cls = None self.expect_keys = None
def tearDown(self): TestSetUpDB.tearDown(self) # remove user User.objects.filter(username='******').delete()
def setUp(self): TestSetUpDB.setUp(self) self.save_app_model = SaveAppModel(date='2014-11-14', statement=None, file_data='')
def setUp(self): TestSetUpDB.setUp(self) self.underlying = Underlying(symbol='SPX', company='S&P 500 Index')