コード例 #1
0
        public async Task AddOrderAsync(LimitOrder limitOrder)
        {
            await SynchronizeAsync(async() =>
            {
                var trader = await _orderBookTraderService.GetTraderByAssetPairIdAsync(limitOrder.AssetPairId);

                if (trader == null)
                {
                    _log.Warning("Can't add order, no such trader", context: $"order: {limitOrder.ToJson()}");
                    return;
                }

                limitOrder = trader.AddOrderManually(limitOrder);

                //await ApplySingleOrderAsync(limitOrder, trader.GetOrders());
                await ApplyOrdersAsync(limitOrder.AssetPairId, trader.GetOrders(), trader.CountInMarket);

                await _limitOrderService.AddAsync(limitOrder);
            });
        }