Example #1
0
    def onGetTradeListRsp(rpcGetTradeListRsp):
        reqId = rpcGetTradeListRsp.commonRsp.reqId

        RpcClientRspHandler.__waitReqIdSetLock.acquire()
        RpcClientRspHandler.__rpcGetTradeListRspDictLock.acquire()
        try:
            if reqId in RpcClientRspHandler.__waitReqIdSet:
                RpcClientRspHandler.__rpcGetTradeListRspDict[
                    reqId] = rpcGetTradeListRsp
            else:
                logger.info("直接丢弃的回报,请求ID:%s", reqId)

        finally:
            RpcClientRspHandler.__waitReqIdSetLock.release()
            RpcClientRspHandler.__rpcGetTradeListRspDictLock.release()

        if rpcGetTradeListRsp.trade:
            ClientTradeCacheService.storeTradeList(rpcGetTradeListRsp.trade)
 def onRpcTradeListRtn(rpcTradeListRtn):
     ClientTradeCacheService.storeTradeList(rpcTradeListRtn.trade)
     for trade in rpcTradeListRtn.trade:
         StrategyEngine.onTrade(trade)