def test_bar(): from jaqs.data.dataservice import RemoteDataService from jaqs.trade.common import QUOTE_TYPE ds = RemoteDataService() df_quotes, msg = ds.bar(symbol='rb1710.SHF,hc1710.SHF', start_time=200000, end_time=160000, trade_date=20170704, freq=QUOTE_TYPE.MIN) for i in range(100): quotes_list = Bar.create_from_df(df_quotes)
def test_remote_data_service_bar(): ds = RemoteDataService() # test bar res2, msg2 = ds.bar('rb1710.SHF,600662.SH', start_time=200000, end_time=160000, trade_date=20170831, fields="") assert msg2 == '0,' rb2 = res2.loc[res2.loc[:, 'symbol'] == 'rb1710.SHF', :] stk2 = res2.loc[res2.loc[:, 'symbol'] == '600662.SH', :] assert set(rb2.columns) == {u'close', u'code', u'date', u'freq', u'high', u'low', u'oi', u'open', u'settle', u'symbol', u'time', u'trade_date', u'turnover', u'volume', u'vwap'} assert abs(rb2.loc[:, 'settle'].values[0] - 0.0) < 1e-3 assert rb2.shape == (345, 15) assert stk2.shape == (240, 15) assert rb2.loc[:, 'volume'].values[344] == 3366