class MyTestCase(unittest.TestCase): def setUp(self) -> None: set_global_config('config.json') self.jq_data = JQData() def test_jq_login(self): self.jq_data.update_convertable_bond_list()
def setUp(self) -> None: config_loc = 'config.json' with open(config_loc, 'r') as f: config = json.load(f) config_loc = 'config.json' engine = prepare_engine(config_loc) db_interface = MySQLInterface(engine) self.jq_data = JQData(db_interface, config['jq_mobile'], config['jq_password'])
class MyTestCase(unittest.TestCase): def setUp(self) -> None: config_loc = 'config.json' with open(config_loc, 'r') as f: config = json.load(f) config_loc = 'config.json' engine = prepare_engine(config_loc) db_interface = MySQLInterface(engine) self.jq_data = JQData(db_interface, config['jq_mobile'], config['jq_password']) def test_jq_login(self): self.jq_data.update_convertable_bond_list()
def daily_routine(config_loc: str): set_global_config(config_loc) with TushareData() as tushare_crawler: tushare_crawler.update_base_info() tushare_crawler.get_shibor() tushare_crawler.get_ipo_info() tushare_crawler.get_company_info() tushare_crawler.update_hs_holding() tushare_crawler.get_hs_constitute() tushare_crawler.update_stock_names() tushare_crawler.update_dividend() tushare_crawler.update_index_daily() tushare_crawler.update_hk_stock_daily() tushare_crawler.update_fund_daily() tushare_crawler.update_fund_dividend() tushare_crawler.update_financial_data() with WindData() as wind_data: wind_data.update_stock_daily_data() wind_data.update_stock_adj_factor() wind_data.update_stock_units() wind_data.update_industry() wind_data.update_pause_stock_info() wind_data.update_convertible_bond_daily_data() wind_data.update_cb_convertible_price() wind_data.update_future_daily_data() wind_data.update_fund_extra_info() wind_data.update_fund_info() wind_data.update_stock_option_daily_data() with JQData() as jq_data: jq_data.update_stock_morning_auction_data() with TDXData() as tdx_data: tdx_data.update_stock_minute() tdx_data.update_convertible_bond_minute() # compute data ConstLimitStockFactorCompositor().update() NegativeBookEquityListingCompositor().update() IndexUpdater().update() # model data SMBandHMLCompositor().update() UMDCompositor().update()
tushare_crawler.get_company_info() tushare_crawler.update_hs_holding() tushare_crawler.get_hs_constitute() tushare_crawler.update_stock_names() tushare_crawler.update_dividend() tushare_crawler.update_index_daily() tushare_crawler.update_hk_stock_daily() tushare_crawler.update_fund_daily() tushare_crawler.update_fund_dividend() with WindData() as wind_data: wind_data.update_stock_daily_data() wind_data.update_stock_adj_factor() wind_data.update_stock_units() wind_data.update_industry() wind_data.update_pause_stock_info() wind_data.update_convertible_bond_daily_data() wind_data.update_future_daily_data() wind_data.update_stock_option_daily_data() with JQData() as jq_data: jq_data.update_stock_morning_auction_data() jq_data.update_stock_minute() ConstLimitStockFactorCompositor().update()
def setUp(self) -> None: set_global_config('config.json') self.jq_data = JQData()
import datetime as dt import json import sys from DingTalkMessageBot import DingTalkMessageBot from AShareData import JQData, MySQLInterface, prepare_engine, TushareData if __name__ == '__main__': config_loc = sys.argv[1] date = dt.date.today() with open(config_loc, 'r') as f: config = json.load(f) engine = prepare_engine(config_loc) db_interface = MySQLInterface(engine) tushare_crawler = TushareData(config['tushare_token'], db_interface=db_interface) tushare_crawler.get_ipo_info() token = '076314e3a582ce36705d53dc0b822493c046447b82e3cfb1571850debe500b15' secret = 'SEC2931f95f8d27145c579b8f37eb479fc587a3caec441829b5a4999b90271286c4' messenger = DingTalkMessageBot(token, secret) try: with JQData(db_interface, config['jq_mobile'], config['jq_password']) as jq_data: jq_data.stock_open_auction_data(date) messenger.send_message(f'{date} 集合竞价数据已下载.') except: messenger.send_message(f'{date} 集合竞价数据下载失败.')