API Support Forum
OEC API > API Support > New bug in GAIN COM API
Author Topic: New bug in GAIN COM API
(3 messages, Page 1 of 1)
Moderators: VPfau
WWatson2582
Posts: 38
Joined: May 03, 2018


Posted: Oct 26, 2020 @ 08:36 AM             Msg. 1 of 3
The previous bug I reported here:
https://apisupport.gainfutures.com/Topic/Index/1352

appears to be fixed in the latest release, but that release introduces a new serious bug. Over the weekend, I managed to drill down to expose the following information that should help you fix this.

Once the WithContractKinds() method has been called on the ISymbolLookupExpressionBuilder object, no other expression methods can be executed on the same object (such as WithContractType(), WithHasOptions() or WithOptionType) without causing an exception to be raised when the Build() method is later executed on that ISymbolLookupExpressionBuilder object.

The exception description is "Tree must have single root. Push more operators." The order in which these methods are called on the ISymbolLookupExpressionBuilder object do not seem to matter.

Scott Watson
JSmith5611
Posts: 187
Joined:


Posted: Oct 28, 2020 @ 11:30 AM             Msg. 2 of 3
This is not a bug, it is working as intended.

If you want to use
WithContractType() and WithHasOptions(), after you use those two, you need to use WithOperator() to say the relation between them.

You can do some very complex lookups with this.
For example, if you want to find all puts with strikes between 1600 and 1700

expressionBuilder
->WithStrikeMaximum(1700)
->WithStrikeMinimum(1600)
->WithOperator(GF_Api_COM::SymbolLookupExpressionOperator_And)
->WithOptionType(GF_Api_COM::SymbolLookupCriteriaOptionType_Put)
->WithOperator(GF_Api_COM::SymbolLookupExpressionOperator_And)
Jason Smith
JSmith5611
Posts: 187
Joined:


Posted: Oct 28, 2020 @ 11:32 AM             Msg. 3 of 3
you can think of it like a tree structure.
adding an operator adds a relationship (AND or OR) between the last two things added, and combines them into one thing.
Jason Smith