private async Task <OperationExecutionInfoWithPause <SpecialLiquidationOperationData> > GetRfqByIdAsync(string id)
 {
     return((await _executionInfoRepository
             .GetRfqAsync(0, 1, id))
            .Contents
            .Single());
 }
Example #2
0
        public async Task <PaginatedResponse <RfqWithPauseSummary> > GetAsync(RfqFilter filter, int skip, int take)
        {
            var taken = new List <RfqWithPauseSummary>();
            PaginatedResponse <OperationExecutionInfoWithPause <SpecialLiquidationOperationData> > currentBatch;
            int totalFetched = 0;

            do
            {
                currentBatch = await _operationExecutionInfoRepository.GetRfqAsync(
                    skip + totalFetched,
                    take - taken.Count,
                    filter?.OperationId,
                    filter?.InstrumentId,
                    filter?.AccountId,
                    filter?.MapStates(),
                    filter?.DateFrom,
                    filter?.DateTo);

                totalFetched += currentBatch.Size;

                var currentBatchFilteredWithPause = currentBatch
                                                    .Contents
                                                    .Select(o => o.ToRfqWithPauseSummary())
                                                    .Where(filter.GetApplyPauseFilterFunc());

                taken.AddRange(currentBatchFilteredWithPause);
            } while (taken.Count < take && currentBatch.Size > 0);

            return(new PaginatedResponse <RfqWithPauseSummary>(taken, skip, taken.Count, currentBatch.TotalSize));
        }