From 95af1f6f4d657ae695892db55b9db618148916b3 Mon Sep 17 00:00:00 2001 From: kayahasa Date: Fri, 4 Aug 2023 15:56:21 +0300 Subject: [PATCH 1/7] remove json ignore --- OKX.Api/Models/MarketData/OkxCandlestick.cs | 2 +- OKX.Api/OKXStreamClient.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/OKX.Api/Models/MarketData/OkxCandlestick.cs b/OKX.Api/Models/MarketData/OkxCandlestick.cs index 6945766..2f7ef3c 100644 --- a/OKX.Api/Models/MarketData/OkxCandlestick.cs +++ b/OKX.Api/Models/MarketData/OkxCandlestick.cs @@ -3,7 +3,7 @@ [JsonConverter(typeof(ArrayConverter))] public class OkxCandlestick { - [JsonIgnore] + [ArrayProperty(9)] public string Instrument { get; set; } [ArrayProperty(0), JsonConverter(typeof(DateTimeConverter))] diff --git a/OKX.Api/OKXStreamClient.cs b/OKX.Api/OKXStreamClient.cs index f93e886..23dd5e7 100644 --- a/OKX.Api/OKXStreamClient.cs +++ b/OKX.Api/OKXStreamClient.cs @@ -434,6 +434,7 @@ public virtual async Task> SubscribeToCandlestick foreach (var d in data.Data.Data) { if (instrumentIds.Count() == 1) d.Instrument = instrumentIds.FirstOrDefault(); + onData(d); } }); From 755cd46fd0c15bb7ba8616d7f02d46b07cb4c1ae Mon Sep 17 00:00:00 2001 From: kayahasa Date: Fri, 4 Aug 2023 17:38:57 +0300 Subject: [PATCH 2/7] fix instrument name issue --- OKX.Api/Models/MarketData/OkxCandlestick.cs | 2 +- OKX.Api/Models/MarketData/OkxCandlestickBase.cs | 11 +++++++++++ OKX.Api/Models/OkxSocketResponses.cs | 10 ++++++++++ OKX.Api/OKXStreamClient.cs | 10 ++++++++-- 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 OKX.Api/Models/MarketData/OkxCandlestickBase.cs diff --git a/OKX.Api/Models/MarketData/OkxCandlestick.cs b/OKX.Api/Models/MarketData/OkxCandlestick.cs index 2f7ef3c..6945766 100644 --- a/OKX.Api/Models/MarketData/OkxCandlestick.cs +++ b/OKX.Api/Models/MarketData/OkxCandlestick.cs @@ -3,7 +3,7 @@ [JsonConverter(typeof(ArrayConverter))] public class OkxCandlestick { - [ArrayProperty(9)] + [JsonIgnore] public string Instrument { get; set; } [ArrayProperty(0), JsonConverter(typeof(DateTimeConverter))] diff --git a/OKX.Api/Models/MarketData/OkxCandlestickBase.cs b/OKX.Api/Models/MarketData/OkxCandlestickBase.cs new file mode 100644 index 0000000..5ade50d --- /dev/null +++ b/OKX.Api/Models/MarketData/OkxCandlestickBase.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OKX.Api.Models.MarketData; +public class OkxCandlestickBase +{ + public string InstrumentId { get; set; } + public string InstId { get; set; } + public OkxCandlestick Data { get; set; } +} diff --git a/OKX.Api/Models/OkxSocketResponses.cs b/OKX.Api/Models/OkxSocketResponses.cs index e89f98e..3398a56 100644 --- a/OKX.Api/Models/OkxSocketResponses.cs +++ b/OKX.Api/Models/OkxSocketResponses.cs @@ -24,9 +24,19 @@ public bool Success public class OkxSocketUpdateResponse : OkxSocketResponse { + [JsonProperty("arg")] + public OkxSocketUpdateArgs Args { get; set; } [JsonProperty("data")] public T Data { get; set; } = default!; } +public class OkxSocketUpdateArgs +{ + [JsonProperty("channel")] + public string Channel { get; set; } + + [JsonProperty("instId")] + public string Instrument { get; set; } +} public class OkxOrderBookUpdate { diff --git a/OKX.Api/OKXStreamClient.cs b/OKX.Api/OKXStreamClient.cs index 23dd5e7..64cc8fb 100644 --- a/OKX.Api/OKXStreamClient.cs +++ b/OKX.Api/OKXStreamClient.cs @@ -433,8 +433,14 @@ public virtual async Task> SubscribeToCandlestick { foreach (var d in data.Data.Data) { - if (instrumentIds.Count() == 1) d.Instrument = instrumentIds.FirstOrDefault(); - + if (instrumentIds.Count() == 1) + { + d.Instrument = instrumentIds.FirstOrDefault(); + } + else + { + d.Instrument = data.Data.Args.Instrument; + } onData(d); } }); From b4d1ca860f72982e08d03982fc8be9ceb5b00c24 Mon Sep 17 00:00:00 2001 From: kayahasa Date: Fri, 4 Aug 2023 17:41:56 +0300 Subject: [PATCH 3/7] remove obsolote class --- OKX.Api/Models/MarketData/OkxCandlestickBase.cs | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 OKX.Api/Models/MarketData/OkxCandlestickBase.cs diff --git a/OKX.Api/Models/MarketData/OkxCandlestickBase.cs b/OKX.Api/Models/MarketData/OkxCandlestickBase.cs deleted file mode 100644 index 5ade50d..0000000 --- a/OKX.Api/Models/MarketData/OkxCandlestickBase.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OKX.Api.Models.MarketData; -public class OkxCandlestickBase -{ - public string InstrumentId { get; set; } - public string InstId { get; set; } - public OkxCandlestick Data { get; set; } -} From 100c947a4c49ad0626bfe8769f5e5b12401936e0 Mon Sep 17 00:00:00 2001 From: kayahasa Date: Sat, 5 Aug 2023 11:58:53 +0300 Subject: [PATCH 4/7] refactoring --- OKX.Api/Models/OkxSocketResponses.cs | 2 +- OKX.Api/OKX.Api.csproj | 8 ++++---- OKX.Api/OKXStreamClient.cs | 9 +-------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/OKX.Api/Models/OkxSocketResponses.cs b/OKX.Api/Models/OkxSocketResponses.cs index 3398a56..dfe76bb 100644 --- a/OKX.Api/Models/OkxSocketResponses.cs +++ b/OKX.Api/Models/OkxSocketResponses.cs @@ -25,7 +25,7 @@ public bool Success public class OkxSocketUpdateResponse : OkxSocketResponse { [JsonProperty("arg")] - public OkxSocketUpdateArgs Args { get; set; } + public OkxSocketUpdateArgs? Args { get; set; } [JsonProperty("data")] public T Data { get; set; } = default!; } diff --git a/OKX.Api/OKX.Api.csproj b/OKX.Api/OKX.Api.csproj index 497f6e1..133f18a 100644 --- a/OKX.Api/OKX.Api.csproj +++ b/OKX.Api/OKX.Api.csproj @@ -8,10 +8,10 @@ OKX.Api Burak Öner - 1.2.3 - 1.2.3 - 1.2.3 - 1.2.3 + 1.2.4 + 1.2.4 + 1.2.4 + 1.2.4 OKX V5 Api Wrapper. Up-to-date, most-complete, well-organized, well-documented, easy-to-use, multi-task and multi-thread compatible OKX Cryptocurrency Exchange Rest and Websocket Api Wrapper true OKX;OKEX;Binance;BNB;BTC;Api;Client;Rest;Web;Websocket;Socket;Wrapper;Crypto;Currency;Cryptocurrency;Exchange;Trade;Trading;Bitcoin;Spot;Margin;Futures;Derivates;Stock;Options;Swap; diff --git a/OKX.Api/OKXStreamClient.cs b/OKX.Api/OKXStreamClient.cs index 64cc8fb..93897f0 100644 --- a/OKX.Api/OKXStreamClient.cs +++ b/OKX.Api/OKXStreamClient.cs @@ -433,14 +433,7 @@ public virtual async Task> SubscribeToCandlestick { foreach (var d in data.Data.Data) { - if (instrumentIds.Count() == 1) - { - d.Instrument = instrumentIds.FirstOrDefault(); - } - else - { - d.Instrument = data.Data.Args.Instrument; - } + d.Instrument = data.Data.Args.Instrument; onData(d); } }); From 2a24751f021f9ced303f34a1f7838a9e30551ba6 Mon Sep 17 00:00:00 2001 From: kayahasa Date: Sat, 5 Aug 2023 12:00:14 +0300 Subject: [PATCH 5/7] add version text --- OKX.Api/OKX.Api.csproj | 89 ++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/OKX.Api/OKX.Api.csproj b/OKX.Api/OKX.Api.csproj index 133f18a..2ac2afa 100644 --- a/OKX.Api/OKX.Api.csproj +++ b/OKX.Api/OKX.Api.csproj @@ -19,49 +19,52 @@ en true - Version 1.2.3 - 03 Aug 2023 - * ApiSharp version updated to 1.4.1 - - Version 1.2.2 - 28 Jul 2023 - * Merged pull request https://github.com/burakoner/OKX.Api/pull/28 - - Version 1.2.1 - 28 Jul 2023 - * Synced with OKX Api 2023-07-26 version - * Added some other missing documentation symbols - * Merged pull request https://github.com/burakoner/OKX.Api/pull/25 - * Merged pull request https://github.com/burakoner/OKX.Api/pull/26 - * Merged pull request https://github.com/burakoner/OKX.Api/pull/27 - - Version 1.2.0 - 27 Jul 2023 - * Added documentation symbols - * Synced with OKX Api 2023-06-28 version - * Fixed issue at https://github.com/burakoner/OKX.Api/issues/21 - * Fixed issue at https://github.com/burakoner/OKX.Api/issues/21 - * Merged pull request https://github.com/burakoner/OKX.Api/pull/23 - * Merged pull request https://github.com/burakoner/OKX.Api/pull/24 - - Version 1.1.7 - 26 Jun 2023 - * It's possible to subscribe multiple symbols at once on WebSocket - * Fixed issue at https://github.com/burakoner/OKX.Api/issues/16 - - Version 1.1.6 - 26 Jun 2023 - * Updated All Methods and Models, synced with OKX Api 2023-06-20 version - * OKXStreamClient has some parameter and parameter order changes - * Fixed issue at https://github.com/burakoner/OKX.Api/issues/18 - * Fixed some typos - - Version 1.1.5 - 25 Jun 2023 - * Added Grid Trading section endpoints - * ApiSharp updated to v1.3.6 - * Fixed issue at https://github.com/burakoner/OKX.Api/issues/11 - - Version 1.1.0 - 07 May 2023 - * Updated All Methods and Models, synced with OKX Api 2023-04-27 version - - Version 1.0.6 - 06 May 2023 - * Updated WithdrawAsync Method (https://github.com/burakoner/OKEx.Net/issues/97) - * Updated GetInstrumentsAsync Method (https://github.com/burakoner/OKX.Api/issues/7) - + Version 1.2.4 - 04 Aug 2023 + * Multiple subscription to index candle instrument name issue solved. + + Version 1.2.3 - 03 Aug 2023 + * ApiSharp version updated to 1.4.1 + + Version 1.2.2 - 28 Jul 2023 + * Merged pull request https://github.com/burakoner/OKX.Api/pull/28 + + Version 1.2.1 - 28 Jul 2023 + * Synced with OKX Api 2023-07-26 version + * Added some other missing documentation symbols + * Merged pull request https://github.com/burakoner/OKX.Api/pull/25 + * Merged pull request https://github.com/burakoner/OKX.Api/pull/26 + * Merged pull request https://github.com/burakoner/OKX.Api/pull/27 + + Version 1.2.0 - 27 Jul 2023 + * Added documentation symbols + * Synced with OKX Api 2023-06-28 version + * Fixed issue at https://github.com/burakoner/OKX.Api/issues/21 + * Fixed issue at https://github.com/burakoner/OKX.Api/issues/21 + * Merged pull request https://github.com/burakoner/OKX.Api/pull/23 + * Merged pull request https://github.com/burakoner/OKX.Api/pull/24 + + Version 1.1.7 - 26 Jun 2023 + * It's possible to subscribe multiple symbols at once on WebSocket + * Fixed issue at https://github.com/burakoner/OKX.Api/issues/16 + + Version 1.1.6 - 26 Jun 2023 + * Updated All Methods and Models, synced with OKX Api 2023-06-20 version + * OKXStreamClient has some parameter and parameter order changes + * Fixed issue at https://github.com/burakoner/OKX.Api/issues/18 + * Fixed some typos + + Version 1.1.5 - 25 Jun 2023 + * Added Grid Trading section endpoints + * ApiSharp updated to v1.3.6 + * Fixed issue at https://github.com/burakoner/OKX.Api/issues/11 + + Version 1.1.0 - 07 May 2023 + * Updated All Methods and Models, synced with OKX Api 2023-04-27 version + + Version 1.0.6 - 06 May 2023 + * Updated WithdrawAsync Method (https://github.com/burakoner/OKEx.Net/issues/97) + * Updated GetInstrumentsAsync Method (https://github.com/burakoner/OKX.Api/issues/7) + OKX.png https://github.com/burakoner/OKX.Api From 1f02b464dff94e0ee3b23b28474cedd796ce4aba Mon Sep 17 00:00:00 2001 From: kayahasa Date: Sat, 5 Aug 2023 12:00:51 +0300 Subject: [PATCH 6/7] change release date --- OKX.Api/OKX.Api.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OKX.Api/OKX.Api.csproj b/OKX.Api/OKX.Api.csproj index 2ac2afa..387017a 100644 --- a/OKX.Api/OKX.Api.csproj +++ b/OKX.Api/OKX.Api.csproj @@ -19,7 +19,7 @@ en true - Version 1.2.4 - 04 Aug 2023 + Version 1.2.4 - 05 Aug 2023 * Multiple subscription to index candle instrument name issue solved. Version 1.2.3 - 03 Aug 2023 From 4d861cf1a24431d0024a80023eb56b6a226001d3 Mon Sep 17 00:00:00 2001 From: kayahasa Date: Sat, 5 Aug 2023 13:04:44 +0300 Subject: [PATCH 7/7] null propogate --- OKX.Api/OKXStreamClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OKX.Api/OKXStreamClient.cs b/OKX.Api/OKXStreamClient.cs index 93897f0..a840312 100644 --- a/OKX.Api/OKXStreamClient.cs +++ b/OKX.Api/OKXStreamClient.cs @@ -433,7 +433,7 @@ public virtual async Task> SubscribeToCandlestick { foreach (var d in data.Data.Data) { - d.Instrument = data.Data.Args.Instrument; + d.Instrument = data.Data.Args?.Instrument; onData(d); } });