I am trying to do an InstrumentLookup on an option strategy I can see already "created" in the TT Desktop GUI in uatCert environment:
Exchange: CME
Type: Strategy
Product: OZN
Instrument: OZN Jul19 125.5 Straddle
... but I get an "Instrument not found" event message. I do not have this problem for Futures and Options productType. Any suggestions?
Answer by trishmessina · Jun 18, 2019 at 01:05 PM
@jmargiotta Again, it is on the todo list.
Have you tried using the InstrumentCatalog and/or InstrumentCatalogSubscription class? This will download the entire product at which point you could code up a search of the catalog for an instrument that already exists instead of looking for the one single instrument. Then, if you use the InstrumentCatalogSubscription is will trigger a callback when a new instrument is created (changed or deleted) via the OnData event. The event will inform you about what happened and give you the instrument(s) affected. You would care about ProductDataEvent.InstrumentCreated. If the characteristics of the instrument match what you are looking for, you would have the instrument.
So while we do not have the do the strategy creation from the SDK yet, we do have the ability to let you know when something is created from some other source. Thanks for your input and please let me know if you have any other questions or ideas for instrument searching.
Answer by trishmessina · Jun 17, 2019 at 08:29 PM
@jmargiotta Are you specifying 'OZN Jul19 125.5 Straddle' as the alias and OptionStrategy as the product type?
Answer by jmargiotta · Jun 17, 2019 at 09:03 PM
Ah no was just using "Strategy" as that is what the field is named on the Desktop GUI. "OptionStrategy" works fine for my example.
However, this raises a second question for me- is it possible to do an InstrumentLookup on the CME using only a Globex Code? For example, a 10y Treasury Future is simple enough to deduce and map manually; it's just "ZNM9". But the straddle given above has a Globex Code of "UD:T$: ST 0617960489". In fact, any User Defined Security has a Globex Code that is only a hash. If this is not possible, what is the best way to do a mapping to the alias required if the UDS is created outside of the TT .NET API? For example, if I wanted to subscribe to an Iron Condor how would I know the exact alias the API is looking for?
Answer by trishmessina · Jun 17, 2019 at 09:17 PM
@jmargiotta No we currently do not support lookup by the contract's exchange name. Are you saying you know the Globex Code for the user defined strategy when it is created ("UD:T$: ST 0617960489") and want to use that value rather then the alias?
Answer by jmargiotta · Jun 18, 2019 at 11:53 AM
@trishmessina yes that's exactly right. My alternative is to guess at TT's alias for every type of UDS given its characteristics. Eventually I can build a library for each OptionStrategy that does the same mapping as TT, but obviously it would be much easier if I could use a unique identifier like a hash. Is it possible to do a lookup by some other OptionStrategy characteristics or do I always have to go through the TT alias?
Answer by trishmessina · Jun 18, 2019 at 12:40 PM
@jmargiotta Searching is on out todo list as we do recognize it can be difficult to find an instrument in the hundred of thousands of instruments out there.
Out of curiosity, how you will know the hash programmatically? If you don't know, couldn't you do the same with the TT alias?
Answer by jmargiotta · Jun 18, 2019 at 12:47 PM
@trishmessina CME Direct has an API which returns Globex Code (but is only in beta and currently lacking in other functionality I require). Is there a way to create strategies from scratch in the .NET API the same way it's done on the Desktop GUI? I assume this would return an Instrument object which can then be passed along.
Answer by jmargiotta · Jun 18, 2019 at 01:13 PM
@trishmessina InstrumentCatalog was on my list of things to try, though you can see why looking up a security by hash would be far preferable. Thanks for your help!
Answer by jmargiotta · Jun 18, 2019 at 01:58 PM
@trishmessina actually one last quick question- what does the UInt64 overload on InstrumentKey correspond to?
Answer by trishmessina · Jun 18, 2019 at 02:01 PM
@jmargiotta It is the TT assigned unique id for an instrument - its the value by which we internally reference the instrument. It is assigned when TT first loads the instrument into our product data server and remains assigned forever.
Ask questions and share ideas about the TT® and X_TRADER® platforms.
First time here? See our Getting Started Guide and FAQs.
© 2017 Trading Technologies International, Inc. All rights reserved.
Powered by AnswerHub