diff --git a/src/Binance/Account/Orders/LimitMakerOrder.cs b/src/Binance/Account/Orders/LimitMakerOrder.cs index 610c67b7..35dfc498 100644 --- a/src/Binance/Account/Orders/LimitMakerOrder.cs +++ b/src/Binance/Account/Orders/LimitMakerOrder.cs @@ -1,4 +1,5 @@ -using Binance.Api; +using System; +using Binance.Api; namespace Binance.Account.Orders { @@ -8,6 +9,16 @@ public sealed class LimitMakerOrder : LimitOrder public override OrderType Type => OrderType.LimitMaker; + public override TimeInForce TimeInForce + { + get => TimeInForce.GTC; + set + { + if (value != TimeInForce.GTC) + throw new ArgumentException($"{nameof(TimeInForce)} must be {TimeInForce.GTC}."); + } + } + #endregion Public Properties #region Constructors diff --git a/src/Binance/Account/Orders/LimitOrder.cs b/src/Binance/Account/Orders/LimitOrder.cs index be05658b..ff38cf8f 100644 --- a/src/Binance/Account/Orders/LimitOrder.cs +++ b/src/Binance/Account/Orders/LimitOrder.cs @@ -14,17 +14,17 @@ public class LimitOrder : ClientOrder /// /// Get or set the price. /// - public decimal Price { get; set; } + public virtual decimal Price { get; set; } /// /// Get or set the iceberg quantity. /// - public decimal IcebergQuantity { get; set; } + public virtual decimal IcebergQuantity { get; set; } /// /// Get or set the time in force. /// - public TimeInForce TimeInForce { get; set; } + public virtual TimeInForce TimeInForce { get; set; } #endregion Public Properties diff --git a/src/Binance/Api/BinanceApi.cs b/src/Binance/Api/BinanceApi.cs index 5bd89bba..44184831 100644 --- a/src/Binance/Api/BinanceApi.cs +++ b/src/Binance/Api/BinanceApi.cs @@ -374,7 +374,7 @@ public virtual async Task PlaceAsync(ClientOrder clientOrder, long recvWi // Place the order. var json = await HttpClient.PlaceOrderAsync(clientOrder.User, clientOrder.Symbol, clientOrder.Side, clientOrder.Type, - clientOrder.Quantity, limitOrder?.Price ?? 0, clientOrder.Id, limitOrder?.TimeInForce, + clientOrder.Quantity, limitOrder?.Price ?? 0, clientOrder.Id, clientOrder.Type == OrderType.LimitMaker ? null : limitOrder?.TimeInForce, stopOrder?.StopPrice ?? 0, limitOrder?.IcebergQuantity ?? 0, recvWindow, false, PlaceOrderResponseType.Result, token); try @@ -402,7 +402,7 @@ public virtual async Task TestPlaceAsync(ClientOrder clientOrder, long recvWindo // Place the TEST order. var json = await HttpClient.PlaceOrderAsync(clientOrder.User, clientOrder.Symbol, clientOrder.Side, clientOrder.Type, - clientOrder.Quantity, limitOrder?.Price ?? 0, clientOrder.Id, limitOrder?.TimeInForce, + clientOrder.Quantity, limitOrder?.Price ?? 0, clientOrder.Id, clientOrder.Type == OrderType.LimitMaker ? null : limitOrder?.TimeInForce, stopOrder?.StopPrice ?? 0, limitOrder?.IcebergQuantity ?? 0, recvWindow, true, token: token); if (json != SuccessfulTestResponse) diff --git a/test/Binance.Tests/Integration/BinanceHttpClientTest.cs b/test/Binance.Tests/Integration/BinanceHttpClientTest.cs index 7cfeaddd..29335512 100644 --- a/test/Binance.Tests/Integration/BinanceHttpClientTest.cs +++ b/test/Binance.Tests/Integration/BinanceHttpClientTest.cs @@ -90,11 +90,15 @@ public async Task Get24HourStatistics() } [Fact] - public async Task GetPrices() + public async Task GetPrice() { - var json = await _api.GetPricesAsync(); + var json = await _api.GetPriceAsync(); Assert.True(IsJsonArray(json)); + + json = await _api.GetPriceAsync(Symbol.BTC_USDT); + + Assert.True(IsJsonObject(json)); } [Fact]