コード例 #1
0
ファイル: UpdateDataCenter.py プロジェクト: dxcv/fQuant
def updateStock(stock_id, date_start, date_end, incremental):
    getDailyHFQ(stock_id=stock_id,
                is_index=False,
                date_start=date_start,
                date_end=date_end,
                time_to_market=None,
                incremental=incremental)
    print('Update Price:', stock_id)
コード例 #2
0
ファイル: UpdateDataCenter.py プロジェクト: dxcv/fQuant
def updatePriceIndex(incremental=False):
    for index_id in c.index_list:
        getDailyHFQ(stock_id=index_id,
                    is_index=True,
                    date_start=date_start,
                    date_end=date_end,
                    time_to_market=None,
                    incremental=incremental)
        print('Update Price:', index_id)
コード例 #3
0
ファイル: UpdateDataCenter.py プロジェクト: dxcv/fQuant
def updatePriceStock(incremental=False):
    # Check pre-requisite
    basics = loadStockBasics()
    if u.isNoneOrEmpty(basics):
        print('Need to have stock basics!')
        raise SystemExit

    # Iterate over all stocks
    basics_number = len(basics)
    for i in range(basics_number):
        stock_id = u.stockID(basics.loc[i, 'code'])
        time_to_market = u.dateFromStr(basics.loc[i, 'timeToMarket'])
        getDailyHFQ(stock_id=stock_id,
                    is_index=False,
                    date_start=time_to_market,
                    date_end=date_end,
                    time_to_market=time_to_market,
                    incremental=incremental)
        print('Update Price:', stock_id)
コード例 #4
0
ファイル: UpdateDataCenter.py プロジェクト: dxcv/fQuant
def updatePriceCXG(incremental=False):
    # Check pre-requisite
    cxg = loadCXG()
    if u.isNoneOrEmpty(cxg):
        print('Need to have CXG data!')
        raise SystemExit

    # Iterate over all CXG stocks
    cxg_number = len(cxg)
    print('Number of CXG:', cxg_number)
    for i in range(cxg_number):
        stock_id = u.stockID(cxg.ix[i, 'code'])
        time_to_market = u.dateFromStr(cxg.loc[i, 'timeToMarket'])
        getDailyHFQ(stock_id=stock_id,
                    is_index=False,
                    date_start=time_to_market,
                    date_end=date_end,
                    time_to_market=time_to_market,
                    incremental=incremental)
        print('Update Price:', stock_id)
コード例 #5
0
ファイル: GenerateIndex.py プロジェクト: dxcv/fQuant
def generateIndex(index_name, base_date, base_point, weight_method,
                  benchmark_id):
    # Load Index Component Stocks
    component = load_component(index_name)
    if u.isNoneOrEmpty(component):
        print('Index Component Not Available:', index_name)
        raise SystemExit
    if gs.is_debug:
        print(component.head(10))

    # Update Benchmark Index LSHQ to Latest
    date_start = u.dateFromStr(base_date)
    date_end = u.today()
    getDailyHFQ(stock_id=benchmark_id,
                is_index=True,
                date_start=date_start,
                date_end=date_end,
                time_to_market=None,
                incremental=True)
    print('Update Price:', benchmark_id)

    # Update Component Stock LSHQ to Latest
    component_number = len(component)
    for i in range(component_number):
        stock_id = u.stockID(component.ix[i, 'code'])
        getDailyHFQ(stock_id=stock_id,
                    is_index=False,
                    date_start=date_start,
                    date_end=date_end,
                    time_to_market=None,
                    incremental=True)
        print('Update Price:', stock_id)

    # Generate Index
    generate_index(index_name, base_date, base_point, weight_method,
                   benchmark_id)