コード例 #1
0
        Task <Order> IOrdersEndpoint.PlaceStopOrderAsync(
            OrderSide side,
            string productId, decimal amount, AmountType amountType, decimal stopPrice,
            Guid?clientOid,
            CancellationToken cancellationToken)
        {
            var mo = new CreateMarketOrder
            {
                Side      = side,
                ProductId = productId,
                Type      = OrderType.Market,
                StopPrice = stopPrice,
                ClientOid = clientOid
            };

            if (amountType == AmountType.UseFunds)
            {
                mo.Funds = amount;
            }
            else if (amountType == AmountType.UseSize)
            {
                mo.Size = amount;
            }

            if (side == OrderSide.Buy)
            {
                mo.Stop = StopType.Entry;
            }
            else if (side == OrderSide.Sell)
            {
                mo.Stop = StopType.Loss;
            }

            return(this.Orders.PlaceOrderAsync(mo, cancellationToken));
        }
コード例 #2
0
        Task <Order> IOrdersEndpoint.PlaceMarketOrderAsync(
            OrderSide side,
            string productId, decimal amount, AmountType amountType,
            Guid?clientOid,
            CancellationToken cancellationToken)
        {
            var mo = new CreateMarketOrder()
            {
                Side      = side,
                ProductId = productId,
                Type      = OrderType.Market,
                ClientOid = clientOid,
            };

            if (amountType == AmountType.UseSize)
            {
                mo.Size = amount;
            }
            else if (amountType == AmountType.UseFunds)
            {
                mo.Funds = amount;
            }

            return(this.Orders.PlaceOrderAsync(mo, cancellationToken));
        }