API Support Forum
OEC API > API Support > Unsubscribing request fail
Author Topic: Unsubscribing request fail
(3 messages, Page 1 of 1)
Moderators: VPfau
VVadim41
Posts: 12
Joined: Mar 22, 2010


Posted: Jun 04, 2010 @ 10:00 AM             Msg. 1 of 3
Hello.
Few days ago I see a problem with unsubscribing instruments.
I have Tick and Dom subscription and when I send request to unsubscribe this, Tick is not unsubscribed...
Result of request and subscription list on my log:
04.06.2010 17:51:17 FDAXM0Dom Unsubscribed, Tick unsubscribing FAIL
FDAXM0 Tick
NSEA-MN0 Tick
NSEA-MN0 DOM
ESM0 Tick
ESM0 DOM
EUR/USD Tick
EUR/USD DOM
04.06.2010 17:51:17 FDAXM0Dom Unsubscribed, Tick unsubscribing FAIL
FDAXM0 Tick
NSEA-MN0 Tick
NSEA-MN0 DOM
ESM0 Tick
ESM0 DOM
EUR/USD Tick
EUR/USD DOM
04.06.2010 17:51:17 NSEA-MN0Dom Unsubscribed, Tick unsubscribing FAIL
FDAXM0 Tick
NSEA-MN0 Tick
ESM0 Tick
ESM0 DOM
EUR/USD Tick
EUR/USD DOM
04.06.2010 17:51:17 NSEA-MN0Dom Unsubscribed, Tick unsubscribing FAIL
FDAXM0 Tick
NSEA-MN0 Tick
ESM0 Tick
ESM0 DOM
EUR/USD Tick
EUR/USD DOM
04.06.2010 17:51:17 ESM0Dom Unsubscribed, Tick unsubscribing FAIL
FDAXM0 Tick
NSEA-MN0 Tick
ESM0 Tick
EUR/USD Tick
EUR/USD DOM
04.06.2010 17:51:17 ESM0Dom Unsubscribed, Tick unsubscribing FAIL
FDAXM0 Tick
NSEA-MN0 Tick
ESM0 Tick
EUR/USD Tick
EUR/USD DOM
04.06.2010 17:51:17 EUR/USDDom Unsubscribed, Tick unsubscribing FAIL
FDAXM0 Tick
NSEA-MN0 Tick
ESM0 Tick
EUR/USD Tick
04.06.2010 17:51:17 EUR/USDDom Unsubscribed, Tick unsubscribing FAIL
FDAXM0 Tick
NSEA-MN0 Tick
ESM0 Tick
EUR/USD Tick


and request code:

try
{
bool error1 = false;
bool error2 = false;
client.Unsubscribe(contract);
foreach (Subscription subscription in client.Subscriptions)
{
if (subscription.Contract.Symbol == instrument.Symbol && subscription.Type == SubscriptionType.Tick)
error1 = true;
}
client.UnsubscribeDOM(contract);
foreach (Subscription subscription in client.Subscriptions)
{
if (subscription.Contract.Symbol == instrument.Symbol && subscription.Type == SubscriptionType.DOM)
error2 = true;
}
if (!error1 && !error2) Console.WriteLine(Clock.Now + " " + instrument.Symbol + "Tick&Dom Unsubscribed");
else if (!error1 && error2) Console.WriteLine(Clock.Now + " " + instrument.Symbol + "Tick Unsubscribed, DOM unsubscribing FAIL" );
else if (error1 && !error2) Console.WriteLine(Clock.Now + " " + instrument.Symbol + "Dom Unsubscribed, Tick unsubscribing FAIL");
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}

Edited by VVadim41 on Jun 4, 2010 at 10:05:47
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Jun 04, 2010 @ 12:48 PM             Msg. 2 of 3
client.Unsubscribe(contract); unsubscribes quotes, not ticks. More accurately, it tries to unsubscribe quotes:
- if you have a position, you will not be able to unsubscribe its quotes;
- there is a reference counter for quote subscriptions: if you have subscribed twice for a contract, you need to unsubscribe also twice.

Victor Vins
Software Developer
VVadim41
Posts: 12
Joined: Mar 22, 2010


Posted: Jun 04, 2010 @ 01:02 PM             Msg. 3 of 3
ok, thx