码迷,mamicode.com
首页 > Windows程序 > 详细

c#读取通达信历史数据的方法

时间:2015-06-07 09:30:05      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:

public Bar ReadBarMin(BinaryReader br, int instrumentId, long size)
{

int date = br.ReadUInt16();
int min = br.ReadUInt16();
// 股票2位,国债回购3位,300ETF是4位
double open = Convert.ToDouble(Convert.ToDecimal(br.ReadSingle()));
double high = Convert.ToDouble(Convert.ToDecimal(br.ReadSingle()));
double low = Convert.ToDouble(Convert.ToDecimal(br.ReadSingle()));
double close = Convert.ToDouble(Convert.ToDecimal(br.ReadSingle()));
double amount = Convert.ToDouble(Convert.ToDecimal(br.ReadSingle())); // 成交额不保存
int vol = br.ReadInt32();
int reserve = br.ReadInt32(); // 保留字

int year = date / 2048 + 2004;
int month = date % 2048 / 100;
int day = date % 2048 % 100;

int HH = min / 60;
int mm = min % 60;
if ((HH == 9) && (mm == 1 || mm == 5))
{
dayM = day;
momM = month;

}
if((HH>20)&&(HH<24))
{
day=dayM;
month = momM;
}

DateTime closeDataTime = new DateTime(year, month, day, HH, mm, 0);
DateTime openDateTime = closeDataTime.AddSeconds(-size);

 

c#读取通达信历史数据的方法

标签:

原文地址:http://www.cnblogs.com/openquant/p/4557674.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!