通达信数据格式
日K线数据格式
struct TdxRecord { //
日K线数据结构
unsigned int date; // e.g.
20100304
int _open; // *0.01
开盘价
int _high; // *0.01
最高价
int _low; // *0.01
最低价
int _close; // *0.01
收盘价
float amount; // 成交额
int vol; // 成交量(手)
int reserved;
float open(){ return 0.01*_open;
}
float high(){ return 0.01*_high;
}
float low(){ return _low*0.01;
}
float close(){ return _close*0.01;
}
};
日记文件数据格式
struct TdxDiary_Idx {
int id; // 0xffffffff = deleted, auto
incr
char dummy1; // = 0x00
char symbol[7]; // 7 char = 6 char
symbol + 1 char '\0'
int date; // 20110407
int time; // 13:14:25 =
131425
int weather; // 00 =
晴, 01=阴, 02=雨, 03=雪
char title[64]; // title
int offset; // offset in
"symbol.cnt"
int length; // content
length
int date2; // date2 = date
int time2; // time2 = time
void set(const char *symbol, const
char *title, int offset, int length){
memset(this->symbol,
'\0', 7);
memset(this->title,
'\0', 64);
this->dummy1 =
'\0';
this->weather=0x03;
strcpy(this->symbol,
symbol);
strcpy(this->title,
title);
this->offset =
offset;
this->length =
length;
}
void datetime(int date, int
time){
this->date = date;
this->time = time;
this->date2 = date;
this->time2 = time;
}
};
股票代码和名称数据格式
struct TdxSymbolMap {
char symbol[6]; // 6
digits
char dummy1[18]
char name[8]; // 4 characters in
GB2312
char dummy2[218];
}
void tdx_read_symbols(const char
*file){
FILE
*fp=fopen(file.c_str(),"rb");
fseek(fp, 50, SEEK_SET);
char buf[250];
while(250 ==
fread(buf,1,250,fp)){
std::string
symbol(buf,0,6);
std::string
name(buf+24,8);
}
fclose(fp);
}
本文介绍了通达信中使用的几种关键数据格式,包括日K线数据结构、日记文件数据格式及股票代码与名称的数据格式。通过对这些结构的详细解析,帮助读者理解通达信平台如何组织和存储市场数据。
3627

被折叠的 条评论
为什么被折叠?



