Attempting to place a USD Futures limit order with timeInForce set to GoodTillDate fails due to incorrect timestamp format. The error message indicates that the goodTillDate timestamp must be in milliseconds rather than seconds.
Steps to Reproduce:
Use the following code to place a USD Futures limit order:
var binanceRestClient = new BinanceRestClient(options => {
options.ApiCredentials = new ApiCredentials("KEY", "SECRET");
});
var goodTillDate = new DateTime(2024, 6, 24, 18, 0, 0);
var orderResult = await binanceRestClient.UsdFuturesApi.Trading.PlaceOrderAsync(
symbol: "USDCUSDT",
side: OrderSide.Buy,
type: FuturesOrderType.Limit,
quantity: 10m,
price: 0.9m,
timeInForce: TimeInForce.GoodTillDate,
goodTillDate: goodTillDate);
if (!orderResult.Success)
{
throw new Exception(orderResult?.Error?.Message);
}
Observe the error message received:
The goodTillDate timestamp must be greater than the current time plus 600 seconds and smaller than 253402300799000.
Check the request body sent in the orderResult object:
goodTillDate=1719252000
Place the same order via the Binance UI and check the request body sent in the network tab of the developer tools:
goodTillDate=1719252000448
Observed Behavior:
The goodTillDate timestamp is sent in seconds (goodTillDate=1719252000), which causes the order to fail.
Expected Behavior:
The goodTillDate timestamp should be sent in milliseconds (goodTillDate=1719252000448), as this format executes successfully via the Binance UI.
Attempting to place a USD Futures limit order with
timeInForce
set toGoodTillDate
fails due to incorrect timestamp format. The error message indicates that thegoodTillDate
timestamp must be in milliseconds rather than seconds.Steps to Reproduce:
Use the following code to place a USD Futures limit order:
Observe the error message received:
Check the request body sent in the
orderResult
object:Place the same order via the Binance UI and check the request body sent in the network tab of the developer tools:
Observed Behavior: The
goodTillDate
timestamp is sent in seconds (goodTillDate=1719252000
), which causes the order to fail.Expected Behavior: The
goodTillDate
timestamp should be sent in milliseconds (goodTillDate=1719252000448
), as this format executes successfully via the Binance UI.Additional Context:
goodTillDate
is passed as seconds in the following line:Proposed Solution: Change
AddOptionalSeconds
toAddOptionalMilliseconds
in the library code to send thegoodTillDate
timestamp in the correct format.References: