| | |
| | | return cls.__request("get_history_instruments", |
| | | {"symbols": symbols, "start_date": start_date, "end_date": end_date, "fields": fields}) |
| | | |
| | | |
| | | |
| | | @classmethod |
| | | def get_previous_trading_date(cls, exchange, date): |
| | | return cls.__request("get_previous_trading_date", {"exchange": exchange, "date": date}) |
| | |
| | | return results |
| | | |
| | | @classmethod |
| | | def get_gp_current_info(cls, codes): |
| | | def get_gp_current_info(cls, codes, fields=None): |
| | | if not codes: |
| | | return [] |
| | | symbols = cls.get_juejin_code_list_with_prefix(codes) |
| | |
| | | data = gmapi.current(symbols=",".join(symbols)) |
| | | return data |
| | | else: |
| | | data = JueJinHttpApi.current(symbols=",".join(symbols), fields='') |
| | | data = JueJinHttpApi.current(symbols=",".join(symbols), fields=fields) |
| | | return data |
| | | # 返回指定日期的上个交易日 |
| | | |
| | |
| | | account_id, s_id, token = cls.getJueJinAccountInfo() |
| | | gmapi.set_token(token) |
| | | return gmapi.get_history_instruments(symbols=symbols, start_date=start_date, end_date=end_date, |
| | | fields="symbol,sec_type,sec_id,sec_name,listed_date,sec_level,is_suspended,pre_close") |
| | | fields="symbol,sec_type,sec_id,sec_name,listed_date,sec_level,is_suspended,pre_close") |
| | | else: |
| | | return JueJinHttpApi.get_history_instruments(symbols, start_date, end_date, fields) |
| | | |
| | |
| | | |
| | | if __name__ == "__main__": |
| | | now_day = tool.get_now_date_str() |
| | | results = JueJinApi.get_history_instruments(JueJinApi.get_juejin_code_list_with_prefix(["600265"]), tool.date_sub(now_day,30), tool.date_sub(now_day,1)) |
| | | results = JueJinApi.get_history_instruments(JueJinApi.get_juejin_code_list_with_prefix(["600265"]), |
| | | tool.date_sub(now_day, 30), tool.date_sub(now_day, 1)) |
| | | results = results[-5:] |
| | | normal = True |
| | | for r in results: |
| | | if r["sec_level"]!=1: |
| | | if r["sec_level"] != 1: |
| | | normal = False |
| | | break |
| | | print(normal) |