public async Task <IActionResult> CreateAsync([FromBody] LimitOrderCreateModel model)
        {
            var result = await _matchingEngineClient.Trading.CreateLimitOrderAsync(
                new MatchingEngine.Client.Models.Trading.LimitOrderRequestModel
            {
                Id          = Guid.NewGuid(),
                AssetPairId = model.AssetPairId,
                Price       = model.Price,
                Volume      = model.Type == LimitOrderType.Sell
                        ? -model.Volume
                        : model.Volume,
                WalletId = model.WalletId,
                CancelAllPreviousLimitOrders = model.CancelPrevious,
                Timestamp = DateTime.UtcNow
            });

            var response = new LimitOrderResponseModel {
                Id = result.Id, Status = result.Status, Reason = result.Reason
            };

            return(Ok(response));
        }
        public async Task <OperationResponse> CreateAsync(string brokerId, LimitOrderCreateModel model)
        {
            var wallet = await _accountsClient.Wallet.GetAsync((long)model.WalletId, brokerId);

            if (wallet == null)
            {
                throw new ArgumentException($"Wallet '{model.WalletId}' does not exist.");
            }

            if (!wallet.IsEnabled)
            {
                throw new ArgumentException($"Wallet '{model.WalletId}' is disabled.");
            }

            var request = new LimitOrder
            {
                Id          = model.Id.HasValue ? model.Id.Value.ToString() : Guid.NewGuid().ToString(),
                BrokerId    = brokerId,
                AccountId   = model.AccountId,
                WalletId    = model.WalletId,
                AssetPairId = model.AssetPair,
                CancelAllPreviousLimitOrders = model.CancelPrevious,
                Price     = model.Price.ToString(CultureInfo.InvariantCulture),
                Volume    = model.Volume.ToString(CultureInfo.InvariantCulture),
                Type      = model.Type == LimitOrderType.StopLimit ? LimitOrder.Types.LimitOrderType.StopLimit : LimitOrder.Types.LimitOrderType.Limit,
                Timestamp = Timestamp.FromDateTime(DateTime.UtcNow)
            };

            var limitOrderFee = await GetFee(brokerId, model.AssetPair);

            request.Fees.Add(limitOrderFee);

            var response = await _matchingEngineClient.Trading.CreateLimitOrderAsync(request);

            var result = new OperationResponse(response);

            return(result);
        }
        public async Task <IActionResult> CreateAsync([FromBody] LimitOrderCreateModel model)
        {
            var result = await _limitOrderOperations.CreateAsync(User.GetTenantId(), model);

            return(Ok(result));
        }