diff --git a/src/ExchangeSharp/API/Exchanges/Digifinex/ExchangeDigifinexAPI.cs b/src/ExchangeSharp/API/Exchanges/Digifinex/ExchangeDigifinexAPI.cs index b76e915d..e6c541be 100644 --- a/src/ExchangeSharp/API/Exchanges/Digifinex/ExchangeDigifinexAPI.cs +++ b/src/ExchangeSharp/API/Exchanges/Digifinex/ExchangeDigifinexAPI.cs @@ -14,7 +14,7 @@ public partial class ExchangeDigifinexAPI : ExchangeAPI private string[] Urls = { "openapi.digifinex.com", - "openapi.digifinex.vip", + "openapi.digifinex.vip", // these other URLs don't work anymore "openapi.digifinex.xyz", }; @@ -22,8 +22,8 @@ public partial class ExchangeDigifinexAPI : ExchangeAPI private int failedUrlCount; private int successUrlCount; - public override string BaseUrl { get; set; } = "https://openapi.digifinex.vip/v3"; - public override string BaseUrlWebSocket { get; set; } = "wss://openapi.digifinex.vip/ws/v1/"; + public override string BaseUrl { get; set; } = "https://openapi.digifinex.com/v3"; + public override string BaseUrlWebSocket { get; set; } = "wss://openapi.digifinex.com/ws/v1/"; private int websocketMessageId = 0; private string timeWindow; private TaskCompletionSource inited = new TaskCompletionSource(); @@ -40,30 +40,31 @@ private ExchangeDigifinexAPI() } private void GetFastestUrl() - { - var client = new HttpClient(); - foreach (var url in Urls) - { - var u = url; - client.GetAsync($"https://{u}").ContinueWith((t) => - { - if (t.Exception != null) - { - var count = Interlocked.Increment(ref failedUrlCount); - if (count == Urls.Length) - inited.SetException(new APIException("All digifinex URLs failed.")); - return; - } - if (Interlocked.Increment(ref successUrlCount) == 1) - { - fastestUrl = u; - //Console.WriteLine($"Fastest url {GetHashCode()}: {u}"); - BaseUrl = $"https://{u}/v3"; - BaseUrlWebSocket = $"wss://{u}/ws/v1/"; - inited.SetResult(1); - } - }); - } + { + //var client = new HttpClient(); + //foreach (var url in Urls) + //{ + // var u = url; + // client.GetAsync($"https://{u}").ContinueWith((t) => + // { + // if (t.Exception != null) + // { + // var count = Interlocked.Increment(ref failedUrlCount); + // if (count == Urls.Length) + // inited.SetException(new APIException("All digifinex URLs failed.")); + // return; + // } + // if (Interlocked.Increment(ref successUrlCount) == 1) + // { + // fastestUrl = u; + // //Console.WriteLine($"Fastest url {GetHashCode()}: {u}"); + // BaseUrl = $"https://{u}/v3"; + // BaseUrlWebSocket = $"wss://{u}/ws/v1/"; + // inited.SetResult(1); + // } + // }); + //} + inited.SetResult(1); } #region ProcessRequest @@ -463,7 +464,8 @@ protected override async Task OnGetTradesWebSocketAsync(Func { @@ -486,6 +488,7 @@ protected override async Task OnGetTradesWebSocketAsync(Func(msg, 2, msg.Length - 2)).ToArray()).ToStringFromUTF8()); + // doesn't send error msgs - just disconnects if (token["method"].ToStringLowerInvariant() == "trades.update") { var args = token["params"];