I'm parsing CSV file with tick data with the script:
string Format = "f,f,i"; void main() { int N,Row,Record,Records; Records = dataParse(1,Format,FileName); // read BBO data
printf("n%d rows read",Records);
dataNew(2,Records,2); // create T1 dataset
for(Record = 0,Row = 0; Record < Records; Record++) { T1* t1 = dataStr(2,Row,0); // store record in T1 format t1->fVal = dataVar(1,Record,2); t1->time = dataVar(1,Record,1)/86400+25569; Row++; } printf(", %d stored",Row); dataAppend(3,2,0,Row); // append dataset if(!wait(0)) return;
dataSave(3,OutName); // store complete dataset }
The result: 8876715 rows read, 887615 stored. I checked with ZHistoryEditor that it is fine. However Zorro prints Error 016: Incosistent start/end dates.
In manual about dataparse:
The CSV file can be in ascending or descending chronological order, but the resulting dataset should be always in descending order, i.e. the newest records are at the begin.
So the right order should be done automaticly. However I see the problem.
Shoud I sort the records before saving to .t1 file?
Last edited by Hlopetz; 07/31/1718:38.
Re: How to parse CSV file with tick data to .t1 correctly?
[Re: Hlopetz]
#467407 08/01/1709:4508/01/1709:45
Dear JCL, one more question. I would like to backtest the strategy on price based bars that is calculted with the function bar() on tick data. I realy need time and volume for each bar. It would be great if it can be calculted in bar() function. Now it is impossible to do as T1 does not contain the volume, but T2 does. Would it be possible to implement using T2 in Zorro or all the above can be done with .t8 files?
Last edited by Hlopetz; 08/01/1713:15.
Re: How to parse CSV file with tick data to .t1 correctly?
[Re: Hlopetz]
#467414 08/01/1714:1308/01/1714:13
Why not, t6 is a file format, it does not restrict time stamps.
Yes, I think so, but I never seen a .t6 with seconds timestamp on the ZHistory editor. And when I try it I got the 057 Error: " T1 data is required for testing with bar periods less than one minute. The test will run with interpolated price data, but won't be very accurate".