Gamestudio Links
Zorro Links
Newest Posts
What are you working on?
by Ayumi
8 minutes 11 seconds ago
Performance report on the imported trades
by OptimusPrime
15 minutes 30 seconds ago
Possible to return character vector from R bridge?
by JamesHH
Today at 18:59
Help with Wine on Linux
by AndrewAMD
Today at 16:59
Stock Splits
by AndrewAMD
Today at 16:23
Linux - Help with setting up with Wine and Zorro
by michaelj
Today at 04:49
How to expand Zorro to work with other broker ( like Tradovate )
by AndrewAMD
Today at 02:12
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online
12 registered (AndrewAMD, Ayumi, JamesHH, ChrstphFr, michaelj, Akow, jenGs, Bill_Lin_Fang, alibaba, 1 invisible), 165 Guests and 8 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
Bill_Lin_Fang, michaelj, ThePituLegend, kankan, Nofip
18207 Registered Users
Page 2 of 2 < 1 2
Topic Options
Rate This Topic
#476279 - 02/10/19 10:59 Re: file_append, file_appendfront [Re: MatPed]
MatPed Offline
User

Registered: 02/28/15
Posts: 547
Loc: Milano, Italy
Trying to parse a simple csv:

1371,EUR/USD,TRD,79701,-0.055
1371,EUR/USD,TRD,79703,-0.055
1371,EUR/USD,TRD,82601,-0.102
1371,EUR/USD,TRD,86602,1.117
1371,EUR/USD,TRD,86802,1.373

The format I use:
string sFormat = "0,i,sss,sss,i,f";

this is the testing code:
Code:
#define _storedRER "Data\storedRER.csv"
#define _storedTradeSize 50000 //1.000 trades (1.000 char [50])
#define _sTradeSize 50

void storeTrade(){
	int iCounter = 0;
	char sTrade[_sTradeSize];
	string sDel=",", ls;
	string sFormat =  "%i%s%s%s%s%s%i%s%.3f";

	for(closed_trades){
		if (TradeIsPhantom && TradeIsClosed && TradeBarClose == Bar){
			if(TradeIsShort) ls = "S"; else ls = "L";		
			sprintf(sTrade, sFormat, TradeBarClose, sDel, TradeAsset, sDel, TradeAlgo, sDel, TradeID, sDel, TradeProfit );	
			strcat (sTrade, "rn");
			file_appendfront(_storedRER, sTrade, 0); 	
//			printf("n");
//			print(TO_WINDOW ,"n%s", sTrade);
		}
	}
}

void readTrade(){
//	string sFormat = "%i%s%s%s%s%s%i%s%.3f";
	string sFormat = "0,i,sss,sss,i,f";

	int iHandle, iCounter;
	iCounter = dataParse(iHandle, sFormat, _storedRER); //, sFilter
	
	printf("n%i", iCounter);
	dataNew(iHandle,0,0); 
}

void main() {
	set(LOGFILE); 	
	Verbose = 7|DIAG;
	
	readTrade();
}



No info is generated in the log file.
The output is always 0.

2 questions:
- Why no data are parsed?
- If I want to filter the data set only EUR/USD is the filter string ",EUR/USD,,," correct?

Thank you

Top
#476299 - 02/15/19 10:39 Re: file_append, file_appendfront [Re: MatPed]
MatPed Offline
User

Registered: 02/28/15
Posts: 547
Loc: Milano, Italy
Any idea? Thx

Top
#476300 - 02/15/19 10:43 Re: file_append, file_appendfront [Re: MatPed]
jcl Online

Chief Engineer

Registered: 07/22/00
Posts: 26839
Loc: Frankfurt
For debugging your parsing, you can find instructions and advices under "remarks" on the dataParse manual page. Your filter string makes no sense. You can only filter strings that really appear in your csv, like "EUR/USD", but not ",EUR/USD,,,".

Top
#476301 - 02/15/19 11:27 Re: file_append, file_appendfront [Re: jcl]
MatPed Offline
User

Registered: 02/28/15
Posts: 547
Loc: Milano, Italy
I have seen the remarks, but I do not understand it.
With verbose = 7 I have no message in the log list and I have not seen many examples of the filter.
Are the dataparse functions standard C maybe I can use standard documentations? If not maybe some more hints or examples could be useful, not only for me.
Anyway I will keep on trying

Top
#476302 - 02/15/19 13:23 Re: file_append, file_appendfront [Re: MatPed]
jcl Online

Chief Engineer

Registered: 07/22/00
Posts: 26839
Loc: Frankfurt
C has no standard CSV parsing function. I've reworded the format string description - check the online version, maybe it's more clear now. There are many examples. Still, for some reason people have often problems to understand parsing CSV files - you're not the only one. We provide a conversion service if nothing else helps.

Top
#476303 - 02/15/19 14:02 Re: file_append, file_appendfront [Re: jcl]
MatPed Offline
User

Registered: 02/28/15
Posts: 547
Loc: Milano, Italy
Thank you, I will give it a looks. I am not converting I'd like to use it in order to store trade results in order to keep tracks after zorro restarts. I have only to read it, but i do not find the way how to do it...

Top
Page 2 of 2 < 1 2



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

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