#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <time.h>
#include "tagwire.h"
#include "fssdefine.h"
#define HEADERINDEX 13
int main(int argc, char *argv[])
{
FILE *fp=NULL;
char rbuf[4096 * 2L];
if(argc != 2) return -1;
if((fp=fopen(argv[1], "rt"))==NULL) return -1;
while(1)
{
memset(rbuf, 0x00, sizeof(rbuf));
if(fgets(rbuf, sizeof(rbuf), fp)==NULL) break;
rbuf[strlen(rbuf)-1]=0x00;
if(memcmp(rbuf+HEADERINDEX,"296=",4)==0)
{
struct TradableInstrument *ie=NULL;
ie = TradableInstrument(rbuf + HEADERINDEX);
if(ie != NULL)
{
//printf("%s", rbuf);
printf("SEQ[%07ld],", kk+1);
printf("MessageID[%.4s],", rbuf+HEADERINDEX);
printf("shortName:[%s],", ie->shortName);
printf("orderBookId:[%ld],", ie->orderBookId);
printf("closingPrice:[%ld],", ie->closingPrice);
printf("isDeleted:[%c],", ie->isDeleted);
printf("upperPriceLimit:[%ld],", ie->upperPriceLimit);
printf("lowerPriceLimit:[%ld],", ie->lowerPriceLimit);
printf("closingDate:[%s]", ie->closingDate);
printf("\n");
}
}
else if(memcmp(rbuf+HEADERINDEX,"496=",4)==0)
{
struct IndexEvent *ie=NULL;
ie = IndexEvent(rbuf + HEADERINDEX);
if(ie != NULL)
{
//printf("%s", rbuf);
printf("SEQ[%07ld],", kk+1);
printf("MessageID[%.4s],", rbuf+HEADERINDEX);
printf("sequenceNumber[%ld],", ie->sequenceNumber);
printf("timeOfEvent[%s]", ie->timeOfEvent);
printf("\n");
}
}
else if(memcmp(rbuf + HEADERINDEX,"140=",3)==0)
{
struct MarketByLevelEvent *ie=NULL;
ie = MarketByLevelEvent(rbuf + HEADERINDEX);
if(ie != NULL)
{
//printf("%s", rbuf);
printf("SEQ[%07ld],", kk+1);
printf("MessageID[%.3s],", rbuf+HEADERINDEX);
printf("timeOfEvent[%s],",ie->timeOfEvent);
printf("orderBook[%ld],",ie->orderBook);
printf("isBid[%c],",ie->isBid);
printf("price[%ld],",ie->price);
printf("volume[%ld],",ie->volume);
printf("correspondingPrice[%ld]",ie->correspondingPrice);
printf("\n");
}
}
else if(memcmp(rbuf + HEADERINDEX,"51=",3)==0)
{
struct OrderBookStateChangeEvent *ie=NULL;
ie = OrderBookStateChangeEvent(rbuf + HEADERINDEX);
if(ie != NULL)
{
//printf("%s", rbuf);
printf("SEQ[%07ld],", kk+1);
printf("MessageID[%.3s],", rbuf+HEADERINDEX);
printf("timeOfEvent:[%s],", ie->timeOfEvent);
printf("orderBookRuleGroup:[%s]", ie->orderBookRuleGroup);
printf("\n");
}
}
else if(memcmp(rbuf + HEADERINDEX,"49=",3)==0)
{
struct TradeEvent *ie=NULL;
ie = TradeEvent(rbuf + HEADERINDEX);
if(ie != NULL)
{
//printf("%s", rbuf);
printf("SEQ[%07ld],", kk+1);
printf("MessageID[%.3s],", rbuf+HEADERINDEX);
printf("timeOfTrade[%s],", ie->timeOfTrade);
printf("orderQty[%ld],", ie->orderQty);
printf("price[%ld],", ie->price);
printf("highPrice[%ld],", ie->highPrice);
printf("lowPrice[%ld],", ie->lowPrice);
printf("totalTurnover[%ld],", ie->totalTurnover);
printf("correspondingPrice[%ld],", ie->correspondingPrice);
printf("tradeId[%s],", ie->tradeId);
printf("dealId[%s]", ie->dealId);
printf("\n");
}
}
else if(memcmp(rbuf + HEADERINDEX,"62=",3)==0)
{
struct AuctionEvent *ie=NULL;
ie = AuctionEvent(rbuf + HEADERINDEX);
if(ie != NULL)
{
//printf("%s", rbuf);
printf("SEQ[%07ld],", kk+1);
printf("MessageID[%.3s],", rbuf+HEADERINDEX);
printf("timeOfEvent[%s],",ie->timeOfEvent);
printf("orderBook[%ld],",ie->orderBook);
printf("calculatedAuctionPrice[%ld],",ie->calculatedAuctionPrice);
printf("matchedQuantity[%ld]",ie->matchedQuantity);
printf("\n");
}
}
}
if(fp != NULL) fclose(fp);
return(0);
}
'증권정보 > 태국' 카테고리의 다른 글
[AES] ENCRYPT, DECRYPT - 128Bit (0) | 2019.10.31 |
---|---|
JSON데이타 파싱 샘플 프로그램 - 데이타형식은 제각각임(키포인트) (0) | 2019.10.31 |
정보분배, TagWire를 이용한 출력샘플(구조체정의및 출력) (0) | 2019.10.31 |