コード例 #1
0
        public async Task Buy(string coin, double price, double quantity)
        {
            // Convert to SAT.
            if (price > 1)
            {
                price = price / 100000000;
            }

            ConsoleHelpers.WriteColored($"\tWARNING: GOING TO BUY {quantity:0.00000000} {coin} at a rate of {price:0.00000000}, " +
                                        $"DO YOU WANT TO CONTINUE? (YES/NO) ", ConsoleColor.Yellow);

            if (Console.ReadLine()?.ToLower() == "yes")
            {
                var result = await _binanceApi.PlaceOrderAsync(coin.ToUpper() + "BTC", OrderSide.Buy, OrderType.Limit,
                                                               TimeInForce.GoodTillCancel, (decimal)quantity, (decimal)price);

                ConsoleHelpers.WriteColoredLine("\tBuy order placed.", ConsoleColor.Green);
            }
            else
            {
                ConsoleHelpers.WriteColoredLine("\tBuy cancelled.", ConsoleColor.Red);
            }
        }