Ejemplo n.º 1
0
def run_console():
    sas = StockAnalysisSystem()
    sas.check_initialize()

    # update_special()
    # update_local([
    #     # 'Market.SecuritiesInfo',
    #     #
    #     # 'Market.NamingHistory',
    #     # 'Market.TradeCalender',
    #     #
    #     # 'Finance.Audit',
    #     # 'Finance.BalanceSheet',
    #     # 'Finance.IncomeStatement',
    #     # 'Finance.CashFlowStatement',
    #     #
    #     # 'Stockholder.PledgeStatus',
    #     # 'Stockholder.PledgeHistory',
    #     # 'Stockholder.Statistics',
    #     #
    #     # 'TradeData.Stock.Daily',
    #     #
    #     # 'Market.IndexInfo',
    #     # 'TradeData.Index.Daily',
    # ], True)
    # run_strategy()
    run_calc_factor()

    exit(0)
Ejemplo n.º 2
0
def run_ui():
    app = QApplication(sys.argv)

    sas = StockAnalysisSystem()
    sas.check_initialize()

    while not sas.is_initialized():
        dlg = WrapperQDialog(ConfigUi(False))
        dlg.exec()
        sas.check_initialize()

    main_wnd = MainWindow()
    main_wnd.show()
    sys.exit(app.exec())
Ejemplo n.º 3
0
def update_local(update_list: [str], force: bool = False):
    sas = StockAnalysisSystem()
    sas.check_initialize()

    data_hub = sas.get_data_hub_entry()
    data_center = data_hub.get_data_center()
    data_utility = data_hub.get_data_utility()

    if 'Market.SecuritiesInfo' in update_list:
        print('Updating SecuritiesInfo...')
        data_center.update_local_data('Market.SecuritiesInfo', force=force)

    if 'Market.NamingHistory' in update_list:
        print('Updating Naming History...')
        data_center.update_local_data('Market.NamingHistory', force=force)

    if 'Market.TradeCalender' in update_list:
        print('Updating TradeCalender...')
        data_center.update_local_data('Market.TradeCalender',
                                      exchange='SSE',
                                      force=force)

    stock_list = data_utility.get_stock_list()

    start_total = time.time()
    print('Updating Finance Data for All A-SHARE Stock.')

    counter = 0
    for stock_identity, name in stock_list:
        start_single = time.time()
        print('Updating Finance Data for ' + stock_identity + ' [' + name +
              ']')
        if 'Finance.Audit' in update_list:
            data_center.update_local_data('Finance.Audit',
                                          stock_identity,
                                          force=force)
        if 'Finance.BalanceSheet' in update_list:
            data_center.update_local_data('Finance.BalanceSheet',
                                          stock_identity,
                                          force=force)
        if 'Finance.IncomeStatement' in update_list:
            data_center.update_local_data('Finance.IncomeStatement',
                                          stock_identity,
                                          force=force)
        if 'Finance.CashFlowStatement' in update_list:
            data_center.update_local_data('Finance.CashFlowStatement',
                                          stock_identity,
                                          force=force)

        if 'TradeData.Stock.Daily' in update_list:
            data_center.update_local_data('TradeData.Stock.Daily',
                                          stock_identity,
                                          force=force)

        if 'Stockholder.PledgeStatus' in update_list:
            data_center.update_local_data('Stockholder.PledgeStatus',
                                          stock_identity,
                                          force=force)
        if 'Stockholder.PledgeHistory' in update_list:
            data_center.update_local_data('Stockholder.PledgeHistory',
                                          stock_identity,
                                          force=force)
        if 'Stockholder.Statistics' in update_list:
            data_center.update_local_data('Stockholder.Statistics',
                                          stock_identity,
                                          force=force)

        counter += 1
        print('Done (%s / %s). Time Spending: %s s' %
              (counter, len(stock_list), time.time() - start_single))

    if 'Market.IndexInfo' in update_list:
        print('Updating IndexInfo...')
        data_center.update_local_data('Market.IndexInfo',
                                      force=force,
                                      dump_flag=True)

    index_dict = data_utility.get_support_index_identities()
    index_list = list(index_dict.keys())
    print('Updating Index Data for All Support Market.')

    counter = 0
    for index_identity, name in index_list:
        start_single = time.time()

        if 'TradeData.Index.Daily' in update_list:
            data_center.update_local_data('TradeData.Index.Daily',
                                          index_identity,
                                          force=force)

        counter += 1
        print('Done (%s / %s). Time Spending: %s s' %
              (counter, len(index_list), time.time() - start_single))

    print('Update Finance Data for All A-SHARE Stock Done. Time Spending: ' +
          str(time.time() - start_total) + 's')