Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (degenerate_762), 639 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Data from CSV not parsed correctly #488197
04/18/24 10:45
04/18/24 10:45
Joined: Apr 2024
Posts: 6
Germany
E
EternallyCurious Offline OP
Newbie
EternallyCurious  Offline OP
Newbie
E

Joined: Apr 2024
Posts: 6
Germany
Hello everybody,


I am having trouble to convert a CSV file to a .t1 file. When I print the parsed values, none of the columns is being correctly parsed and I don't receive any warning or error message.

The CSV file has following format:

Code
Time,AskPrice,BidPrice
1704213005783,49.20,49.10
1704213006179,49.22,49.13
1704213006575,49.23,49.13
1704213007576,49.24,49.13


I use following lines to parse the file:

Code
string Format = "+%t,f,f";

int Year;
for(Year = 2024; Year <= 2024; Year++) {
	dataNew(1,0,0);
	int records = dataParse(1,Format,strf(CSVFileName,Year), 0, 0);
	printf("\n%i - %d rows read",Year,records);

	dataNew(2,0,0);
	int i, N = 0;

	for(i = 0; i < records; i++) 
	{
		var time = dataVar(1,i,0);
		var askPrice = dataVar(1,i,1);
		var bidPrice = dataVar(1,i,2);
		printf("%s: %.2f, %.2f\n", strdate("%Y.%m.%d %H:%M:%S.", time), bidPrice, askPrice);
		
		T1* Quote = dataAppendRow(2,2);
		Quote->time = time;
		Quote->fVal = -bidPrice;
		Quote = dataAppendRow(2,2);
		Quote->time = time;
		Quote->fVal = askPrice;
		N += 2;
	}

	dataSave(2,strf(OutName,Year), 0, N); // store year dataset
	printf("\n%s saved",strf(OutName,Year));
}



Can somebody help me to find the problem?

I attached a sample CSV file and the complete code.


Best regards,

EC

Attached Files
TQQQ_2024.csv (2 downloads)
_EC_CSVToTicks2.c (2 downloads)
Last edited by EternallyCurious; 04/19/24 06:41.
Re: Data from CSV not parsed correctly [Re: EternallyCurious] #488201
04/20/24 08:32
04/20/24 08:32
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
The time conversion does not look right.

Re: Data from CSV not parsed correctly [Re: EternallyCurious] #488207
04/20/24 21:39
04/20/24 21:39
Joined: Apr 2024
Posts: 6
Germany
E
EternallyCurious Offline OP
Newbie
EternallyCurious  Offline OP
Newbie
E

Joined: Apr 2024
Posts: 6
Germany
What exactly do you think it does not look well with the time?

I use %t because the first column has Unix format in milliseconds. It is described in the "Dataset handling" section of the Zorro documentation.

Code
%t - for a date/time field in Unix format, either seconds or milliseconds since January 1,1970.

Re: Data from CSV not parsed correctly [Re: EternallyCurious] #488215
04/25/24 10:20
04/25/24 10:20
Joined: Apr 2024
Posts: 6
Germany
E
EternallyCurious Offline OP
Newbie
EternallyCurious  Offline OP
Newbie
E

Joined: Apr 2024
Posts: 6
Germany
I attached the text from the output window.

Attached Files
Log.png (9 downloads)
Re: Data from CSV not parsed correctly [Re: EternallyCurious] #488224
04/26/24 11:18
04/26/24 11:18
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
The time and all other variables are zero. So the first step is debugging the conversion and checking the content of the dataset. Debugging is explained in the manual under "troubleshooting".

If you still cannot find the reason and want individual support, you could either subscribe a premium support ticket, or simply hire a programmer to write the conversion script for you. The current fee for a CSV -> t1 conversion, as to my knowledge, is 120 EUR.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1