示例#1
0
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()
示例#2
0
import sys

from AShareData import generate_db_interface_from_config, set_global_config, TushareData
from AShareData.model import FamaFrench3FactorModel, FamaFrenchCarhart4FactorModel, SMBandHMLCompositor, UMDCompositor
from update_routine import daily_routine

if __name__ == '__main__':
    config_loc = sys.argv[1]
    db_interface = generate_db_interface_from_config(config_loc, init=True)
    set_global_config(config_loc)

    with TushareData() as tushare_data:
        tushare_data.init_db()
        tushare_data.init_accounting_data()

    daily_routine(config_loc)

    SMBandHMLCompositor(FamaFrench3FactorModel()).update()
    UMDCompositor(FamaFrenchCarhart4FactorModel()).update()
示例#3
0
import sys

from AShareData import ConstLimitStockFactorCompositor, JQData, set_global_config, TushareData, WindData

if __name__ == '__main__':
    set_global_config(sys.argv[1])

    tushare_crawler = TushareData()
    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()

    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()
示例#4
0
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} 集合竞价数据下载失败.')
import datetime as dt
import sys

# from DingTalkMessageBot import DingTalkMessageBot

from AShareData import set_global_config, TushareData

if __name__ == '__main__':
    config_loc = sys.argv[1]
    set_global_config(config_loc)

    tushare_crawler = TushareData()
    tushare_crawler.get_ipo_info()

    # messenger = DingTalkMessageBot.from_config(config_loc, '自闭')
    # try:
    #     with JQData() as jq_data:
    #         date = dt.date.today()
    #         jq_data.stock_open_auction_data(date)
    #         messenger.send_message(f'{date} 集合竞价数据已下载.')
    # except:
    #     messenger.send_message(f'{date} 集合竞价数据下载失败.')
示例#6
0
 def setUp(self) -> None:
     set_global_config('config.json')
     self.downloader = TushareData()
示例#7
0
class Tushare2MySQLTest(unittest.TestCase):
    def setUp(self) -> None:
        set_global_config('config.json')
        self.downloader = TushareData()

    def test_calendar(self):
        print(self.downloader.calendar.calendar)

    def test_financial(self):
        self.downloader.get_financial(['300146.SZ', '000001.SZ'])

    def test_index(self):
        self.downloader.get_index_daily()

    def test_ipo_info(self):
        self.downloader.get_ipo_info()

    def test_all_past_names(self):
        self.downloader.init_stock_names()

    def test_past_names(self):
        self.downloader.update_stock_names()

    def test_company_info(self):
        self.downloader.get_company_info()

    def test_daily_hq(self):
        self.downloader.get_daily_hq(start_date='2010917')

    def test_all_dividend(self):
        self.downloader.get_all_dividend()

    def test_routine(self):
        # self.downloader.update_routine()
        pass

    def test_hs_const(self):
        self.downloader.get_hs_constitute()

    def test_shibor(self):
        self.downloader.get_shibor(end_date='20111010')

    def test_index_weight(self):
        self.downloader.get_index_weight(start_date='20050101')