static void on_deep_market_data(struct CUstpFtdcDepthMarketDataField *deepmd) { Quote *quote; if (deepmd == NULL) { xcb_log(XCB_LOG_WARNING, "deepmd is NULL!"); return; } if (NEW0(quote)) { /* FIXME */ quote->thyquote.m_nLen = sizeof(tHYQuote); RMCHR(deepmd->UpdateTime, ':'); quote->thyquote.m_nTime = atoi(deepmd->UpdateTime) * 1000 + deepmd->UpdateMillisec; strcpy(quote->thyquote.m_cHYDM, deepmd->InstrumentID); quote->thyquote.m_dZJSJ = deepmd->PreSettlementPrice; quote->thyquote.m_dJJSJ = deepmd->SettlementPrice; quote->thyquote.m_dCJJJ = 0; quote->thyquote.m_dZSP = deepmd->PreClosePrice; quote->thyquote.m_dJSP = deepmd->ClosePrice; quote->thyquote.m_dJKP = deepmd->OpenPrice; quote->thyquote.m_nZCCL = deepmd->PreOpenInterest; quote->thyquote.m_nCCL = deepmd->OpenInterest; quote->thyquote.m_dZXJ = deepmd->LastPrice; quote->thyquote.m_nCJSL = deepmd->Volume; quote->thyquote.m_dCJJE = deepmd->Turnover; quote->thyquote.m_dZGBJ = deepmd->UpperLimitPrice; quote->thyquote.m_dZDBJ = deepmd->LowerLimitPrice; quote->thyquote.m_dZGJ = deepmd->HighestPrice; quote->thyquote.m_dZDJ = deepmd->LowestPrice; quote->thyquote.m_dZXSD = deepmd->PreDelta; quote->thyquote.m_dJXSD = deepmd->CurrDelta; quote->thyquote.m_dMRJG1 = deepmd->BidPrice1; quote->thyquote.m_dMCJG1 = deepmd->AskPrice1; quote->thyquote.m_nMRSL1 = deepmd->BidVolume1; quote->thyquote.m_nMCSL1 = deepmd->AskVolume1; quote->thyquote.m_dMRJG2 = deepmd->BidPrice2; quote->thyquote.m_dMCJG2 = deepmd->AskPrice2; quote->thyquote.m_nMRSL2 = deepmd->BidVolume2; quote->thyquote.m_nMCSL2 = deepmd->AskVolume2; quote->thyquote.m_dMRJG3 = deepmd->BidPrice3; quote->thyquote.m_dMCJG3 = deepmd->AskPrice3; quote->thyquote.m_nMRSL3 = deepmd->BidVolume3; quote->thyquote.m_nMCSL3 = deepmd->AskVolume3; quote->thyquote.m_dMRJG4 = deepmd->BidPrice4; quote->thyquote.m_dMCJG4 = deepmd->AskPrice4; quote->thyquote.m_nMRSL4 = deepmd->BidVolume4; quote->thyquote.m_nMCSL4 = deepmd->AskVolume4; quote->thyquote.m_dMRJG5 = deepmd->BidPrice5; quote->thyquote.m_dMCJG5 = deepmd->AskPrice5; quote->thyquote.m_nMRSL5 = deepmd->BidVolume5; quote->thyquote.m_nMCSL5 = deepmd->AskVolume5; process_quote(quote); } else xcb_log(XCB_LOG_WARNING, "Error allocating memory for quote"); }
static void on_best_and_deep(struct MDBestAndDeep *deepmd) { Quote *quote; if (deepmd == NULL) return; if (NEW0(quote)) { /* FIXME */ quote->thyquote.m_nLen = sizeof(tHYQuote); quote->thyquote.m_nTime = atoi(deepmd->GenTime); strcpy(quote->thyquote.m_cJYS, deepmd->Exchange); strcpy(quote->thyquote.m_cHYDM, deepmd->Contract); quote->thyquote.m_bTPBZ = deepmd->SuspensionSign; quote->thyquote.m_dZJSJ = deepmd->LastClearPrice; quote->thyquote.m_dJJSJ = deepmd->ClearPrice; quote->thyquote.m_dCJJJ = deepmd->AvgPrice; quote->thyquote.m_dZSP = deepmd->LastClose; quote->thyquote.m_dJSP = deepmd->Close; quote->thyquote.m_dJKP = deepmd->OpenPrice; quote->thyquote.m_nZCCL = deepmd->LastOpenInterest; quote->thyquote.m_nCCL = deepmd->OpenInterest; quote->thyquote.m_dZXJ = deepmd->LastPrice; quote->thyquote.m_nCJSL = deepmd->MatchTotQty; quote->thyquote.m_dCJJE = deepmd->Turnover; quote->thyquote.m_dZGBJ = deepmd->RiseLimit; quote->thyquote.m_dZDBJ = deepmd->FallLimit; quote->thyquote.m_dZGJ = deepmd->HighPrice; quote->thyquote.m_dZDJ = deepmd->LowPrice; quote->thyquote.m_dZXSD = deepmd->PreDelta; quote->thyquote.m_dJXSD = deepmd->CurrDelta; quote->thyquote.m_dMRJG1 = deepmd->BuyPriceOne; quote->thyquote.m_dMCJG1 = deepmd->SellPriceOne; quote->thyquote.m_nMRSL1 = deepmd->BuyQtyOne; quote->thyquote.m_nMCSL1 = deepmd->SellQtyOne; quote->thyquote.m_dMRJG2 = deepmd->BuyPriceTwo; quote->thyquote.m_dMCJG2 = deepmd->SellPriceTwo; quote->thyquote.m_nMRSL2 = deepmd->BuyQtyTwo; quote->thyquote.m_nMCSL2 = deepmd->SellQtyTwo; quote->thyquote.m_dMRJG3 = deepmd->BuyPriceThree; quote->thyquote.m_dMCJG3 = deepmd->SellPriceThree; quote->thyquote.m_nMRSL3 = deepmd->BuyQtyThree; quote->thyquote.m_nMCSL3 = deepmd->SellQtyThree; quote->thyquote.m_dMRJG4 = deepmd->BuyPriceFour; quote->thyquote.m_dMCJG4 = deepmd->SellPriceFour; quote->thyquote.m_nMRSL4 = deepmd->BuyQtyFour; quote->thyquote.m_nMCSL4 = deepmd->SellQtyFour; quote->thyquote.m_dMRJG5 = deepmd->BuyPriceFive; quote->thyquote.m_dMCJG5 = deepmd->SellPriceFive; quote->thyquote.m_nMRSL5 = deepmd->BuyQtyFive; quote->thyquote.m_nMCSL5 = deepmd->SellQtyFive; process_quote(quote); } else xcb_log(XCB_LOG_WARNING, "Error allocating memory for quote"); }
static void read_quote(event_loop el, int fd, int mask, void *data) { char *buf; struct sockaddr_in si; socklen_t slen = sizeof si; int nread; NOT_USED(el); NOT_USED(mask); NOT_USED(data); if ((buf = CALLOC(1, sizeof (Quote))) == NULL) return; /* FIXME */ if ((nread = recvfrom(fd, buf, sizeof (Quote), 0, (struct sockaddr *)&si, &slen)) > 0 && strcmp(buf, "")) process_quote(buf); else FREE(buf); }
int main(void){ struct entry quote; int quoteNo = 0; do{ printf("Please enter a Quote or Q to quit. \n"); scanf("%c", "e.quote); if(quote != Q && strlen(quote.quote) < MAXLEN && !exist(quote.quote) && ++quoteNo < MAXENTRY){ process_quote(quote.quote); } } while (input != Q); free_mem(tail); return 0; }
static void on_deep_market_data(struct DFITCDepthMarketDataField *deepmd) { Quote *quote; if (deepmd == NULL) return; if (NEW0(quote)) { /* FIXME */ quote->thyquote.m_nLen = sizeof (tHYQuote); RMCHR(deepmd->UpdateTime, ':'); quote->thyquote.m_nTime = atoi(deepmd->UpdateTime) * 1000 + deepmd->UpdateMillisec; strcpy(quote->thyquote.m_cJYS, deepmd->exchangeID); strcpy(quote->thyquote.m_cHYDM, deepmd->instrumentID); quote->thyquote.m_dZJSJ = deepmd->preSettlementPrice; quote->thyquote.m_dJJSJ = deepmd->settlementPrice; quote->thyquote.m_dCJJJ = deepmd->AveragePrice; quote->thyquote.m_dZSP = deepmd->preClosePrice; quote->thyquote.m_dJSP = deepmd->closePrice; quote->thyquote.m_dJKP = deepmd->openPrice; quote->thyquote.m_nZCCL = deepmd->preOpenInterest; quote->thyquote.m_nCCL = deepmd->openInterest; quote->thyquote.m_dZXJ = deepmd->lastPrice; quote->thyquote.m_nCJSL = deepmd->Volume; quote->thyquote.m_dCJJE = deepmd->turnover; quote->thyquote.m_dZGBJ = deepmd->upperLimitPrice; quote->thyquote.m_dZDBJ = deepmd->lowerLimitPrice; quote->thyquote.m_dZGJ = deepmd->highestPrice; quote->thyquote.m_dZDJ = deepmd->lowestPrice; quote->thyquote.m_dZXSD = deepmd->preDelta; quote->thyquote.m_dJXSD = deepmd->currDelta; quote->thyquote.m_dMRJG1 = deepmd->BidPrice1; quote->thyquote.m_dMCJG1 = deepmd->AskPrice1; quote->thyquote.m_nMRSL1 = deepmd->BidVolume1; quote->thyquote.m_nMCSL1 = deepmd->AskVolume1; process_quote(quote); } else xcb_log(XCB_LOG_WARNING, "Error allocating memory for quote"); }