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
3 registered members (AndrewAMD, Nymphodora, Quad), 923 guests, and 5 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
How to manage a combination of assets in scripts? #471550
03/09/18 10:23
03/09/18 10:23
Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
M
mhdus Offline OP
Junior Member
mhdus  Offline OP
Junior Member
M

Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
I know it is on the list of future features: "Artificial assets from a linear combination of real assets, for basket trading or multi-asset arbitrage." but I wonder how to best approach this in scripts while Zorro does not have the feature yet?
In particular for option strategies this is an important topic. E. g. how to manage a "short strangle" (combination of short put and short call) as a single position (or "trade", in Zorro terms) with e. g. a combined profit target and combined stop loss? TMFs appear only partially useful as they are focused on the individual trade, so they could only serve as input for a separate logic managing the combined positions, I believe. So I wonder if one would e. g. have to define a dedicated STRUCT CombinedAsset with some position-related parameters such as CombinedProfit etc. and a list of pointers to the individual trades, and then using individual TMFs to feed/update these structs? Or are there better/alternative approaches?
I'd appreciate any experience/ideas shared around this topic... thanks!
Or to avoid unnecessary work: @jcl, any timelines by when the artificial assets feature might be built into Zorro?

Re: How to manage a combination of assets in scripts? [Re: mhdus] #471552
03/09/18 12:35
03/09/18 12:35
Joined: Aug 2017
Posts: 102
Spain
B
Brax Offline
Member
Brax  Offline
Member
B

Joined: Aug 2017
Posts: 102
Spain
AFAIK there is a library to code option strategies <contract.h>, you can find more info in the following links:

http://www.financial-hacker.com/algorithmic-options-trading/
http://www.financial-hacker.com/algorithmic-options-trading-2/
http://www.financial-hacker.com/algorithmic-options-trading-part-3/

If you search on the forum you'll find some more questions relating to options trading. I can't further help you as i haven't done any research with options trading yet.

Hope it helps.

Re: How to manage a combination of assets in scripts? [Re: Brax] #471553
03/09/18 12:50
03/09/18 12:50
Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
M
mhdus Offline OP
Junior Member
mhdus  Offline OP
Junior Member
M

Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
Thank you. In fact I'm well aware of the options-specific functions. However, the topic of "artifical" (=combined) assets is not covered. In fact it is not an options-specific topic as such, it just happens to be quite important in the context of options trading. Also the options-related articles on FH are not helping in this direction as the topic of combined positions is not touched (or only very rudimentary in the way the margin is calculated).

Re: How to manage a combination of assets in scripts? [Re: mhdus] #471557
03/09/18 14:32
03/09/18 14:32
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
As long as a Straddle/Spread is not bought/sold as a single instrument to begin with, you will not escape handling each leg separately and "adding" them for CombinedProfit,etc
Whether Zorro does this under the hood or you do in the script, the steps will be more or less the same.
Your approach looks sound.

Last edited by Zheka; 03/09/18 17:39.
Re: How to manage a combination of assets in scripts? [Re: Zheka] #471559
03/09/18 19:43
03/09/18 19:43
Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
M
mhdus Offline OP
Junior Member
mhdus  Offline OP
Junior Member
M

Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
What do you mean by "bought/sold as a single instrument to begin with"? I know how to do that manually in TWS - but I would have never thought this is possible via the API... thanks for the suggestion! It appears to be possible indeed. Unfortunetaly it is somewhat beyond my Zorro/IB-Bridge skills to translate these code samples into the Zorro environment - if possible at all?
If not: @jcl, would that be something that could be added to Zorro with significantly less effort than a full-blown solution for artificial assets managed internally by Zorro?

Last edited by mhdus; 03/09/18 20:00.
Re: How to manage a combination of assets in scripts? [Re: mhdus] #471561
03/09/18 21:13
03/09/18 21:13
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
There is no saving on commission with IB when you trade a "combo" instrument.
So, unless your strategy really, really requires perfect synchronisation of legs, you gain no benefit trading e.g.a straddle in one go, except for some simpler position handling.
However, with options it is better to execute "bargaining" within the spread (with limit orders) - so pricing/executing the whole combo at once can be faster/better synced than working 2-3 separate leg orders.
Supporting combo orders in a plug-in should not be difficult.
Lets organize a small riot to kindly ask for improvements to the current IB plug-in (both speed and features). smile

Re: How to manage a combination of assets in scripts? [Re: Zheka] #471562
03/09/18 22:26
03/09/18 22:26
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Originally Posted By: Zheka
Supporting combo orders in a plug-in should not be difficult.
Side note: the DTC protocol does not support combo options orders, but the Ally plugin does.

Re: How to manage a combination of assets in scripts? [Re: AndrewAMD] #471569
03/10/18 09:48
03/10/18 09:48
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
Quote:
the DTC protocol does not support combo options orders
Unfortunately. I was going to say that we can wait for your DTC plug-in but then realised DTC would most probably not support such things, unless it is an exchange-traded spread(which are e.g. very actively traded in energies).

Re: How to manage a combination of assets in scripts? [Re: Zheka] #471591
03/10/18 17:31
03/10/18 17:31
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Spreads are only explicitly supported by DTC if the broker supplies a symbol for it (such as CQG). Otherwise, you have to manually construct the asset using a sequence of orders.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1