Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Imhotep, opm), 785 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Zorro Start Time and PRELOAD #484463
10/27/21 10:46
10/27/21 10:46
Joined: Oct 2020
Posts: 9
R
ruins Offline OP
Newbie
ruins  Offline OP
Newbie
R

Joined: Oct 2020
Posts: 9
Hi,

I am trying to speed up the start time on a Zorro script connected to IB Gateway in Trade mode. I have used the PRELOAD flag and have preloaded the data into T6 files in the history folder. The data looks up to date and running "assetHistory" against each Asset, Zorro reports "up to date" in the log.

However, even though the data is up to date and the PRELOAD flag is set, for each Asset, Zorro still appears to take about 10 seconds to check History is up to date, and 20 seconds to "read" each asset. As History is up to date, I can see from the IB Gateway API logs that Zorro does not attempt to contact the IB Data History farm servers so these times seem to be all Zorro processing.

Is this normal and can it be made to run faster ?

This is what is shown in the log:
################################## LOG ############################################
Code
Login 0 IB..
!Open IB Socket 2.04
!Account ----- at UTC 10-27 10:00
---------------------------------- INITRUN --------------------
--------------------this section takes 10 seconds per asset

Load C:\Zorro\History\ZorroPyAssetList-2x-a.csv

!PNR-STK-SMART-USD: 76.16000 3.36000 1
PNR history up to date
PNR History collected - 0 Bars 
!AMZN-STK-SMART-USD: 3373.00000 19.71000 1
AMZN history up to date
AMZN History collected - 0 Bars 
NFLX history up to date
NFLX History collected - 0 Bars 

---------------------------------- TRADE ------------------------
--------------------this section takes 20 seconds per asset

TCO: 4 MB allocated.   
PNR 993 ticks read
69(617) bars 2021-07-22..2021-10-27 generated
PNR: 0..616
 PNR Open:69.35 High:69.81 Low:68.48 Close:68.58 2021/07/22 UTC 15:40 EST 10:40
TCO: 4 MB allocated.
AMZN 993 ticks read
AMZN: 0..616
 AMZN Open:3576.00 High:3586.45 Low:3544.50 Close:3586.35 2021/07/22 UTC 15:40 EST 10:40
TCO: 4 MB allocated.
NFLX 993 ticks read
NFLX: 0..616
 NFLX Open:526.33 High:530.99 Low:505.81 Close:513.88 2021/07/22 UTC 15:40 EST 10:40

---------------------------------- END RUN FUNCTION ------------------------

################################### SCRIPT ###########################################
Here is the script I am using to test with:
Code
#define ACCT_CCY "USD"
#define DENOM_CCY "USD"
#define ASSET_LIST "C:\\Zorro\\History\\ZorroPyAssetList-2x-a.csv" 

function run()
{
	BarZone = UTC;
	BarPeriod = 1440; //minutes //1440 = 1 Day
	Verbose = 7; // "7" - Verbose logging ON
	LookBack =55;//15 for EMA + 40 for unstable period
		
	StartDate = 2018; // format examples (dont need to quote): 2019 20190101 20190125
	EndDate   = 2021;
	
	if(is(INITRUN))
	{
		set(PRELOAD); 
		
		printf("\n---------------------------------- INITRUN --------------------\n");
		//########################  SET AssetList
		string AssetListFilename = "C:\\Zorro\\History\\ZorroPyAssetList-2x-a.csv"; 
		int MyAssets = assetList(AssetListFilename,0); 
		
		//########################  Check if Asset History is up to date
		for(listed_assets)
		{
			// "3" is EOD data. Returns 0 if history is up to date or there was an error
			int AssetHistoryReturnVal = assetHistory(Asset,3); 

			printf("%s History collected - %i Bars \n", Asset, AssetHistoryReturnVal);
		}
	}


	printf("---------------------------------- TRADE ------------------------\n");
	while(asset(loop(Assets)))
	{
		printf("\n %s Open:%.2f High:%.2f Low:%.2f Close:%.2f %04i/%02i/%02i UTC %02i:%02i EST %02i:%02i",
		Asset,priceOpen(),priceHigh(),priceLow(),priceClose(),year(),month(),day(),hour(),minute(),(hour()-5),minute());
	}
	
	printf("---------------------------------- END RUN FUNCTION ------------------------\n");
}

Last edited by ruins; 10/28/21 07:52. Reason: cosmetic
Re: Zorro Start Time and PRELOAD [Re: ruins] #484471
10/28/21 09:09
10/28/21 09:09
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
I think it depends on the broker. The first price request and subscribing an asset at the session start is often slow, subsequent prices come faster.

Re: Zorro Start Time and PRELOAD [Re: Petra] #484475
10/28/21 14:44
10/28/21 14:44
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
Quote
I can see from the IB Gateway API logs that Zorro does not attempt to contact the IB Data History farm servers so these times seem to be all Zorro processing

Re: Zorro Start Time and PRELOAD [Re: ruins] #484517
11/06/21 11:46
11/06/21 11:46
Joined: Oct 2020
Posts: 9
R
ruins Offline OP
Newbie
ruins  Offline OP
Newbie
R

Joined: Oct 2020
Posts: 9
I have found the following:
- splitting assets across multiple Zorro instances with NOLOCK flag set within the script improves overall load speed
- actually starting to TRADE the script when the market is actually open in IB (rather than starting to TRADE before the opening) significantly improves start time

So it would appear not to be Zorro processing that is causing the slow start, instead it is something within the IB platform.

Re: Zorro Start Time and PRELOAD [Re: ruins] #484522
11/07/21 10:23
11/07/21 10:23
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
It happens also with other brokers but normally not as bad as with IB.

AFAIK It does not happen with brokers that have a REST API.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1