public void Store(int tickerId, HistoryTaskCompletionSource tcs)
 {
     using (historyPointsLock.Lock())
     {
         tasks[tickerId] = tcs;
     }
 }
Example #2
0
        public async Task ReissueAsync(HistoryTaskCompletionSource tcs, CancellationToken cancellationToken = default(CancellationToken))
        {
            var tickerId = adapter.NextTickerId();
            await adapter.HistoryDataLimits.WaitForPaceLimitAsync(this, cancellationToken);

            adapter.HistoricalDepthTickers.Store(tickerId, tcs);
            ReqHistoricalData(tickerId);
        }
Example #3
0
        public async Task <IList <HistoryDataPoint> > ExecuteAsync(
            CancellationToken cancellationToken = default(CancellationToken))
        {
            var tickerId = adapter.NextTickerId();
            await adapter.HistoryDataLimits.WaitForPaceLimitAsync(this, cancellationToken);

            var request = new HistoryTaskCompletionSource(this, cancellationToken);

            adapter.HistoricalDepthTickers.Store(tickerId, request);
            ReqHistoricalData(tickerId);

            cancellationToken.RegisterSafe(() =>
            {
                adapter.Socket.cancelHistoricalData(tickerId);
                request.Cancel();
            });

            var points = await request.Task;

            return(points);
        }