示例#1
0
 def test_select_coroutines_no_route(self):
     td_call = tdCall.tdCall(credentials.access_token, symbols=['SPY'],
                             configs=[{"other":"test"}])
     self.assertRaises(ValueError, td_call.get_configs)
     td_call = tdCall.tdCall(credentials.access_token, symbols=['SPY'],
                             configs=[{}])
     self.assertRaises(ValueError, td_call.get_configs)
示例#2
0
 def test_select_coroutines_hist_opt_no_parameters(self):
     td_call = tdCall.tdCall(credentials.access_token, symbols=['SPY'],
                             configs=[{'route': 'h'},{'route': 'o'}])
     config = td_call.get_configs()
     coroutines = td_call.get_coroutines(config, td_call.symbols)
     result = td_call.wrap_schedule(coroutines)
     self.assertEqual(len(result), 2)
示例#3
0
 def test_get_td_data(self):
     td_call = tdCall.tdCall(credentials.access_token, symbols=['SPY'],
                             configs=[{'route': 'h'}, {'route': 'o'}])
     self.assertEqual(len(td_call.get_td_data()),2)
示例#4
0
 def test_get_configs(self):
     td_call = tdCall.tdCall(credentials.access_token, symbols=['SPY', 'AGG'], configs=[{'route':'h', 'periodType': 'daily'}])
     config = td_call.get_configs()
     self.assertEqual(type(config), list)
示例#5
0
 def test_select_coroutines_opt_no_parameters(self):
     td_call = tdCall.tdCall(credentials.access_token, symbols=['SPY'],
                             configs=[{'route': 'o'}])
     config = td_call.get_configs()
     result = td_call.wrap_schedule(td_call.get_coroutines(config, td_call.symbols))
     self.assertEqual(result[0][0]['symbol'], 'SPY')
示例#6
0
 def test_get_td_data_only_credentials(self):
     td_call = tdCall.tdCall(credentials.access_token)
     print(td_call.get_td_data())