public override async Task <GetOrderListResponse> GetActiveOrders(GetActiveOrdersRequest request, ServerCallContext context) { var pagination = GrpcMapper.EnsurePagination(request.Pagination); var data = await _ordersRepository.GetOrdersAsync( Guid.Parse(request.WalletId), new[] { Antares.Service.History.Core.Domain.Enums.OrderType.Limit, Antares.Service.History.Core.Domain.Enums.OrderType.StopLimit }, new[] { Antares.Service.History.Core.Domain.Enums.OrderStatus.Placed, Antares.Service.History.Core.Domain.Enums.OrderStatus.PartiallyMatched, Antares.Service.History.Core.Domain.Enums.OrderStatus.Pending }, request.AssetPairId, pagination.Offset, pagination.Limit); var items = data.Select(x => GrpcMapper.MapOrder(x)).ToArray(); return(new GetOrderListResponse() { Items = { items }, Pagination = new PaginatedInt32Response() { Count = items.Count(), Offset = pagination.Offset + items.Length, } }); }
public override async Task <GetTradesResponse> GetTradesByDates(GetTradesByDatesRequest request, ServerCallContext context) { var pagination = GrpcMapper.EnsurePagination(request.Pagination); var data = await _historyRecordsRepository.GetByDatesAsync( request.From.ToDateTime(), request.To.ToDateTime(), pagination.Offset, pagination.Limit); var items = data.Select(GrpcMapper.Map).ToArray(); return(new GetTradesResponse() { Pagination = new PaginatedInt32Response() { Count = items.Length, Offset = pagination.Offset + items.Length }, Items = { items } }); }
public override async Task <GetTradesResponse> GetTrades(GetTradesRequest request, ServerCallContext context) { var tradeType = request.TradeType; bool?onlyBuyTrades = null; if (tradeType == GrpcContract.Common.TradeType.Buy) { onlyBuyTrades = true; } if (tradeType == TradeType.Sell) { onlyBuyTrades = false; } var pagination = GrpcMapper.EnsurePagination(request.Pagination); var data = await _historyRecordsRepository .GetTradesByWalletAsync( Guid.Parse(request.WalletId), pagination.Offset, pagination.Limit, request.AssetPairId, request.AssetId, request.From?.ToDateTime(), request.To?.ToDateTime(), onlyBuyTrades); var items = data.Select(GrpcMapper.Map).ToArray(); return(new GetTradesResponse() { Pagination = new PaginatedInt32Response() { Count = items.Length, Offset = pagination.Offset + items.Length }, Items = { items } }); }