Push-based broker plugins

Posted By: Veratyr

Push-based broker plugins - 05/03/18 08:50

I've been testing the multi-broker beta with recording tick data for a few brokers and assets and I've found that Zorro frequently can't keep up with all the data.

My guess is that this is because Zorro is polling every broker for every asset.

At the moment my only option seems to be decreasing tick resolution (and hence increasing latency).

I think it'd be better if instead of polling for prices, broker plugins could push them. An API something like BrokerAsset(char* asset, FARPROC fpAsset) that the plugin can call when it gets a price update.
Posted By: Zheka

Re: Push-based broker plugins - 05/03/18 13:28

http://zorro-project.com/manual/en/ticktime.htm

AFAIK, the default Zorro price update request interval is 100ms.
Set TickTime to 10-20 to get nearly all the ticks.

Setting TickTime=1 will most probably bear significant overhead and will indeed slow things up.

Posted By: Veratyr

Re: Push-based broker plugins - 05/04/18 22:24

Yeah, I'm aware. The problem is that polling starts to choke pretty quickly when you've got a few brokers and when you're looking at arbitrage, a delay of 10ms is huge.

I suspect most of my problem is caused by the MT4 broker plugin itself though. I'm trying to write a FIX plugin to get around that. It should bring the BrokerAsset call down to no more time than copying a double from RAM.
Posted By: Zheka

Re: Push-based broker plugins - 05/05/18 15:09


1) I might be wrong, but looking through the MT4 mql file . From what I can tell, it should actually trigger on any tick, OR on a timer (which you can change in the header). It might be that TickTime has nearly no influence on an MT4 plugin...but I might be wrong.

2) Even if it does, it's not really a 10ms delay. 10ms rather a max delay.

3) You can run a Zorro instance per broker connection to split the load (so that each Zorro occupies one CPU core) and exchange data via a global variable (https://fx1.net/sharedvar.php or implement this yourself).

4) I think the whole exercise is futile: theoretical arbitrage opportunities might exist if you trade vs. an pure MM MT4 server, but most serious brokers are STP and use more or less the same LPs. You might indeed observe a worthy price difference in MT4 but you will not be able to get filled at such prices.
MT4 introduces a significant overhead, getting to FIX makes you compete with FPGAs.
Posted By: Veratyr

Re: Push-based broker plugins - 05/05/18 18:09

1) I did a pretty basic test and whatever's going on, it's not good enough. I sat Zorro next to MT4 and just watched the quotes. Zorro at times sat still for several hundred milliseconds while I watched MT4 tick over repeatedly.

2) No, it's a minimum delay. Per http://zorro-trader.com/manual/en/tick.htm:

Quote:
The minimum time between two tick calls can be set up with TickTime. If a new quote arrives earlier, it is delayed until the TickTime is over.


3) Sure but if I'm writing extensive logic outside Zorro, there's little point using Zorro. Broker arbitrage doesn't require a whole lot of complex logic.

4) Theoretically, if a broker is STP and using the same LPs, yes, this is true. However I think brokers do a lot of order matching between their own clients, so it's not entirely STP.

I've already been recording FIX data across a few brokers and there are definitely opportunities there. These brokers are too small for the folks with serious resources like FPGAs and ASICs to deal with.
Posted By: AndrewAMD

Re: Push-based broker plugins - 07/02/18 14:40

It seems Zorro can now receive every tick - as long as it's supported by the respective broker plugin.

Here is the new Zorro Broker API feature, now in beta:

Quote:
For asynchronously triggering a price quote request, send a WM_APP+1 message to the window handle received by the SET_HWND command. For triggering the callback function, send a WM_APP+2 message. This can be used for prices streamed by another thread. An example for sending messages can be found under HWnd.
Further reading:
http://zorro-project.com/manual/en/hwnd.htm
http://zorro-project.com/manual/en/brokerplugin.htm
http://zorro-project.com/manual/en/brokercommand.htm
http://zorro-project.com/manual/en/tick.htm
https://msdn.microsoft.com/en-us/library/windows/desktop/ms644944(v=vs.85).aspx
© 2024 lite-C Forums