示例#1
0
        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,
                }
            });
        }
示例#2
0
        public override async Task <GetOrderResponse> GetOrder(GetOrderRequest request, ServerCallContext context)
        {
            var order = await _ordersRepository.GetAsync(Guid.Parse(request.Id));

            return(new GetOrderResponse()
            {
                Item = GrpcMapper.MapOrder(order)
            });
        }