we have a problem receiving RT data in C#, MS VisualStudio when data for each stock goes to separate file. We look for exceptions in esignal_OnQuoteChanged and esignal_OnTimeSalesChanged. We start the work with IESignal.Hooks esignal = new IESignal.Hooks() and esignal.SetApplication(accountUserName), and then esignal.RequestSymbol(<symbol>, 1) for each stock and also esignal.get_RequestTimeSales(tsFilter) where IESignal.TimeSalesFilter tsFilter = new IESignal.TimeSalesFilter() where tsFilter.sSymbol = <symbol> for each stock.
Question: is this enough to receive RT DF for entire day? Is it possible to receive sample code to solve such task?
Our code is below:
private void SetConnect()
{
IESignal.Hooks esignal = new IESignal.Hooks();
esignal.OnQuoteChanged += new IESignal._IHooksEvents_OnQuoteChangedEventHandler( esignal_OnQuoteChanged);
esignal.OnTimeSalesChanged += new IESignal._IHooksEvents_OnTimeSalesChangedEventHand ler(esignal_OnTimeSalesChanged);
esignal.SetApplication(accountUserName);
esignal.ClearSymbolCache();
esignal.ReleaseAllHistory();
esignal.ReleaseAllTimeSales();
if (esignal.IsEntitled != 0)
{
foreach (string key in stockNameList)
{
esignal.RequestSymbol(key, 1);
IESignal.TimeSalesFilter tsFilter = new IESignal.TimeSalesFilter();
tsFilter.sSymbol = key;
tsFilter.bQuotes = 1;
tsFilter.bTrades = 1;
tsFilter.lNumDays = 1;
tsFilter.bFilterPrice = 0;
tsFilter.bFilterVolume = 0;
tsFilter.bFilterQuoteExchanges = 0;
tsFilter.bFilterTradeExchanges = 0;
esignal.get_RequestTimeSales(tsFilter);
}
}
private void esignal_OnQuoteChanged(string Symbol)
{
try
{
IESignal.BasicQuote quote = esignal.get_GetBasicQuote(Symbol);
}
catch (Exception e)
{
MessageBox.Show("esignal_OnQuoteChanged " + e.ToString());
}
}
private void esignal_OnTimeSalesChanged(int tsHandle)
{//'lHandle is the handle to the time sales request that requested this data
//int lNumBars = esignal.get_GetNumTimeSalesBars(tsHandle); //Gets number of historical bars
int lNumRtBars = esignal.get_GetNumTimeSalesRtBars(tsHandle); //Gets number of 'real-time bars
int lDiff = -1 * (lNumRtBars - lLastTsRtCount);// Determine the number of new bars since the last event
for (int lBar = lDiff + 1; lBar < 0; lBar++)
{
try
{
IESignal.TimeSalesData item = esignal.get_GetTimeSalesBar(tsHandle, lBar);//Gets a TimeSalesData data structure.
}
catch (Exception e)
{
MessageBox.Show("esignal_OnTimeSalesChanged " + e.ToString());
}
}
lLastTsRtCount = lNumRtBars;//Remember the number of real-time bars so you can track how many new real-time bars occur the next time.
}
Question: is this enough to receive RT DF for entire day? Is it possible to receive sample code to solve such task?
Our code is below:
private void SetConnect()
{
IESignal.Hooks esignal = new IESignal.Hooks();
esignal.OnQuoteChanged += new IESignal._IHooksEvents_OnQuoteChangedEventHandler( esignal_OnQuoteChanged);
esignal.OnTimeSalesChanged += new IESignal._IHooksEvents_OnTimeSalesChangedEventHand ler(esignal_OnTimeSalesChanged);
esignal.SetApplication(accountUserName);
esignal.ClearSymbolCache();
esignal.ReleaseAllHistory();
esignal.ReleaseAllTimeSales();
if (esignal.IsEntitled != 0)
{
foreach (string key in stockNameList)
{
esignal.RequestSymbol(key, 1);
IESignal.TimeSalesFilter tsFilter = new IESignal.TimeSalesFilter();
tsFilter.sSymbol = key;
tsFilter.bQuotes = 1;
tsFilter.bTrades = 1;
tsFilter.lNumDays = 1;
tsFilter.bFilterPrice = 0;
tsFilter.bFilterVolume = 0;
tsFilter.bFilterQuoteExchanges = 0;
tsFilter.bFilterTradeExchanges = 0;
esignal.get_RequestTimeSales(tsFilter);
}
}
private void esignal_OnQuoteChanged(string Symbol)
{
try
{
IESignal.BasicQuote quote = esignal.get_GetBasicQuote(Symbol);
}
catch (Exception e)
{
MessageBox.Show("esignal_OnQuoteChanged " + e.ToString());
}
}
private void esignal_OnTimeSalesChanged(int tsHandle)
{//'lHandle is the handle to the time sales request that requested this data
//int lNumBars = esignal.get_GetNumTimeSalesBars(tsHandle); //Gets number of historical bars
int lNumRtBars = esignal.get_GetNumTimeSalesRtBars(tsHandle); //Gets number of 'real-time bars
int lDiff = -1 * (lNumRtBars - lLastTsRtCount);// Determine the number of new bars since the last event
for (int lBar = lDiff + 1; lBar < 0; lBar++)
{
try
{
IESignal.TimeSalesData item = esignal.get_GetTimeSalesBar(tsHandle, lBar);//Gets a TimeSalesData data structure.
}
catch (Exception e)
{
MessageBox.Show("esignal_OnTimeSalesChanged " + e.ToString());
}
}
lLastTsRtCount = lNumRtBars;//Remember the number of real-time bars so you can track how many new real-time bars occur the next time.
}