We have tried looping 3000 tickers, each time requesting data for just one ticker(Request.MarketPrice) and then canceling the request. This works but takes about 30 minutes.
So now we are trying to loop batches of 50 tickers on each request, this works partially. Some of the data is received and some has errors.
We get the following errors:
1) Requested market data is not subscribed.Error&BEST/STK/Top
2) Can't find EId with tickerId:206
3) Unable to write data to the transport connection: An established connection was aborted by the software in your host machine.
Code:
for (i = 0; i < ((int)companiesNew.Count/MAX_TICKERS); i++)
{
G2List<DDCompanyEquity> companiesNew1 = ConvertToG2List<DDCompanyEquity>(companiesNew.GetRange(i*MAX_TICKERS, MAX_TICKERS));
client.RequestCompanyEquitiesMarketData(companiesNew1);
got_ask_event.WaitOne(new TimeSpan(0, 0, 30), false);
client.CancelMarketData(i, i * MAX_TICKERS);
Thread.Sleep(new TimeSpan(0, 0, 10));
initIndicators();
}
TimeSpan times = DateTime.Now - dtfrom;
Console.WriteLine("IT TOOK "+ times.Seconds.ToString());
Console.ReadLine();
Thread.Sleep(100);
}
static void client_Error(object sender, ErrorEventArgs e)
{
Console.WriteLine("Error: " + e.ErrorMsg );
if (((int)e.ErrorCode) == 200)
{
RealTimeIndicators[e.TickerId%MAX_TICKERS] = true;
}
}
static void client_TickPrice(object sender, TickPriceEventArgs e)
{
switch (e.TickType)
{
case TickType.AskPrice:
{
ask_price = e.Price;
// client.CancelHistoricalData(e.TickerId);
// client.CancelMarketData(e.TickerId);
// got_ask_event.Set();
//// client.CancelRealTimeBars(e.TickerId);
Console.WriteLine("Price: " + e.Price + " Tick Type: " + EnumDescConverter.GetEnumDescription(e.TickType)+" on ticker id :"+e.TickerId.ToString());
RealTimeIndicators[e.TickerId % MAX_TICKERS] = true;
if (CheckIndicators())
{
client.CancelMarketData(e.TickerId-MAX_TICKERS, e.TickerId );
got_ask_event.Set();
}
// Got the ask, now free the main thread
break;
}
}
So far we have not found the cause of the errors, any help would be greatly appreciated.
Thanks for all the support.