API Support Forum
OEC API > Market Data > multiple subscription
Author Topic: multiple subscription
(7 messages, Page 1 of 1)
Moderators: VPfau
FGiordano538
Posts: 24
Joined: May 09, 2022


Posted: Jun 10, 2022 @ 04:27 AM             Msg. 1 of 7
Hi,
my example:

Dim Criterio_ = New SymbolLookupRequestBuilder
Criterio_.WithResultCount(CInt(Tb_NumeroTit.Text))
Criterio_.WithSymbol(TbTitolo.Text.Trim, TextSearchMode.AnyInclusion)
If gfClient.Exchanges.Get(Cb_Exchange.Text) IsNot Nothing Then
Criterio_ = Criterio_.WithExpression(New ExchangeIDCriterion(gfClient.Exchanges.Get(Cb_Exchange.Text).ID))
End If
Criterio_.Build()
TitoliRichiesti = gfClient.Contracts.Lookup.ByCriteria(Criterio_.Build)

with this example I subscribe to titles with the same base in the symbol or in the description.
Is there a way to subscribe + titles, simultaneously, with distinct symbols?
for example (OESM22 P4000, OESM22 P4100, OESM22 P4200)
Thank you.
SRuscak
Posts: 50
Joined: Aug 24, 2017


Posted: Jun 13, 2022 @ 07:47 AM             Msg. 2 of 7
Hello,

The code you have posted does fetch contracts matching the criteria into the local cache.

However, usually when we say 'subscribe' we refer to a price, charts, or DOM subscription on one of those contracts. This will give you periodic updates for this data. Subscription is a separate call from symbol lookup. You can see code examples here:

https://gainfutures.com/GFAPI
https://gainfutures.com/GFAPI/html/4e2865e8-7ac9-457e-8d5a-6d930f3408a8.htm
FGiordano538
Posts: 24
Joined: May 09, 2022


Posted: Jun 16, 2022 @ 07:56 AM             Msg. 3 of 7
Of course I expressed myself badly, I meant a request for info for various symbols.
SRuscak
Posts: 50
Joined: Aug 24, 2017


Posted: Jun 16, 2022 @ 10:56 AM             Msg. 4 of 7
Perhaps you are looking for a complex symbol lookup expression using 'or'? There is an example here that may be useful:
https://gainfutures.com/GFAPI/html/0522b8f0-2870-43a9-ad0a-76a4421cbac1.htm

Maybe something similar to this:
_requestID = client.Contracts.Lookup.ByCriteria(
new SymbolLookupRequestBuilder()
.WithResultCount(50)
.WithExpression(new SymbolLookupExpressionBuilder()
.WithSymbol("ES", TextSearchMode.AnyInclusion)
.WithSymbol("NQ", TextSearchMode.AnyInclusion)
.WithSymbol("6E", TextSearchMode.AnyInclusion)
.Push(SymbolLookupExpressionOperator.Or)
.Push(SymbolLookupExpressionOperator.Or)
.Build())
.Build());
FGiordano538
Posts: 24
Joined: May 09, 2022


Posted: Jun 17, 2022 @ 05:50 AM             Msg. 5 of 7
I solved, with "Client.Contracts.Lookup.BySymbol (Symbol)",
scrolling through a list and I request the data of the title individually and then I subscribe it.
Same thing to unsubscribe.
So I don't have the 50 limit of the "client.Contracts.Lookup.ByCriteria" command