@@ -13,7 +13,7 @@ public class APIWrapper
1313 /// <summary>
1414 /// API Version compatible with.
1515 /// </summary>
16- public readonly static string API_VERSION_COMPATIBLE = "1.2.0 " ;
16+ public readonly static string API_VERSION_COMPATIBLE = "1.2.2 " ;
1717
1818 /// <summary>
1919 /// URLs for NiceHash services.
@@ -23,27 +23,42 @@ public class APIWrapper
2323 /// <summary>
2424 /// Names for NiceHash services.
2525 /// </summary>
26- public readonly static string [ ] SERVICE_NAME = { "Europe (NiceHash)" , " USA (WestHash)" } ;
26+ public readonly static string [ ] SERVICE_NAME = { "Europe (NiceHash)" , "USA (WestHash)" } ;
2727
2828 /// <summary>
2929 /// Names for algorithms.
3030 /// </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 ;
3232
3333 /// <summary>
3434 /// Total number of algorithms.
3535 /// </summary>
36- public readonly static int NUMBER_OF_ALGORITHMS = ALGORITHM_NAME . Length ;
36+ public static int NUMBER_OF_ALGORITHMS ;
3737
3838 /// <summary>
3939 /// Price decrease steps for all algorithms.
4040 /// </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 ;
4242
4343 /// <summary>
44- /// Price decrase interval - it is 10 minutes .
44+ /// Minimal speed limit for order .
4545 /// </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 ;
4762
4863 /// <summary>
4964 /// API ID.
@@ -70,8 +85,8 @@ public class APIWrapper
7085 #region PRIVATE_PROPERTIES
7186
7287 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 ;
7590
7691 #endregion
7792
@@ -120,7 +135,38 @@ public static bool Initialize(string ID, string Key)
120135
121136 LibConsole . WriteLine ( LibConsole . TEXT_TYPE . INFO , "Provided ID and Key are correct!" ) ;
122137
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+
123168 ValidAuthorization = true ;
169+
124170 return true ;
125171 }
126172
0 commit comments