Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 600 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
First-class support of Orders, keep separate from Trades #486282
07/12/22 20:44
07/12/22 20:44
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
A trading system should have first-class support for placing orders via broker API. With Zorro, orders are second-class to trades in Zorro. This is a major flaw. Most brokers supported by Zorro are nicknamed "NFA brokers", but this really means they take orders and not trades.

I have a three-part proposal. First is the broker plugin API itself:

1) Revamp the Broker API for emphasis on order control. At minimum, a dedicated function for new orders, another to cancel/replace orders, and another for execution reports. Keep it completely separate from "Trade" management.

2) On Live instance launch, Zorro will check the status of all open orders on the API and add them to the list of open orders.

3) Zorro will track order status from birth to death. That is, Zorro will never assume that an order is dead unless it confirms it is in fact dead via execution report. Even if Zorro issues an order cancellation, Zorro should not assume it is cancelled until the order is confirmed dead.

4) The broker plugin can push execution reports to Zorro.

Here's an example execution report from the FIX protocol:
https://www.onixs.biz/fix-dictionary/4.4/msgType_8_8.html

Second, orders should be clearly distinct from ordinary zorro Trades, which have fundamentally different meanings. If necessary, make an ORDER struct. Or at minimum, give TRADE structs an Order flag.

Third would be a new hedge mode (7?) that allows order placement to yield Zorro trades for accounting purposes only. You can call it "reverse pool trades". Example:
Script directly places order: BUY 10 MSFT. Zorro internally opens a long trade for 10. The execution reports will update the fill information.
Script directly places order: SELL 20 MSFT. Zorro internally closes the long trade and opens a new short trade for 10. The execution reports will update the fill information for both the long and short trades on a FIFO basis.

Re: First-class support of Orders, keep separate from Trades [Re: AndrewAMD] #486285
07/13/22 08:27
07/13/22 08:27
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Zorro supports orders, but you're right, the emphasis is on trades. There are indeed some functions missing for full order control.

The BrokerBuy, BrokerSell, and BrokerTrade functions can in fact control orders. Zorro switches between orders and trades by the TR_GTC flag. The TRADE struct is for both, the order size is stored in TradeLotsTarget.

We'll implement a clearer distinction and will go through your suggestions and add functions for better controlling orders.







Re: First-class support of Orders, keep separate from Trades [Re: AndrewAMD] #486295
07/14/22 21:04
07/14/22 21:04
Joined: Aug 2021
Posts: 101
M
MegaTanker Offline
Member
MegaTanker  Offline
Member
M

Joined: Aug 2021
Posts: 101
Just throwing my support for this in the mix, which should be obvious based on my recent activity grin

I don't know how "deep" of an overhaul is planned, but the existence of crypto exchanges with their 0% maker fees (or even credit) make light market making realistic even for retailers. Being able to directly control orders is essential for that, as well as instant and consistent feedback to Zorro from the plugin about fills, so that the script can determine easily how many lots are open at any given time to compare that to how many *should* be open, to then manage the orders accordingly.

I've had some success trying a very "hacky" approach in the broker plugin that ended up placing 74 trades/day and still was profitable, at least for the ~9 days it ran, which is why I think this is worth pursuing in the first place.

Last edited by MegaTanker; 07/14/22 21:05.

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