Esempio n. 1
0
def update_snapshots(runtime):
    """
    更新市场信息。
    """
    runtime['snapshots'] = tradingObjects.snapshots(
        data_stream.next().instruments)
    runtime['snapshots_count'] += 1
Esempio n. 2
0
def update_snapshots(runtime):
    """
    更新市场信息。
    """
    runtime['snapshots'] = tradingObjects.snapshots(data_stream.next().instruments)
    runtime['isDigested_A001.PSE'] = 0
    runtime['isDigested_A002.PSE'] = 0
    runtime['isDigested_B001.PSE'] = 0
    runtime['isDigested_B002.PSE'] = 0
    runtime['snapshots_count'] += 1
Esempio n. 3
0
def initStrategy(runtime):
    """
    初始化策略。
    """
    #api.cancel_all()
    #api.close_all_at_market()

    runtime['trader_info_full'] = api.get_trader_full()
    runtime['account_info'] = runtime['trader_info_full'].account
    runtime['order_info'] = tradingObjects.order_info(
        runtime['trader_info_full'])
    runtime['positions_info'] = tradingObjects.positions_info(
        runtime['trader_info_full'])

    runtime['TARGETS_MAPPING'] = {
        'A001.PSE': 'A000.PSE',
        'A002.PSE': 'A000.PSE',
        'B001.PSE': 'B000.PSE',
        'B002.PSE': 'B000.PSE'
    }

    runtime['snapshots_count'] = 0
    runtime['snapshots'] = tradingObjects.snapshots(
        data_stream.next().instruments)

    runtime['isOpen_A001.PSE'] = True
    runtime['isOpen_A002.PSE'] = True
    runtime['isOpen_B001.PSE'] = True
    runtime['isOpen_B002.PSE'] = True

    runtime['loopCount_A001.PSE'] = 0
    runtime['loopCount_A002.PSE'] = 0
    runtime['loopCount_B001.PSE'] = 0
    runtime['loopCount_B002.PSE'] = 0

    runtime['trader_info_count'] = 0

    runtime['net_A001.PSE'] = 0
    runtime['net_A002.PSE'] = 0
    runtime['net_B001.PSE'] = 0
    runtime['net_B002.PSE'] = 0

    runtime['isDigested_A001.PSE'] = 0
    runtime['isDigested_A002.PSE'] = 0
    runtime['isDigested_B001.PSE'] = 0
    runtime['isDigested_B002.PSE'] = 0
    runtime['isDigested_arbitrage'] = 0

    runtime['targetNetPos_A001.PSE'] = 0
    runtime['targetNetPos_A002.PSE'] = 0
    runtime['targetNetPos_B001.PSE'] = 0
    runtime['targetNetPos_B002.PSE'] = 0