Ejemplo n.º 1
0
 public OrderParams(EOrderSide side, EOrderType type, ETimeInForce tif, decimal amount_base, decimal?price_q2b, decimal?stop_price)
 {
     Side              = side;
     Type              = type;
     TimeInForce       = tif;
     AmountBase        = amount_base;
     PriceQ2B          = price_q2b;
     StopPriceQ2B      = stop_price;
     IcebergAmountBase = null;
 }
Ejemplo n.º 2
0
        public static string ToString(EOrderSide order_type)
        {
            switch (order_type)
            {
            default: throw new Exception($"Unknown order type: {order_type}");

            case EOrderSide.Buy: return("buylimit");

            case EOrderSide.Sell: return("selllimit");
            }
        }
Ejemplo n.º 3
0
        public static string ToString(EOrderSide order_type)
        {
            switch (order_type)
            {
            default: throw new ArgumentException("order_type");

            case EOrderSide.Buy: return("buy");

            case EOrderSide.Sell: return("sell");
            }
        }
Ejemplo n.º 4
0
        /// <summary>Create an order to buy/sell. Returns a unique order ID</summary>
        public async Task <TradeResult> SubmitTrade(CurrencyPair pair, EOrderSide type, decimal price_q2b, decimal amount_base, CancellationToken?cancel = null)
        {
            var jtok = await PostData(Method.Account, Conv.ToString(type), cancel, new Params
            {
                { "currencyPair", pair.Id },
                { "rate", price_q2b },
                { "amount", amount_base },
            });

            return(ParseJsonReply <TradeResult>(jtok));
        }
Ejemplo n.º 5
0
        /// <summary>Create an order to buy/sell. Returns a unique order ID</summary>
        public async Task <TradeResult> SubmitTrade(CurrencyPair pair, EOrderSide type, decimal price_q2b, decimal amount_base, CancellationToken?cancel = null)
        {
            // https://api.bittrex.com/api/v1.1/market/selllimit?apikey=API_KEY&market=BTC-LTC&quantity=1.2&rate=1.3
            // https://api.bittrex.com/api/v1.1/market/buylimit?apikey=API_KEY&market=BTC-LTC&quantity=1.2&rate=1.3
            var jtok = await GetData(Method.Market, Conv.ToString(type), cancel, new Params
            {
                { "market", pair.Id },
                { "rate", price_q2b },
                { "quantity", amount_base },
            });

            return(ParseJsonReply <TradeResult>(jtok));
        }
Ejemplo n.º 6
0
        /// <summary></summary>
        private static List <Offer> ParseOffers(List <string[]> offers, EOrderSide order_type)
        {
            var output = new List <Offer>(offers.Count);

            foreach (var order in offers)
            {
                output.Add(new Offer(
                               order_type,
                               decimal.Parse(order[0], CultureInfo.InvariantCulture),
                               decimal.Parse(order[1], CultureInfo.InvariantCulture)));
            }
            return(output);
        }
Ejemplo n.º 7
0
        public static long ToOrderSide(EOrderSide orderSide)
        {
            switch (orderSide)
            {
            case EOrderSide.Buy:
                return(Buy);

            case EOrderSide.Sell:
                return(Sell);

            default:
                throw new BinanceDexException($"Unhandled orderSide: {orderSide}");
            }
        }
Ejemplo n.º 8
0
 internal Order(EOrderSide order_type, decimal price, decimal volume)
 {
     Type       = order_type;
     PriceQ2B   = price;
     AmountBase = volume;
 }
Ejemplo n.º 9
0
 internal Offer(EOrderSide type, decimal price, decimal volume)
 {
     Type       = type;
     Price      = price;
     AmountBase = volume;
 }
Ejemplo n.º 10
0
 public OrderParams(EOrderSide side, EOrderType type, ETimeInForce tif = ETimeInForce.GTC)
     : this(side, type, tif, 0, null, null)
 {
 }