API Support Forum
OEC API > API Support > ContractLoadRequest Returns in Reverse Order?
Author Topic: ContractLoadRequest Returns in Reverse Order?
(4 messages, Page 1 of 1)
Moderators: VPfau
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Oct 23, 2020 @ 04:36 PM             Msg. 1 of 4
For the GFAPI COM ContractLoadRequest it seems as though they don't return in order from most recent contract to the further out contracts and I'm wondering if there is a way to force it to return the most recent contracts first?

For example if I were to do just request an amount of 1, it would not return the most recent contract.

Thanks.
Edited by RWare2020 on Oct 23, 2020 04:37 PM
VPfau
Moderator
Posts: 164
Joined:


Posted: Oct 26, 2020 @ 08:12 AM             Msg. 2 of 4
Hello,

ContractLoadApi meant that you need all data you requested. You can order the result on a client side.

>I'm wondering if there is a way to force it to return the most recent contracts first?
No, we don't have this function.

>For example if I were to do just request an amount of 1, it would not return the most recent contract.
Please use symbol lookup for this. Contract load is for bulk loading.
Else you can specify more details in load request such way that your result fits into limits
Vitaliy Pfau
RWare2020
Posts: 206
Joined: Feb 11, 2020


Posted: Oct 27, 2020 @ 01:05 PM             Msg. 3 of 4
I do use the symbol lookup to view the base contracts, but we show the user all of the available contract months for that base contract.

I would like to be able to show the user at least the front month for that contract, while I am loading the remaining contracts in the background.

For example if I load GLC with a request amount of 1, it returns 2022M instead of the front month.

Is there a way to see all of the contract months for a base contract using the symbol lookup?
VPfau
Moderator
Posts: 164
Joined:


Posted: Oct 29, 2020 @ 10:48 AM             Msg. 4 of 4
>Is there a way to see all of the contract months for a base contract using the symbol lookup?
yes, the SymbolLookupRequest ctor signature is

public SymbolLookupRequest(
int resultCount,
TextSearch symbol,
TextSearch description,
TextSearch baseSymbol,
ISymbolLookupExpression expression)


if you use SymbolLookupRequestBuilder you can use WithBaseSymbol function
Vitaliy Pfau