@@ -14,16 +14,16 @@ public partial class ExchangeDigifinexAPI : ExchangeAPI
14
14
private string [ ] Urls =
15
15
{
16
16
"openapi.digifinex.com" ,
17
- "openapi.digifinex.vip" ,
17
+ "openapi.digifinex.vip" , // these other URLs don't work anymore
18
18
"openapi.digifinex.xyz" ,
19
19
} ;
20
20
21
21
private string fastestUrl = null ;
22
22
private int failedUrlCount ;
23
23
private int successUrlCount ;
24
24
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/" ;
27
27
private int websocketMessageId = 0 ;
28
28
private string timeWindow ;
29
29
private TaskCompletionSource < int > inited = new TaskCompletionSource < int > ( ) ;
@@ -40,30 +40,31 @@ private ExchangeDigifinexAPI()
40
40
}
41
41
42
42
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 ) ;
67
68
}
68
69
69
70
#region ProcessRequest
@@ -463,7 +464,8 @@ protected override async Task<IWebSocket> OnGetTradesWebSocketAsync(Func<KeyValu
463
464
}
464
465
else if ( marketSymbols == null || marketSymbols . Length == 0 )
465
466
{
466
- marketSymbols = ( await GetMarketSymbolsAsync ( ) ) . ToArray ( ) ;
467
+ marketSymbols = ( await GetMarketSymbolsAsync ( ) ) . Take ( 30 ) . ToArray ( ) ;
468
+ Logger . Warn ( "subscribing to the first 30 symbols" ) ;
467
469
}
468
470
return await ConnectPublicWebSocketAsync ( string . Empty , async ( _socket , msg ) =>
469
471
{
@@ -486,6 +488,7 @@ protected override async Task<IWebSocket> OnGetTradesWebSocketAsync(Func<KeyValu
486
488
// "id": null
487
489
// }
488
490
JToken token = JToken . Parse ( CryptoUtility . DecompressDeflate ( ( new ArraySegment < byte > ( msg , 2 , msg . Length - 2 ) ) . ToArray ( ) ) . ToStringFromUTF8 ( ) ) ;
491
+ // doesn't send error msgs - just disconnects
489
492
if ( token [ "method" ] . ToStringLowerInvariant ( ) == "trades.update" )
490
493
{
491
494
var args = token [ "params" ] ;
0 commit comments