@@ -14,16 +14,16 @@ public partial class ExchangeDigifinexAPI : ExchangeAPI
1414 private string [ ] Urls =
1515 {
1616 "openapi.digifinex.com" ,
17- "openapi.digifinex.vip" ,
17+ "openapi.digifinex.vip" , // these other URLs don't work anymore
1818 "openapi.digifinex.xyz" ,
1919 } ;
2020
2121 private string fastestUrl = null ;
2222 private int failedUrlCount ;
2323 private int successUrlCount ;
2424
25- public override string BaseUrl { get ; set ; } = "https://openapi.digifinex.vip /v3" ;
26- public override string BaseUrlWebSocket { get ; set ; } = "wss://openapi.digifinex.vip /ws/v1/" ;
25+ public override string BaseUrl { get ; set ; } = "https://openapi.digifinex.com /v3" ;
26+ public override string BaseUrlWebSocket { get ; set ; } = "wss://openapi.digifinex.com /ws/v1/" ;
2727 private int websocketMessageId = 0 ;
2828 private string timeWindow ;
2929 private TaskCompletionSource < int > inited = new TaskCompletionSource < int > ( ) ;
@@ -40,30 +40,31 @@ private ExchangeDigifinexAPI()
4040 }
4141
4242 private void GetFastestUrl ( )
43- {
44- var client = new HttpClient ( ) ;
45- foreach ( var url in Urls )
46- {
47- var u = url ;
48- client . GetAsync ( $ "https://{ u } ") . ContinueWith ( ( t ) =>
49- {
50- if ( t . Exception != null )
51- {
52- var count = Interlocked . Increment ( ref failedUrlCount ) ;
53- if ( count == Urls . Length )
54- inited . SetException ( new APIException ( "All digifinex URLs failed." ) ) ;
55- return ;
56- }
57- if ( Interlocked . Increment ( ref successUrlCount ) == 1 )
58- {
59- fastestUrl = u ;
60- //Console.WriteLine($"Fastest url {GetHashCode()}: {u}");
61- BaseUrl = $ "https://{ u } /v3";
62- BaseUrlWebSocket = $ "wss://{ u } /ws/v1/";
63- inited . SetResult ( 1 ) ;
64- }
65- } ) ;
66- }
43+ {
44+ //var client = new HttpClient();
45+ //foreach (var url in Urls)
46+ //{
47+ // var u = url;
48+ // client.GetAsync($"https://{u}").ContinueWith((t) =>
49+ // {
50+ // if (t.Exception != null)
51+ // {
52+ // var count = Interlocked.Increment(ref failedUrlCount);
53+ // if (count == Urls.Length)
54+ // inited.SetException(new APIException("All digifinex URLs failed."));
55+ // return;
56+ // }
57+ // if (Interlocked.Increment(ref successUrlCount) == 1)
58+ // {
59+ // fastestUrl = u;
60+ // //Console.WriteLine($"Fastest url {GetHashCode()}: {u}");
61+ // BaseUrl = $"https://{u}/v3";
62+ // BaseUrlWebSocket = $"wss://{u}/ws/v1/";
63+ // inited.SetResult(1);
64+ // }
65+ // });
66+ //}
67+ inited . SetResult ( 1 ) ;
6768 }
6869
6970 #region ProcessRequest
@@ -463,7 +464,8 @@ protected override async Task<IWebSocket> OnGetTradesWebSocketAsync(Func<KeyValu
463464 }
464465 else if ( marketSymbols == null || marketSymbols . Length == 0 )
465466 {
466- marketSymbols = ( await GetMarketSymbolsAsync ( ) ) . ToArray ( ) ;
467+ marketSymbols = ( await GetMarketSymbolsAsync ( ) ) . Take ( 30 ) . ToArray ( ) ;
468+ Logger . Warn ( "subscribing to the first 30 symbols" ) ;
467469 }
468470 return await ConnectPublicWebSocketAsync ( string . Empty , async ( _socket , msg ) =>
469471 {
@@ -486,6 +488,7 @@ protected override async Task<IWebSocket> OnGetTradesWebSocketAsync(Func<KeyValu
486488 // "id": null
487489 // }
488490 JToken token = JToken . Parse ( CryptoUtility . DecompressDeflate ( ( new ArraySegment < byte > ( msg , 2 , msg . Length - 2 ) ) . ToArray ( ) ) . ToStringFromUTF8 ( ) ) ;
491+ // doesn't send error msgs - just disconnects
489492 if ( token [ "method" ] . ToStringLowerInvariant ( ) == "trades.update" )
490493 {
491494 var args = token [ "params" ] ;
0 commit comments