void CTraderApi::OnRspQryInstrument(CUstpFtdcRspInstrumentField *pRspInstrument, CUstpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { if (!IsErrorRspInfo(pRspInfo, nRequestID, bIsLast)) { if (pRspInstrument) { InstrumentField* pField = (InstrumentField*)m_msgQueue->new_block(sizeof(InstrumentField)); strcpy(pField->InstrumentID, pRspInstrument->InstrumentID); strcpy(pField->ExchangeID, pRspInstrument->ExchangeID); strcpy(pField->Symbol, pRspInstrument->InstrumentID); strncpy(pField->ProductID, pRspInstrument->ProductID, sizeof(InstrumentIDType)); strcpy(pField->InstrumentName, pRspInstrument->InstrumentName); pField->Type = CUstpFtdcRspInstrumentField_2_InstrumentType(pRspInstrument); pField->VolumeMultiple = pRspInstrument->VolumeMultiple; pField->PriceTick = pRspInstrument->PriceTick; pField->ExpireDate = GetDate(pRspInstrument->ExpireDate); pField->OptionsType = TUstpFtdcOptionsTypeType_2_PutCall(pRspInstrument->OptionsType); pField->StrikePrice = pRspInstrument->StrikePrice == DBL_MAX ? 0 : pRspInstrument->StrikePrice; m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInstrument, m_msgQueue, m_pClass, bIsLast, 0, pField, sizeof(InstrumentField), nullptr, 0, nullptr, 0); } else { m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInstrument, m_msgQueue, m_pClass, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); } } }
void CTraderApi::OnRspQryInstrument(CUstpFtdcRspInstrumentField *pRspInstrument, CUstpFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { if (!IsErrorRspInfo(pRspInfo, nRequestID, bIsLast)) { if (pRspInstrument) { InstrumentField field = { 0 }; strcpy(field.InstrumentID, pRspInstrument->InstrumentID); strcpy(field.ExchangeID, pRspInstrument->ExchangeID); strcpy(field.Symbol, pRspInstrument->InstrumentID); strcpy(field.InstrumentName, pRspInstrument->InstrumentName); field.Type = CUstpFtdcRspInstrumentField_2_InstrumentType(pRspInstrument); field.VolumeMultiple = pRspInstrument->VolumeMultiple; field.PriceTick = pRspInstrument->PriceTick; strcpy(field.ExpireDate, pRspInstrument->ExpireDate); field.OptionsType = TUstpFtdcOptionsTypeType_2_PutCall(pRspInstrument->OptionsType); XRespone(ResponeType::OnRspQryInstrument, m_msgQueue, this, bIsLast, 0, &field, sizeof(InstrumentField), nullptr, 0, nullptr, 0); } else { XRespone(ResponeType::OnRspQryInstrument, m_msgQueue, this, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); } } if (bIsLast) ReleaseRequestMapBuf(nRequestID); }