日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

通达信V6.1分时数据文件格式分析

發布時間:2024/3/13 编程问答 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 通达信V6.1分时数据文件格式分析 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

通達信V6分時數據文件格式分析

文件位置

/jcb_zxjt/T0002/zst_cache/ sz399005.zst

說明:只有在瀏覽歷史分時圖時才生成相應文件。

?

/jcb_zxjt/T0002/hq_cache/sh.tfz

/jcb_zxjt/T0002/hq_cache/sz.tfz

說明:通達信當日分時數據, 包括所有瀏覽過的股票

?

?

數據格式

1、歷史分時數據格式

1)、日期信息格式

數據含義

數據類型

日期

Integer

昨日收盤價

single

2)、分時數據格式

數據含義

數據類型

備注

時間

word

570/60=9.5,即9:30

現價

single

?

均價

single

?

成交量

Integer

?

預留

?

12個字節

注意:

1)、每6508個字節為一天的數據。(6508 – 8 / 26 = 250

2)、每26個字節為一個分鐘的記錄。

?

2、當日分時數據格式

1)、索引數據格式

數據含義

數據類型

備注

存儲標記

Byte

表示在指定地址是否有數據

起始地址

Integer

股票分時數據塊起始地址

注意:

1)、索引個數與“/jcb_zxjt/T0002/hq_cache/ shex.tnf”或“/jcb_zxjt/T0002/hq_cache/ szex.tnf”中的股票個數相同。

?

2)、分時數據格式

數據含義

數據類型

備注

時間

word

570/60=9.5,即9:30

現價

single

?

均價

single

?

成交量

Integer

?

預留

?

12個字節

注意:

1)、每6240個字節為一天的數據。6240 / 26 = 240

2)、每26個字節為一個分鐘的記錄。

?

?

示例代碼

示例:顯示分時數據文件信息

單元:uDataBuffer

備注:uDataBuffer單元代碼在“大智慧Level2日線數據文件格式分析”文檔中。

?

?

單元:uZstData

unit uZstData;

?

interface

?

uses

??? uDataBuffer;

?

type

??? TDataRecord_min = packed record

??????? time: word; //--時間

??????? cur: single; //--現價

??????? avg: single; //--均價

??????? vol: Integer; //--成交量

??????? reservation: array[0..2] of Integer; //--保留

??? end;

?

??? TDataRecord_Zst = packed record

??????? date: Integer; //--日期

??????? Last: single; //--昨收盤

??????? min: array[0..249] of TDataRecord_min;

??? end;

??? PDataRecord_Zst = ^TDataRecord_Zst;

?

??? {歷史分時數據}

??? TStockDataStream_Zst = class(TRecordStream)

??? private

??????? function GetItems(Index: Integer): PDataRecord_Zst;

??? public

??????? constructor Create;

??????? //---

??????? property Items[Index: Integer]: PDataRecord_Zst read GetItems; default;

??? end;

?

implementation

?

constructor TStockDataStream_Zst.Create;

begin

??? inherited;

??? //---

??? DataSize := sizeof(TDataRecord_Zst);

end;

?

function TStockDataStream_Zst.GetItems(Index: Integer): PDataRecord_Zst;

begin

??? Result := self.Datas[Index];

end;

?

end.

?

單元:uTfzData

unit uTfzData;

?

interface

?

uses

??? uDataBuffer;

?

type

??? TIndexRecord_Tfz = packed record

??????? UseSign: byte; //--數據標記

??????? StartAddress: Longword; //--起始地址

??? end;

??? PIndexRecord_Tfz = ^TIndexRecord_Tfz;

?

??? TDataRecord_min_Tfz = packed record

??????? time: word; //--時間

??????? cur: single; //--現價

??????? avg: single; //--均價

??????? vol: Integer; //--成交量

??????? reservation: array[0..2] of Integer; //--保留

??? end;

?

??? TDataRecord_Tfz = packed record

??????? min: array[0..239] of TDataRecord_min_Tfz;

??? end;

??? PDataRecord_Tfz = ^TDataRecord_Tfz;

?

??? {當日分時數據}

??? TStockDataStream_Tfz = class(TCustomStringBuffer)

??? private

??????? FIndexCount: Integer;

??????? FIndexSize: Integer;

??????? FDataCount: word;

??????? FDataSize: Integer;

??????? function GetDatas(Index: Integer): PDataRecord_Tfz;

??????? function GetIndexs(Index: Integer): PIndexRecord_Tfz;

??? protected

??????? procedure ClearBuffer; override;

??????? procedure DoBufferChange; override;

??? public

??????? constructor Create;

??????? //---

??????? function GetDataStartAddress(const AIndex: Integer): Longword;

??????? //---

??????? property Datas[Index: Integer]: PDataRecord_Tfz read GetDatas;

??????? property DataCount: word read FDataCount;

??????? property Indexs[Index: Integer]: PIndexRecord_Tfz read GetIndexs;

??????? property IndexCount: Integer read FIndexCount;

??? end;

?

implementation

?

constructor TStockDataStream_Tfz.Create;

begin

??? inherited;

??? //---

??? FIndexSize := sizeof(TIndexRecord_Tfz);

??? FDataSize := sizeof(TDataRecord_Tfz);

end;

?

procedure TStockDataStream_Tfz.ClearBuffer;

begin

??? inherited;

??? //---

??? FIndexCount := 0;

??? FDataCount := 0;

end;

?

procedure TStockDataStream_Tfz.DoBufferChange;

const

??? CNT_MinStockCount = 1500;

??? //---

?? ?function _ReadIndex: Boolean;

??? var

??????? AIndexLen: integer;

??? begin

??????? AIndexLen := (self.BufferSize - FDataSize * FDataCount);

??????? FIndexCount := AIndexLen div FIndexSize;

??????? //---

??????? Result := (AIndexLen mod FIndexSize) = 0;

??? end;

??? //---

??? function _ReadData: Boolean;

??? begin

??????? FDataCount := (self.BufferSize - FIndexSize * CNT_MinStockCount) div FDataSize;

??????? Result := FDataCount > 0;

??? end;

begin

??? inherited;

??? //---

??? if FDataSize <= 0 then

????? ??self.ClearBuffer

??? else

??? begin

??????? if not (_ReadData and _ReadIndex) then

??????????? self.ClearBuffer;

??? end;

end;

?

function TStockDataStream_Tfz.GetDatas(Index: Integer): PDataRecord_Tfz;

begin

??? Result := Pointer(self.Buffer + FIndexSize * FIndexCount + FDataSize * Index);

end;

?

function TStockDataStream_Tfz.GetIndexs(Index: Integer): PIndexRecord_Tfz;

begin

??? Result := Pointer(self.Buffer + FIndexSize * Index);

end;

?

function TStockDataStream_Tfz.GetDataStartAddress(const AIndex: Integer):

??? Longword;

begin

??? Result := FIndexSize * FIndexCount + FDataSize * AIndex;

end;

?

end.

?

?

單元:Unit1

unit Unit1;

?

interface

?

uses

??? Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,

??? Dialogs,StdCtrls,ExtCtrls;

?

type

??? TForm1 = class(TForm)

??????? Button1: TButton;

??????? ListBox1: TListBox;

??????? GroupBox1: TGroupBox;

??????? OpenDialog1: TOpenDialog;

??????? RadioGroup1: TRadioGroup;

??????? Panel1: TPanel;

??????? procedure FormCreate(Sender: TObject);

??????? procedure Button1Click(Sender: TObject);

??? private

??????? procedure ShowData_Zst(const AFile: string; const AListBox: TListBox);

??????? procedure ShowData_Tfz(const AFile: string; const AListBox: TListBox);

??? public

??????? procedure ShowData(const AFile: string; const AListBox: TListBox);

??? end;

?

var

??? Form1: TForm1;

?

implementation

?

uses uZstData,uTfzData;

?

{$R *.dfm}

?

procedure TForm1.FormCreate(Sender: TObject);

begin

??? with RadioGroup1.Items do

??? begin

??????? clear;

??????? Add('臨時分時數據');

??????? Add('當日分時數據');

??? end;

??? RadioGroup1.ItemIndex := 0;

??? //---

??? SendMessage(ListBox1.Handle,LB_SetHorizontalExtent,2000,longint(0));

end;

?

procedure TForm1.Button1Click(Sender: TObject);

begin

??? with self.OpenDialog1 do

??? begin

??????? if Execute then

??????????? self.ShowData(FileName,ListBox1);

??? end;

end;

?

procedure TForm1.ShowData(const AFile: string; const AListBox: TListBox);

begin

??? case RadioGroup1.ItemIndex of

??????? 0: ShowData_Zst(AFile,AListBox);

??????? 1: ShowData_Tfz(AFile,AListBox);

??? end;

end;

?

?

procedure TForm1.ShowData_Zst(const AFile: string;

??? const AListBox: TListBox);

var

??? AStream: TStockDataStream_Zst;

??? ADayIndex,AMinIndex: Integer;

begin

??? AStream := TStockDataStream_Zst.Create;

??? try

??????? with AListBox.Items do

??????? begin

??????????? BeginUpdate;

??????????? Clear;

??????????? with AStream do

??????????? begin

??????????????? if ReadFile(AFile) then

??????????????? begin

??????????????????? for ADayIndex := 0 to Count - 1 do

??????????????????? begin

??????????????????????? with items[ADayIndex]^ do

??????????????????????? begin

??????????????????????????? Add(Format('%.3d %d %.2f', [ADayIndex,date,Last]));

??????????????????????????? for AMinIndex := Low(min) to high(min) do

??????????????????????????? begin

??????????????????????????????? with min[AMinIndex] do

??????????????????????????????????? Add(Format('%.3d %.2d:%.2d %.2f %.2f %d 保留%d %d %d', [AMinIndex,time div 60,time mod 60,

??????????????????????????????????????? cur,avg,vol,

??????????????????????????????????????????? reservation[0],reservation[1],reservation[2]]));

??????????????????????????? end;

???????????? ???????????end;

??????????????????? end;

??????????????? end;

??????????? end;

??????????? EndUpdate;

??????? end;

??? finally

??????? AStream.Free;

??? end;

end;

?

procedure TForm1.ShowData_Tfz(const AFile: string;

??? const AListBox: TListBox);

var

??? AStream: TStockDataStream_Tfz;

??? //---

??? procedure _ShowIndex;

??? var

??????? AIndex: Integer;

??? begin

??????? with AListBox.Items,AStream do

??????? begin

??????????? Add('--------索引---------');

??????????? //---

??????????? for AIndex := 0 to IndexCount - 1 do

??????????? begin

??????????????? with Indexs[AIndex]^ do

??????????????????? Add(Format('%.4d 數據標記:%d 起始地址:%.6x', [AIndex + 1,UseSign,StartAddress]));

??????????? end;

??????? end;

??? end;

??? //---

??? procedure _ShowData;

??? var

??????? ADataIndex,AMinIndex,AStartAddress: Integer;

??????? //---

??????? function _FindIndex(AStartAddress: Integer): integer;

??????? var

??????????? AIndex: integer;

??????? begin

??????????? with AStream do

??????????? begin

??????????????? for AIndex := 0 to IndexCount - 1 do

??????????????? begin

??????????????????? with Indexs[AIndex]^ do

??????????????????????? if (UseSign = 1) and (StartAddress = AStartAddress) then

??????????????????????? begin

??????????????????????????? Result := AIndex;

??????????????? ????????????exit;

??????????????????????? end;

??????????????? end;

??????????? end;

??????????? //---

??????????? Result := 0;

??????? end;

??? begin

??????? with AListBox.Items,AStream do

??????? begin

??????????? Add('--------數據---------');

??????????? for ADataIndex := 0 to DataCount - 1 do

??????????? begin

??????????????? Add(' ');

??????????????? //---

??????????????? AStartAddress := GetDataStartAddress(ADataIndex);

??????????????? Add(Format('%.3d 索引:%.3d 地址:%.6x', [ADataIndex + 1,_FindIndex(AStartAddress) + 1,AStartAddress]));

??????????????? //---

??????????????? with Datas[ADataIndex]^ do

??????????????? begin

??????????????????? for AMinIndex := Low(min) to high(min) do

??????????????????? begin

??????????????????????? with min[AMinIndex] do

?? ?????????????????????????Add(Format('%.3d %.2d:%.2d %.2f %.2f %d 保留%d %d %d', [AMinIndex + 1,

??????????????????????????????? time div 60,time mod 60,

??????????????????????????????????? cur,avg,vol,

??????????????????????????????????? reservation[0],reservation[1],reservation[2]]));

??????????????????? end;

??????????????? end;

??????????? end;

??????? end;

??? end;

begin

??? AStream := TStockDataStream_Tfz.Create;

??? try

??????? with AListBox.Items do

??????? begin

??????????? BeginUpdate;

?????????? ?Clear;

??????????? with AStream do

??????????? begin

??????????????? if ReadFile(AFile) then

??????????????? begin

??????????????????? _ShowIndex;

??????????????????? _ShowData;

??????????????? end;

??????????? end;

??????????? EndUpdate;

??????? end;

?? ?finally

??????? AStream.Free;

??? end;

end;

?

end.

?

總結

以上是生活随笔為你收集整理的通达信V6.1分时数据文件格式分析的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 一区二区日韩 | av不卡一区二区 | 日本精品一二三区 | 激情综合五月婷婷 | 色婷婷国产精品视频 | av影片在线观看 | 日韩欧美成人一区二区 | 色综合久久88 | 国产亚洲精品久久久久久青梅 | 欧美精品一区二区不卡 | 黑人巨大精品欧美一区二区免费 | 日韩精品一区二区三区丰满 | 99久久一区二区 | 日韩第1页 | 美国一区二区 | 日本一区二区不卡视频 | 国产精品白丝喷水在线观看 | 欧美一卡二卡三卡四卡 | 午夜影视体验区 | 天堂网在线看 | 天天草天天摸 | 激情综合文学 | 亚洲人女屁股眼交6 | 无码人妻丰满熟妇区毛片蜜桃精品 | 色乱码一区二区三区熟女 | 91在线观看成人 | 国产呦小j女精品视频 | 日产欧产va高清 | 自拍第1页| 欧美在线一区二区视频 | 自偷自拍av| 成人精品二区 | 天堂在线免费观看视频 | 蜜桃久久一区二区三区 | 欧美日韩国产综合在线 | 日韩福利片在线观看 | 韩国日本中文字幕 | a一级黄色 | 亚洲激情一区二区三区 | 欧美性生活一级 | 玖玖玖视频 | 久久丝袜视频 | 黑色丝袜吻戏亲胸摸腿 | 日韩一区二区影院 | 国产麻豆电影在线观看 | 成人在线视频网址 | 1级黄色大片儿 | 亚洲黄色精品 | 东京干手机福利视频 | 在线亚洲人成电影网站色www | 麻豆视频在线观看免费 | 手机看片日韩国产 | 99热热 | 亚洲免费在线观看视频 | 午夜视频在线播放 | 国产主播第一页 | 四虎影视精品 | 成人免费看高清电影在线观看 | 五月天激情综合网 | 四虎黄色网址 | 九七在线视频 | 精品少妇人妻一区二区黑料社区 | 亚洲成人国产 | 成人试看120秒体验区 | 亚洲综合色自拍一区 | 久久亚洲一区二区三区四区五区 | 韩国一区视频 | 成人性做爰aaa片免费 | 精品亚洲国产成av人片传媒 | 女futa攻玩遍整个后宫 | 激情视频网站 | 抽插丰满内射高潮视频 | 日本伊人久久 | 成人毛毛片 | 亚洲精品国产美女 | 国产福利在线视频 | 亚洲日日干 | 99re6在线精品视频免费播放 | 日韩视频精品 | 国产精品自拍视频 | 在线观看免费视频黄 | 欧美丰满bbw| 理论片亚洲| 国产a一级 | 麻豆免费在线观看 | 中文日韩字幕 | av色欲无码人妻中文字幕 | 午夜精品导航 | 成人欧美一区二区三区黑人动态图 | 国产一区二区三区免费观看视频 | 寡妇高潮一级视频免费看 | 久久久久久国产精品免费播放 | 亚洲Av无码成人精品区伊人 | 午夜爱爱影院 | 97在线免费观看视频 | 国产精品久久久久久久久免费桃花 | 国产视频1区2区 | 玉足女爽爽91 | 日本黄色性视频 |