diff --git a/Kucoin.Net/Converters/NextFundingRateTimeConverter.cs b/Kucoin.Net/Converters/NextFundingRateTimeConverter.cs
new file mode 100644
index 00000000..4271ef21
--- /dev/null
+++ b/Kucoin.Net/Converters/NextFundingRateTimeConverter.cs
@@ -0,0 +1,41 @@
+using System;
+using Newtonsoft.Json;
+
+namespace Kucoin.Net.Converters
+{
+ ///
+ /// Does basically the same thing as the shared DateTimeConverter, with a slight difference.
+ /// Instead of adding the time to Jan 01 1970, it adds it to the current time. This isn't ideal since
+ /// it produces inaccuracies, but it's the format the kucoin api returns for the next funding rate time.
+ ///
+ internal class NextFundingRateTimeConverter : JsonConverter
+ {
+ public override DateTime? ReadJson(
+ JsonReader reader,
+ Type objectType,
+ DateTime? existingValue,
+ bool hasExistingValue,
+ JsonSerializer serializer
+ )
+ {
+ if (reader.Value == null)
+ {
+ return null;
+ }
+
+ var value = (long)reader.Value;
+ var now = DateTime.UtcNow;
+ var offset = TimeSpan.FromMilliseconds(value);
+ return now + offset;
+ }
+
+ public override void WriteJson(
+ JsonWriter writer,
+ DateTime? value,
+ JsonSerializer serializer
+ )
+ {
+ throw new NotSupportedException("This converter only supports reading");
+ }
+ }
+}
diff --git a/Kucoin.Net/Kucoin.Net.xml b/Kucoin.Net/Kucoin.Net.xml
index 1517060d..6b41cba2 100644
--- a/Kucoin.Net/Kucoin.Net.xml
+++ b/Kucoin.Net/Kucoin.Net.xml
@@ -742,6 +742,13 @@
+
+
+ Does basically the same thing as the shared DateTimeConverter, with a slight difference.
+ Instead of adding the time to Jan 01 1970, it adds it to the current time. This isn't ideal since
+ it produces inaccuracies, but it's the format the kucoin api returns for the next funding rate time.
+
+
Direction
@@ -4324,7 +4331,9 @@
- Next funding rate time
+ Next funding rate time. This time may not be accurate up to a couple of seconds.
+ This is due to the fact that the API returns this value as an offset from the current time,
+ but we have no way of knowing the exact time the API returned this value.
diff --git a/Kucoin.Net/Objects/Models/Futures/KucoinContract.cs b/Kucoin.Net/Objects/Models/Futures/KucoinContract.cs
index 14eca7f8..55a4fd74 100644
--- a/Kucoin.Net/Objects/Models/Futures/KucoinContract.cs
+++ b/Kucoin.Net/Objects/Models/Futures/KucoinContract.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using CryptoExchange.Net.Converters;
+using Kucoin.Net.Converters;
using Newtonsoft.Json;
namespace Kucoin.Net.Objects.Models.Futures
@@ -206,9 +207,11 @@ public class KucoinContract
///
public decimal? PredictedFundingFeeRate { get; set; }
///
- /// Next funding rate time
+ /// Next funding rate time. This time may not be accurate up to a couple of seconds.
+ /// This is due to the fact that the API returns this value as an offset from the current time,
+ /// but we have no way of knowing the exact time the API returned this value.
///
- [JsonConverter(typeof(DateTimeConverter))]
+ [JsonConverter(typeof(NextFundingRateTimeConverter))]
public DateTime? NextFundingRateTime { get; set; }
///
/// Source exchanges
@@ -243,4 +246,4 @@ public class KucoinContract
///
public string? FundingQuoteSymbol1M { get; set; }
}
-}
+}
\ No newline at end of file