Gamestudio Links
Zorro Links
Newest Posts
New Zorro version 1.83
by jcl
Today at 16:24
Unfreed in -diag
by 3run
Today at 10:30
About STRING* and char
by 20BN
Today at 09:40
I need help
by evangelos
Today at 02:37
Draw stuff from other thread
by Superku
Yesterday at 22:00
Optimize Stop with multi Asset strategy
by Dalla
Yesterday at 21:48
cloth ?
by 3run
Yesterday at 20:48
AUM Magazine
Latest Screens
Evonet Beta v1.0 : Online Project Development Template
Lake scene
Forgotten Tales - Demo version
RPG PARTY
Who's Online
18 registered (alibaba, FirasTaji, Hicham, AndrewAMD, Cerve, 3run, easyX, 4 invisible), 474 Guests and 3 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
FirasTaji, zentrader, Fenry, DJ_Algo, tang
18005 Registered Users
Page 2 of 3 < 1 2 3 >
Topic Options
Rate This Topic
#469689 - 12/02/17 17:34 Re: Broker API - Options Questions [Re: jcl]
AndrewAMD Online
Senior Member

Registered: 02/21/17
Posts: 329
Loc: 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.

Top
#469758 - 12/06/17 18:36 Re: Broker API - Options Questions [Re: AndrewAMD]
AndrewAMD Online
Senior Member

Registered: 02/21/17
Posts: 329
Loc: Chicago
bump

Top
#469769 - 12/07/17 16:46 Re: Broker API - Options Questions [Re: AndrewAMD]
jcl Online

Chief Engineer

Registered: 07/22/00
Posts: 26402
Loc: 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.

Top
#469774 - 12/07/17 18:26 Re: Broker API - Options Questions [Re: jcl]
AndrewAMD Online
Senior Member

Registered: 02/21/17
Posts: 329
Loc: 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?

Top
#469776 - 12/08/17 08:35 Re: Broker API - Options Questions [Re: AndrewAMD]
jcl Online

Chief Engineer

Registered: 07/22/00
Posts: 26402
Loc: Frankfurt
No. I thought you were talking about the class. What is then a "symbol"?

Top
#469777 - 12/08/17 12:34 Re: Broker API - Options Questions [Re: jcl]
AndrewAMD Online
Senior Member

Registered: 02/21/17
Posts: 329
Loc: Chicago
The equivalent of char* Asset.

Top
#469778 - 12/08/17 16:46 Re: Broker API - Options Questions [Re: AndrewAMD]
jcl Online

Chief Engineer

Registered: 07/22/00
Posts: 26402
Loc: Frankfurt
Like "AAPL" for Apple options?

Top
#469784 - 12/08/17 17:29 Re: Broker API - Options Questions [Re: jcl]
AndrewAMD Online
Senior Member

Registered: 02/21/17
Posts: 329
Loc: 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?

Top
#469787 - 12/08/17 17:46 Re: Broker API - Options Questions [Re: AndrewAMD]
jcl Online

Chief Engineer

Registered: 07/22/00
Posts: 26402
Loc: 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.


Top
#469989 - 12/18/17 14:15 Re: Broker API - Options Questions [Re: jcl]
AndrewAMD Online
Senior Member

Registered: 02/21/17
Posts: 329
Loc: 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?


Edited by AndrewAMD (12/18/17 15:59)
Edit Reason: struct handling clarification

Top
Page 2 of 3 < 1 2 3 >



Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de