@@ -13,7 +13,7 @@ public class APIWrapper
13
13
/// <summary>
14
14
/// API Version compatible with.
15
15
/// </summary>
16
- public readonly static string API_VERSION_COMPATIBLE = "1.2.0 " ;
16
+ public readonly static string API_VERSION_COMPATIBLE = "1.2.2 " ;
17
17
18
18
/// <summary>
19
19
/// URLs for NiceHash services.
@@ -23,27 +23,42 @@ public class APIWrapper
23
23
/// <summary>
24
24
/// Names for NiceHash services.
25
25
/// </summary>
26
- public readonly static string [ ] SERVICE_NAME = { "Europe (NiceHash)" , " USA (WestHash)" } ;
26
+ public readonly static string [ ] SERVICE_NAME = { "Europe (NiceHash)" , "USA (WestHash)" } ;
27
27
28
28
/// <summary>
29
29
/// Names for algorithms.
30
30
/// </summary>
31
- public readonly static string [ ] ALGORITHM_NAME = { "Scrypt" , "SHA256" , "Scrypt-A.-Nf." , "X11" , "X13" , "Keccak" , "X15" , "Nist5" , "NeoScrypt" , "Lyra2RE" , "WhirlpoolX" , "Qubit" , "Quark" } ;
31
+ public static string [ ] ALGORITHM_NAME ;
32
32
33
33
/// <summary>
34
34
/// Total number of algorithms.
35
35
/// </summary>
36
- public readonly static int NUMBER_OF_ALGORITHMS = ALGORITHM_NAME . Length ;
36
+ public static int NUMBER_OF_ALGORITHMS ;
37
37
38
38
/// <summary>
39
39
/// Price decrease steps for all algorithms.
40
40
/// </summary>
41
- public readonly static double [ ] PRICE_DECREASE_STEP = { - 0.001 , - 0.0001 , - 0.002 , - 0.001 , - 0.001 , - 0.0001 , - 0.001 , - 0.001 , - 0.01 , - 0.002 , - 0.0001 , - 0.0005 , - 0.001 } ;
41
+ public static double [ ] PRICE_DECREASE_STEP ;
42
42
43
43
/// <summary>
44
- /// Price decrase interval - it is 10 minutes .
44
+ /// Minimal speed limit for order .
45
45
/// </summary>
46
- public readonly static TimeSpan PRICE_DECREASE_INTERVAL = new TimeSpan ( 0 , 10 , 1 ) ;
46
+ public static double [ ] MINIMAL_LIMIT ;
47
+
48
+ /// <summary>
49
+ /// Algorithm multiplier used for limit (to get GH/s speed).
50
+ /// </summary>
51
+ public static double [ ] ALGORITHM_MULTIPLIER ;
52
+
53
+ /// <summary>
54
+ /// Algorithm speed text.
55
+ /// </summary>
56
+ public static string [ ] SPEED_TEXT ;
57
+
58
+ /// <summary>
59
+ /// Price decrase interval.
60
+ /// </summary>
61
+ public static TimeSpan PRICE_DECREASE_INTERVAL ;
47
62
48
63
/// <summary>
49
64
/// API ID.
@@ -70,8 +85,8 @@ public class APIWrapper
70
85
#region PRIVATE_PROPERTIES
71
86
72
87
private static object CacheLock = new object ( ) ;
73
- private static CachedOrderList [ , ] CachedOList = new CachedOrderList [ SERVICE_LOCATION . Length , NUMBER_OF_ALGORITHMS ] ;
74
- private static CachedStats [ , ] CachedSList = new CachedStats [ SERVICE_LOCATION . Length , NUMBER_OF_ALGORITHMS ] ;
88
+ private static CachedOrderList [ , ] CachedOList ;
89
+ private static CachedStats [ , ] CachedSList ;
75
90
76
91
#endregion
77
92
@@ -120,7 +135,38 @@ public static bool Initialize(string ID, string Key)
120
135
121
136
LibConsole . WriteLine ( LibConsole . TEXT_TYPE . INFO , "Provided ID and Key are correct!" ) ;
122
137
138
+
139
+ Result < APIBuyInfo > R = Request < Result < APIBuyInfo > > ( 0 , "buy.info" , false , null ) ;
140
+ if ( R == null )
141
+ {
142
+ LibConsole . WriteLine ( LibConsole . TEXT_TYPE . ERROR , "Unable to get buy information. Service unavailable." ) ;
143
+ return false ;
144
+ }
145
+
146
+ PRICE_DECREASE_INTERVAL = new TimeSpan ( 0 , 0 , R . Data . DownStepTime ) ;
147
+ ALGORITHM_NAME = new string [ R . Data . Algorithms . Length ] ;
148
+ PRICE_DECREASE_STEP = new double [ R . Data . Algorithms . Length ] ;
149
+ ALGORITHM_MULTIPLIER = new double [ R . Data . Algorithms . Length ] ;
150
+ MINIMAL_LIMIT = new double [ R . Data . Algorithms . Length ] ;
151
+ SPEED_TEXT = new string [ R . Data . Algorithms . Length ] ;
152
+ for ( int i = 0 ; i < R . Data . Algorithms . Length ; i ++ )
153
+ {
154
+ ALGORITHM_NAME [ i ] = R . Data . Algorithms [ i ] . Name ;
155
+ PRICE_DECREASE_STEP [ i ] = R . Data . Algorithms [ i ] . PriceDownStep ;
156
+ ALGORITHM_MULTIPLIER [ i ] = R . Data . Algorithms [ i ] . Multiplier ;
157
+ MINIMAL_LIMIT [ i ] = R . Data . Algorithms [ i ] . MinimalLimit ;
158
+ SPEED_TEXT [ i ] = R . Data . Algorithms [ i ] . SpeedText ;
159
+ }
160
+
161
+ NUMBER_OF_ALGORITHMS = ALGORITHM_NAME . Length ;
162
+
163
+ CachedOList = new CachedOrderList [ SERVICE_LOCATION . Length , NUMBER_OF_ALGORITHMS ] ;
164
+ CachedSList = new CachedStats [ SERVICE_LOCATION . Length , NUMBER_OF_ALGORITHMS ] ;
165
+
166
+ LibConsole . WriteLine ( LibConsole . TEXT_TYPE . INFO , "Buy information loaded." ) ;
167
+
123
168
ValidAuthorization = true ;
169
+
124
170
return true ;
125
171
}
126
172
0 commit comments