Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvister committed Dec 12, 2017
1 parent 560fd52 commit 11b35e6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
13 changes: 12 additions & 1 deletion src/Binance/Account/Orders/LimitMakerOrder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Binance.Api;
using System;
using Binance.Api;

namespace Binance.Account.Orders
{
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/Binance/Account/Orders/LimitOrder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ public class LimitOrder : ClientOrder
/// <summary>
/// Get or set the price.
/// </summary>
public decimal Price { get; set; }
public virtual decimal Price { get; set; }

/// <summary>
/// Get or set the iceberg quantity.
/// </summary>
public decimal IcebergQuantity { get; set; }
public virtual decimal IcebergQuantity { get; set; }

/// <summary>
/// Get or set the time in force.
/// </summary>
public TimeInForce TimeInForce { get; set; }
public virtual TimeInForce TimeInForce { get; set; }

#endregion Public Properties

Expand Down
4 changes: 2 additions & 2 deletions src/Binance/Api/BinanceApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public virtual async Task<Order> 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
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 6 additions & 2 deletions test/Binance.Tests/Integration/BinanceHttpClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 11b35e6

Please sign in to comment.