public async Task <PaginatedResponseContract <OrderEventWithAdditionalContract> > OrderHistoryByPages(
            [FromBody] OrderEventsFilterRequest filters,
            [FromQuery] int?skip         = 0, [FromQuery] int?take = 20,
            [FromQuery] bool isAscending = false)
        {
            ApiValidationHelper.ValidatePagingParams(skip, take);

            var data = await _ordersHistoryRepository.GetHistoryByPagesAsync(
                accountId : filters?.AccountId,
                assetPairId : filters?.AssetPairId,
                statuses : filters?.Statuses?.Select(x => x.ToType <OrderStatus>()).ToList(),
                orderTypes : filters?.OrderTypes?.Select(x => x.ToType <OrderType>()).ToList(),
                originatorTypes : filters?.OriginatorTypes?.Select(x => x.ToType <OriginatorType>()).ToList(),
                parentOrderId : filters?.ParentOrderId,
                createdTimeStart : filters?.CreatedTimeStart,
                createdTimeEnd : filters?.CreatedTimeEnd,
                modifiedTimeStart : filters?.ModifiedTimeStart,
                modifiedTimeEnd : filters?.ModifiedTimeEnd,
                skip : skip,
                take : take,
                isAscending : isAscending,
                executedOrdersEssentialFieldsOnly : filters?.RequestType == OrderEventsRequestType.ExecutedOrders);

            return(new PaginatedResponseContract <OrderEventWithAdditionalContract>(
                       contents: data.Contents.Select(Convert).ToList(),
                       start: data.Start,
                       size: data.Size,
                       totalSize: data.TotalSize
                       ));
        }
Esempio n. 2
0
        public async Task <PaginatedResponseContract <MatchingEngineRouteContract> > ListByPages(int?skip = null, int?take = null)
        {
            ApiValidationHelper.ValidatePagingParams(skip, take);

            var data = await _tradingRoutesRepository.GetByPagesAsync(skip, take);

            return(new PaginatedResponseContract <MatchingEngineRouteContract>(
                       contents: data.Contents.Select(x => _convertService.Convert <ITradingRoute, MatchingEngineRouteContract>(x)).ToList(),
                       start: data.Start,
                       size: data.Size,
                       totalSize: data.TotalSize
                       ));
        }
        public async Task <PaginatedResponseContract <OrderEventForSupportContract> > OrderHistoryForSupport([FromBody] OrderEventsForSupportRequest request)
        {
            ApiValidationHelper.ValidatePagingParams(request.Skip, request.Take);

            var result = await _orderHistoryForSupportQuery.Ask(request.FromContract());

            var items = result.Contents.Select(p => p.ToContract()).ToList();

            return(new PaginatedResponseContract <OrderEventForSupportContract>(contents: items,
                                                                                start: result.Start,
                                                                                size: result.Size,
                                                                                totalSize: result.TotalSize));
        }
Esempio n. 4
0
        public async Task <PaginatedResponseContract <PositionEventContract> > PositionHistoryByPages([FromQuery] string accountId, [FromQuery] string instrument, [FromQuery] DateTime?eventDateFrom, [FromQuery] DateTime?eventDateTo, int?skip = null, int?take = null)
        {
            ApiValidationHelper.ValidatePagingParams(skip, take);

            var data = await _positionsHistoryRepository.GetByPagesAsync(accountId, instrument, eventDateFrom, eventDateTo, skip, take);

            return(new PaginatedResponseContract <PositionEventContract>(
                       contents: data.Contents.Where(d => d != null).Select(Convert).ToList(),
                       start: data.Start,
                       size: data.Size,
                       totalSize: data.TotalSize
                       ));
        }
        public async Task <PaginatedResponseContract <TradingInstrumentContract> > ListByPages(string tradingConditionId,
                                                                                               int?skip = null, int?take = null)
        {
            ApiValidationHelper.ValidatePagingParams(skip, take);

            var data = await _tradingInstrumentsRepository.GetByPagesAsync(tradingConditionId, skip, take);

            return(new PaginatedResponseContract <TradingInstrumentContract>(
                       contents: data.Contents.Select(x => _convertService.Convert <ITradingInstrument, TradingInstrumentContract>(x)).ToList(),
                       start: data.Start,
                       size: data.Size,
                       totalSize: data.TotalSize
                       ));
        }
Esempio n. 6
0
        public async Task <PaginatedResponseContract <AssetContract> > ListByPages(
            [FromQuery] int?skip = null, [FromQuery] int?take = null)
        {
            ApiValidationHelper.ValidatePagingParams(skip, take);

            var data = await _assetsRepository.GetByPagesAsync(skip, take);

            return(new PaginatedResponseContract <AssetContract>(
                       contents: data.Contents.Select(x => _convertService.Convert <IAsset, AssetContract>(x)).ToList(),
                       start: data.Start,
                       size: data.Size,
                       totalSize: data.TotalSize
                       ));
        }
Esempio n. 7
0
        public async Task <PaginatedResponseContract <TradeContract> > ListByPages([FromQuery][Required] string accountId,
                                                                                   [FromQuery] string assetPairId = null, [FromQuery] int?skip = null, [FromQuery] int?take = null,
                                                                                   [FromQuery] bool isAscending   = false)
        {
            ApiValidationHelper.ValidatePagingParams(skip, take);

            var data = await _tradesRepository.GetByPagesAsync(accountId, assetPairId, skip, take,
                                                               isAscending);

            return(new PaginatedResponseContract <TradeContract>(
                       contents: data.Contents.Select(Convert).ToList(),
                       start: data.Start,
                       size: data.Size,
                       totalSize: data.TotalSize
                       ));
        }
        public async Task <PaginatedResponseContract <AssetPairContract> > ListByPages([FromQuery] string legalEntity = null,
                                                                                       [FromQuery] MatchingEngineModeContract?matchingEngineMode = null, [FromQuery] string filter = null,
                                                                                       [FromQuery] int?skip = null, [FromQuery] int?take = null)
        {
            ApiValidationHelper.ValidatePagingParams(skip, take);

            var data = await _assetPairsRepository.GetByLeAndMeModeByPagesAsync(legalEntity,
                                                                                matchingEngineMode?.ToString(), filter, skip, take);

            return(new PaginatedResponseContract <AssetPairContract>(
                       contents: data.Contents.Select(x => _convertService.Convert <IAssetPair, AssetPairContract>(x)).ToList(),
                       start: data.Start,
                       size: data.Size,
                       totalSize: data.TotalSize
                       ));
        }
        public async Task <PaginatedResponseContract <DealContract> > ListByPages(
            [FromQuery] string accountId, [FromQuery] string instrument,
            [FromQuery] DateTime?closeTimeStart = null, [FromQuery] DateTime?closeTimeEnd = null,
            [FromQuery] int?skip         = null, [FromQuery] int?take = null,
            [FromQuery] bool isAscending = false)
        {
            ApiValidationHelper.ValidatePagingParams(skip, take);

            var data = await _dealsRepository.GetByPagesAsync(accountId, instrument,
                                                              closeTimeStart, closeTimeEnd, skip : skip, take : take, isAscending : isAscending);

            return(new PaginatedResponseContract <DealContract>(
                       contents: data.Contents.Select(Convert).ToList(),
                       start: data.Start,
                       size: data.Size,
                       totalSize: data.TotalSize
                       ));
        }
        public async Task <PaginatedResponseContract <OrderForOrderBlotterContract> > Get(
            [FromQuery, Required] DateTime?relevanceTimestamp,
            [FromQuery] string accountIdOrName,
            [FromQuery] string assetName,
            [FromQuery] string createdBy,
            [FromQuery] List <OrderStatusContract> statuses,
            [FromQuery] List <OrderTypeContract> orderTypes,
            [FromQuery] List <OriginatorTypeContract> originatorTypes,
            [FromQuery] DateTime?createdOnFrom,
            [FromQuery] DateTime?createdOnTo,
            [FromQuery] DateTime?modifiedOnFrom,
            [FromQuery] DateTime?modifiedOnTo,
            [FromQuery] int skip,
            [FromQuery] int take,
            [FromQuery] OrderBlotterSortingColumnContract sortingColumn,
            [FromQuery] SortingOrderContract sortingOrder)
        {
            ApiValidationHelper.ValidatePagingParams(skip, take);

            var result = await _ordersHistoryRepository.GetOrderBlotterAsync(
                relevanceTimestamp.Value,
                accountIdOrName,
                assetName,
                createdBy,
                statuses?.Select(x => x.ToType <OrderStatus>()).ToList(),
                orderTypes?.Select(x => x.ToType <OrderType>()).ToList(),
                originatorTypes?.Select(x => x.ToType <OriginatorType>()).ToList(),
                createdOnFrom,
                createdOnTo,
                modifiedOnFrom,
                modifiedOnTo,
                skip,
                take,
                sortingColumn.ToType <OrderBlotterSortingColumn>(),
                sortingOrder.ToType <SortingOrder>());

            return(new PaginatedResponseContract <OrderForOrderBlotterContract>(
                       contents: result.Contents.Select(Convert).ToList(),
                       start: result.Start,
                       size: result.Size,
                       totalSize: result.TotalSize));
        }