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 (Edgar_Herrera, VoroneTZ, Akow), 973 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
Page 2 of 3 1 2 3
Re: Broker API - Options Questions [Re: jcl] #469689
12/02/17 16:34
12/02/17 16:34
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Originally Posted By: jcl
For buying and selling an option, the symbol is passed in char* Asset, coded in the way as described on the "IB" page of the manual.
jcl,

Is there some way that my plugin can define a futures/options/futures-options contract symbol so that Zorro's use of char* Asset always matches that of my broker?

I mean like this:
* Zorro calls GET_OPTIONS or GET_FUTURES.
* Plugin copies the CONTRACT structs and then return a **negative** number of contracts to indicate that the plugin has symbols to supply. Plugin saves the symbols.
* Zorro calls a new function GET_OPTIONS_SYMBOLS or GET_FUTURES_SYMBOLS. Zorro provides a pointer to an array of strings, and the plugin copies the symbols to the array of strings.
* The number of CONTRACT structs and symbols would therefore be identical.
* Any BrokerAsset, BrokerHistory2, and BrokerBuy call using one of these contracts would therefore use the respective symbol for char* Asset.

This would be especially helpful to me, since my SC plugin will be multi-broker.

Re: Broker API - Options Questions [Re: AndrewAMD] #469758
12/06/17 17:36
12/06/17 17:36
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
bump

Re: Broker API - Options Questions [Re: AndrewAMD] #469769
12/07/17 15:46
12/07/17 15:46
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
The symbols are fact already loaded, only it's an undocumented function because it's not used yet. The string is stored at the begin of any CONTRACT* struct in the Contracts list, instead of the date that is not needed in the options chain.

So, string Class = Contracts + ContractRow should get the symbol of the current contract.

Re: Broker API - Options Questions [Re: jcl] #469774
12/07/17 17:26
12/07/17 17:26
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Originally Posted By: jcl
The symbols are fact already loaded, only it's an undocumented function because it's not used yet. The Symbol string is stored at the begin of any CONTRACT* struct in the Contracts list, instead of the date that is not needed in the options chain.

So, string CSymbol = Contracts + ContractRow should get the symbol of the current contract.
Earlier in the thread, you gave me this line of code:
Code:
strcpy_s((char*)g_Contracts,8,C.tradingClass.c_str());

... and you said it was reserved for the trading class. Are you saying that this has been changed to the actual symbol?

Back to the struct...
Code:
typedef struct CONTRACT
{
	DATE	time;			// or trading class
	float fAsk, fBid; // premium without multiplier (f1,f2)
	float fVal;			// open interest or multiplier (f3)
	float fVol;			// volume (f4)
	float fUnl;			// unadjusted underlying price (f5)
	float fStrike;		// (f6)
	long	Expiry;		// YYYYMMDD (i7)
	long	Type;			// PUT, CALL, FUTURE, EUROPEAN, BINARY (s8)
} CONTRACT; // for options, futures, FOPs

"time" only has room for 8 characters... I don't think that's enough room for an options / futures / FOP symbol.

Did you mean that I can overwrite fAsk and fBid as well, giving me 16 characters?

Re: Broker API - Options Questions [Re: AndrewAMD] #469776
12/08/17 07:35
12/08/17 07:35
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
No. I thought you were talking about the class. What is then a "symbol"?

Re: Broker API - Options Questions [Re: jcl] #469777
12/08/17 11:34
12/08/17 11:34
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
The equivalent of char* Asset.

Re: Broker API - Options Questions [Re: AndrewAMD] #469778
12/08/17 15:46
12/08/17 15:46
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Like "AAPL" for Apple options?

Re: Broker API - Options Questions [Re: jcl] #469784
12/08/17 16:29
12/08/17 16:29
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
I mean the complete "ticker symbol" to represent a specific future or option or futures option which, in the symbol itself, indicates:
* core or underlying symbol ("ES" for e-mini, "AAPL" for Apple)
* call or put or future, etc.
* futures expiration month (if applicable)
* strike price (if applicable)
* exchange (depending on the broker)

... all of those things in one string.

But you see, I have an engineering problem: The nomenclature is completely different for every broker, and I need a universal approach to support them all:
* IB has unique nomenclature
* TD Ameritrade has unique nomenclature
* CQG has unique nomenclature
* and so on.

I am already able to define the contract structs. I simply would like to be able to define the complete "ticker symbol" as well.

So I'm asking for a pointer to an array of strings - that way, I can give Zorro the complete "ticker symbols".

The intent is for BrokerAsset (and other plugin calls) to use this complete ticker symbol for char* Asset.

Is this possible?

Re: Broker API - Options Questions [Re: AndrewAMD] #469787
12/08/17 16:46
12/08/17 16:46
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Do you mean a code like "AAPL-OPT-150-20180303-USD"? That's not supplied by the plugin. It is an internal code used only by Zorro for sending strike, expiry and other parameters to the IB plugin. The API does not know this code. If broker APIs have similar codes in internal lists, they are then broker specific, and not used by Zorro.


Re: Broker API - Options Questions [Re: jcl] #469989
12/18/17 13:15
12/18/17 13:15
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Originally Posted By: jcl
Do you mean a code like "AAPL-OPT-150-20180303-USD"? That's not supplied by the plugin. It is an internal code used only by Zorro for sending strike, expiry and other parameters to the IB plugin. The API does not know this code. If broker APIs have similar codes in internal lists, they are then broker specific, and not used by Zorro.

Yes, that's it! laugh

Did you know that Zorro has been sending IB codes to my Ally plugin for options, and that my plugin had to parse the IB codes and translate them to Ally codes? (Look at my source. I distinguish between "Zorro Assets" and "Ally Assets".)

This approach is not feasible for my new plugin, since it supports many brokers, and therefore many broker codes.

I have a new idea:

1) Zorro calls GET_OPTIONS or GET_FUTURES.
2) Plugin fills CONTRACT structs.

BUT... instead of filling in the exchange info for the time variable, the plugin sends a uint32_t value instead. This will act as an Asset ID number.

Before: strcpy to CONTRACT.time the exchange name, eight bytes max.
New approach: memcpy eight bytes to CONTRACT.time: "ID#\0xxxx", where "ID#\0" is a header, and "xxxx" is the uint32_t Asset ID number which the plugin has memorized.

Plugin will be responsible for memorizing the Asset broker code associated with each Asset ID number.

3) Plugin returns number of structs.

4) NEW FEATURE: Zorro will see that the plugin has filled out the CONTRACT time value in a certain way (such as with a header) and instead of sending an IB code upon BrokerAsset, will send a string indicating the ID number, so that my plugin can retrieve the broker code.

For example: "ID#123456789";

5) My plugin parses this string and retrieves the ID number. Now it knows what broker code to use.

Can this be implemented?

Last edited by AndrewAMD; 12/18/17 14:59. Reason: struct handling clarification
Page 2 of 3 1 2 3

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