Exemple #1
0
        private async void SendClientOrder(Interface.OrderSide orderSide)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(selectedOrderType))
                {
                    throw new Exception("Order not valid: No order type.");
                }

                var clientOrder = new Interface.ClientOrder
                {
                    Symbol              = SelectedSymbol?.Name,
                    Type                = SelectedOrderType.GetOrderType(),
                    Side                = orderSide,
                    Quantity            = Quantity,
                    Price               = Price,
                    StopPrice           = StopPrice,
                    BaseAccountBalance  = BaseAccountBalance?.GetInterfaceAccountBalance(),
                    QuoteAccountBalance = QuoteAccountBalance?.GetInterfaceAccountBalance()
                };

                SelectedSymbol.GetInterfaceSymbol().ValidateClientOrder(clientOrder);

                await ExchangeService.PlaceOrder(Account.AccountInfo.User, clientOrder).ConfigureAwait(false);
            }
            catch (Exception e)
            {
                OnException("TradeViewModel.SendClientOrder", e);
            }
        }
        public async Task <Interface.Order> PlaceOrder(Interface.User user, Interface.ClientOrder clientOrder, long recWindow = 0, CancellationToken cancellationToken = default(CancellationToken))
        {
            var result = await exchangeService.PlaceOrder(user, clientOrder, recWindow, cancellationToken).ConfigureAwait(false);

            return(result);
        }