void CTraderApi::OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { if (!IsErrorRspInfo(pRspInfo, nRequestID, bIsLast)) { if (pInstrument) { InstrumentField* pField = (InstrumentField*)m_msgQueue->new_block(sizeof(InstrumentField)); strcpy(pField->InstrumentID, pInstrument->instID); strcpy(pField->ExchangeID, pInstrument->exchangeID); strcpy(pField->Symbol, pInstrument->instID); strcpy(pField->InstrumentName, pInstrument->name); pField->Type = CThostFtdcInstrumentField_2_InstrumentType(pInstrument); //pField->VolumeMultiple = pInstrument->VolumeMultiple; pField->PriceTick = pInstrument->tick; //strncpy(pField->ExpireDate, pInstrument->ExpireDate, sizeof(TThostFtdcDateType)); //pField->OptionsType = TThostFtdcOptionsTypeType_2_PutCall(pInstrument->OptionsType); m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInstrument, m_msgQueue, this, bIsLast, 0, pField, sizeof(InstrumentField), nullptr, 0, nullptr, 0); } else { m_msgQueue->Input_NoCopy(ResponeType::OnRspQryInstrument, m_msgQueue, this, bIsLast, 0, nullptr, 0, nullptr, 0, nullptr, 0); } } }
void CTraderApi::OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { if (!IsErrorRspInfo(pRspInfo, nRequestID, bIsLast)) { if (pInstrument) { InstrumentField field = { 0 }; strcpy(field.InstrumentID, pInstrument->instID); strcpy(field.ExchangeID, pInstrument->exchangeID); strcpy(field.Symbol, pInstrument->instID); strcpy(field.InstrumentName, pInstrument->name); field.Type = CThostFtdcInstrumentField_2_InstrumentType(pInstrument); //field.VolumeMultiple = pInstrument->VolumeMultiple; field.PriceTick = pInstrument->tick; //strncpy(field.ExpireDate, pInstrument->ExpireDate, sizeof(TThostFtdcDateType)); //field.OptionsType = TThostFtdcOptionsTypeType_2_PutCall(pInstrument->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); }