def test_remote_data_service_fin_indicator(): ds = RemoteDataService() symbol = '000008.SZ' filter_argument = ds._dic2url({'symbol': symbol}) df_raw, msg = ds.query("lb.finIndicator", fields="", filter=filter_argument, orderby="symbol")
def test_remote_data_service_daily_ind_performance(): ds = RemoteDataService() hs300 = ds.get_index_comp('000300.SH', 20140101, 20170101) hs300_str = ','.join(hs300) fields = "pb,pe,share_float_free,net_assets,limit_status" res, msg = ds.query("lb.secDailyIndicator", fields=fields, filter=("symbol=" + hs300_str + "&start_date=20160907&end_date=20170907"), orderby="trade_date") assert msg == '0,'
def test_remote_data_service_lb(): ds = RemoteDataService() # test lb.secDailyIndicator fields = "pb,pe,share_float_free,net_assets,limit_status" for res3, msg3 in [ds.query("lb.secDailyIndicator", fields=fields, filter="symbol=600030.SH&start_date=20170907&end_date=20170907", orderby="trade_date"), ds.query_lb_dailyindicator('600030.SH', 20170907, 20170907, fields)]: assert msg3 == '0,' assert abs(res3.loc[0, 'pb'] - 1.5135) < 1e-4 assert abs(res3.loc[0, 'share_float_free'] - 781496.5954) < 1e-4 assert abs(res3.loc[0, 'net_assets'] - 1.437e11) < 1e8 assert res3.loc[0, 'limit_status'] == 0 # test lb.income for res4, msg4 in [ds.query("lb.income", fields="", filter="symbol=600000.SH&start_date=20150101&end_date=20170101&report_type=408001000", order_by="report_date"), ds.query_lb_fin_stat('income', '600000.SH', 20150101, 20170101, fields="")]: assert msg4 == '0,' assert res4.shape == (8, 12) assert abs(res4.loc[4, 'oper_rev'] - 120928000000) < 1