API Support Forum
OEC API > Market Data > Pagination of symbols - ByCriteria
Author Topic: Pagination of symbols - ByCriteria
(3 messages, Page 1 of 1)
Moderators: VPfau
JKovalcin926
Posts: 8
Joined: Jan 24, 2022


Posted: Jul 25, 2022 @ 04:54 PM             Msg. 1 of 3
hi, we want to get the list of all futures symbols, we already make the request but we have the maximum limit of 50 results.
Could you help me with indications or examples of how to paginate to obtain them all?

I attach the code fragment of the request and the list obtained
Thanks for advanced

***************************************************************************************
List listaTipo = new List();
listaTipo.Add(ContractKind.Future);
IReadOnlyList listaOnlyRead = listaTipo;

var _esRequestID = client.Contracts.Lookup.ByCriteria(
new SymbolLookupRequestBuilder()
.WithResultCount(50)
.WithSymbol("", TextSearchMode.AnyInclusion)
.WithExpression(new ContractKindsCriterion(GetSelectedContractKinds().ToList().AsReadOnly())).Build());

***************************************************************************************
private static void GFClient_OnSymbolLookupReceived(IGFClient client, SymbolLookupEventArgs e)
{
foreach (var contract in e.Contracts)
{
Console.WriteLine("received:" + contract.Symbol);
}
}

***************************************************************************************
VPfau
Moderator
Posts: 150
Joined: Oct 26, 2011


Posted: Jul 26, 2022 @ 08:51 AM             Msg. 2 of 3
Hello,

Please see similar topic: https://apisupport.gainfutures.com/Topic/Index/1453
There is a code snipped with example how you can organize a paginated requests:
https://bitbucket.org/GainFuturesDev/workspace/snippets/8Eqk9b/gfapi-paged-load-contracts-by-basesymbol

Also see these functions of ContractLoadRequestBuilder: WithSkipCount, WithResultCount
Vitaliy Pfau
JKovalcin926
Posts: 8
Joined: Jan 24, 2022


Posted: Aug 02, 2022 @ 11:42 AM             Msg. 3 of 3
Thanks a lot