예제 #1
0
        curTrans["price"] = realTrans.price
        curTrans["volume"] = realTrans.volume
        curTrans["askorder"] = realTrans.askorder
        curTrans["bidorder"] = realTrans.bidorder

        if ctx is not None:
            ctx.on_get_transaction(bytes.decode(stdCode), curTrans, isLast)


'''
将回调函数转换成C接口识别的函数类型
'''
cb_strategy_init = CB_STRATEGY_INIT(on_strategy_init)
cb_strategy_tick = CB_STRATEGY_TICK(on_strategy_tick)
cb_strategy_calc = CB_STRATEGY_CALC(on_strategy_calc)
cb_strategy_bar = CB_STRATEGY_BAR(on_strategy_bar)
cb_strategy_get_bar = CB_STRATEGY_GET_BAR(on_strategy_get_bar)
cb_strategy_get_tick = CB_STRATEGY_GET_TICK(on_strategy_get_tick)
cb_stra_get_position = CB_STRATEGY_GET_POSITION(on_stra_get_position)

cb_session_event = CB_SESSION_EVENT(on_session_event)

cb_hftstra_ordque = CB_HFTSTRA_ORDQUE(on_hftstra_order_queue)
cb_hftstra_get_ordque = CB_HFTSTRA_GET_ORDQUE(on_hftstra_order_queue)
cb_hftstra_orddtl = CB_HFTSTRA_ORDDTL(on_hftstra_order_detail)
cb_hftstra_get_orddtl = CB_HFTSTRA_GET_ORDDTL(on_hftstra_order_queue)
cb_hftstra_trans = CB_HFTSTRA_TRANS(on_hftstra_transaction)
cb_hftstra_get_trans = CB_HFTSTRA_GET_TRANS(on_hftstra_order_queue)

cb_hftstra_chnl_evt = CB_HFTSTRA_CHNL_EVT(on_hftstra_channel_evt)
cb_hftstra_order = CB_HFTSTRA_ORD(on_hftstra_order)
예제 #2
0
    stdCode = bytes.decode(stdCode)
    message = bytes.decode(message)
    engine = theEngine
    ctx = engine.get_context(id)
    ctx.on_entrust(localid, stdCode, bSucc, message)


'''
将回调函数转换成C接口识别的函数类型
'''
cb_engine_event = CB_ENGINE_EVENT(on_engine_event)

cb_stra_init = CB_STRATEGY_INIT(on_stra_init)
cb_stra_tick = CB_STRATEGY_TICK(on_stra_tick)
cb_stra_calc = CB_STRATEGY_CALC(on_stra_calc)
cb_stra_bar = CB_STRATEGY_BAR(on_stra_bar)
cb_stra_get_bar = CB_STRATEGY_GET_BAR(on_stra_get_bar)
cb_stra_get_tick = CB_STRATEGY_GET_TICK(on_stra_get_tick)

cb_hftstra_chnl_evt = CB_HFTSTRA_CHNL_EVT(on_hftstra_channel_evt)
cb_hftstra_order = CB_HFTSTRA_ORD(on_hftstra_order)
cb_hftstra_trade = CB_HFTSTRA_TRD(on_hftstra_trade)
cb_hftstra_entrust = CB_HFTSTRA_ENTRUST(on_hftstra_entrust)


# Python对接C接口的库
class WtWrapper:
    '''
    Wt平台C接口底层对接模块
    '''