Ejemplo n.º 1
0
        private async Task SendClientOrder(Core.Model.OrderSide orderSide)
        {
            try
            {
                var clientOrder = new Core.Model.ClientOrder
                {
                    Symbol              = SelectedSymbol?.ExchangeSymbol,
                    Type                = SelectedOrderType.GetOrderType(),
                    Side                = orderSide,
                    Quantity            = Quantity,
                    Price               = Price,
                    StopPrice           = StopPrice,
                    BaseAccountBalance  = BaseAccountBalance?.GetCoreAccountBalance(),
                    QuoteAccountBalance = QuoteAccountBalance?.GetCoreAccountBalance()
                };

                SelectedSymbol.GetCoreSymbol().ValidateClientOrder(clientOrder);

                await ExchangeService.PlaceOrder(Account.AccountInfo.User.Exchange, Account.AccountInfo.User, clientOrder).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                OnException($"{nameof(TradePanelViewModel)} - {ex.Message}", ex);
            }
        }
Ejemplo n.º 2
0
        private async Task SendClientOrder(Core.Model.OrderSide orderSide)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(selectedOrderType))
                {
                    throw new Exception("Order not valid: No order type.");
                }

                var clientOrder = new Core.Model.ClientOrder
                {
                    Symbol              = SelectedSymbol?.ExchangeSymbol,
                    Type                = SelectedOrderType.GetOrderType(),
                    Side                = orderSide,
                    Quantity            = Quantity,
                    Price               = Price,
                    StopPrice           = StopPrice,
                    BaseAccountBalance  = BaseAccountBalance?.GetCoreAccountBalance(),
                    QuoteAccountBalance = QuoteAccountBalance?.GetCoreAccountBalance()
                };

                SelectedSymbol.GetCoreSymbol().ValidateClientOrder(clientOrder);

                await ExchangeService.PlaceOrder(Account.AccountInfo.User.Exchange, Account.AccountInfo.User, clientOrder).ConfigureAwait(false);
            }
            catch (Exception e)
            {
                OnException("TradeViewModel.SendClientOrder", e);
            }
        }