The big Smart Data Structure found on the internet is as follows:
Big Smart Data File and data structure: (assume that the big smart stock market software is installed in the D: gpdzh directory)
Shanghai Daily storage path: D: gpdzhDATASHaseDay, File Extension:. day
Shanghai Weekly online storage path: D: gpdzhDATASHaseweek, File Extension:. wek
The storage path of the monthly subscription in Shanghai is D: gpdzhDATASHasemonth, and the file extension is. mnt.
The storage path of the Shenzhen daily route is D: gpdzhDATASZnseDay.
The storage path of the Shenzhen weekly route is D: gpdzhDATASZnseweek.
The storage path of the month line in Shenzhen is: D: gpdzhDATASZnsemonth.
Week line. The format of the month line is the same as that of the day line.
The length of each record is 40 bytes:
1-4 bytes are the date, and the format is converted to decimal: 19910102
5-8 bytes = open bandwidth (RMB) * 1000
9-12 bytes = maximum price (RMB) * 1000
13-16 bytes = lowest price (yuan) * 1000
17-20 bytes = closing price (RMB) * 1000
21-24 bytes = Transaction amount (RMB)/1000
25-28 bytes = Transaction volume (hand)
The remaining 12 bytes are not used
I wrote a small C-language program for everyone and hoped it would be useful.
Steps:
Defines the data structure of a stock price gpjg
Use fread function to read files
Use the fprintf function to write files
The final result of the program execution is to convert the binary file into a comma separated character file, which is suffixed with .csv and can be opened in excel or processed subsequently.
The procedure is as follows:
# Include <stdio. h>
# Include <stdlib. h>
Struct gpjg
{
Unsigned long int rq;
Unsigned long int kp;
Unsigned long int zg;
Unsigned long int zd;
Unsigned long int sp;
Unsigned long int cjje;
Unsigned long int cjl;
Unsigned long int l1;
Unsigned long int l2;
Unsigned long int l3;
} Gpjg1;
Main ()
{FILE * fp;
FILE * fp1;
Int I;
If (fp = fopen ("D: \ gp \ dzh \ DATA \ SZnse \ Day \ 184721.day"," rb ") = NULL)
{Printf ("cannot open file ");
Return;
}
If (fp1 = fopen ("184721.csv"," w ") = NULL)
{Printf ("cannot open file ");
Return;
}
For (I = 0; I <10000; I ++ ){
Fread (& gpjg1, sizeof (struct gpjg), 1, fp );
If feof (fp) {return ;}
Printf ("% lu, % lu", gpjg1.rq, gpjg1.kp, gpjg1.zg, gpjg1.zd, gpjg1.sp, fingerprint, gpjg1.cjl );
Fprintf (fp1, "% lu, % lu", gpjg1.rq, gpjg1.kp, gpjg1.zg, gpjg1.zd, gpjg1.sp, quit, gpjg1.cjl );
}
}