Skip to content

Commit ecedb95

Browse files
authored
Fix CryptoUtility.PrecisionToStepSize and add rate limit for Poloniex (#800)
* [Poloniex] Remove ExchangeGlobalCurrencyReplacements entry * [Poloniex] Add rate limit * Fix CryptoUtility.PrecisionToStepSize
1 parent d155220 commit ecedb95

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/ExchangeSharp/API/Exchanges/Poloniex/ExchangePoloniexAPI.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ private ExchangePoloniexAPI()
3333
RequestContentType = "application/json";
3434
MarketSymbolSeparator = "_";
3535
WebSocketOrderBookType = WebSocketOrderBookType.DeltasOnly;
36+
RateLimit = new RateGate(10, TimeSpan.FromSeconds(1));
3637
}
3738

3839
/// <summary>
@@ -78,9 +79,8 @@ protected override Task OnInitializeAsync()
7879
fieldCount[split[0]] = split[1].ConvertInvariant<int>();
7980
}
8081
}
81-
8282
WithdrawalFieldCount = fieldCount;
83-
ExchangeGlobalCurrencyReplacements["STR"] = "XLM"; // wtf
83+
8484
return Task.CompletedTask;
8585
}
8686

src/ExchangeSharp/Utility/CryptoUtility.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,14 +1412,12 @@ public static decimal CalculatePrecision(string numberWithDecimals)
14121412
/// </summary>
14131413
public static decimal PrecisionToStepSize(decimal precision)
14141414
{
1415+
if (precision == 0) return 1;
1416+
14151417
var sb = new StringBuilder();
14161418
sb.Append("0");
14171419
if (precision > 0) sb.Append(".");
1418-
if (precision == 1)
1419-
{
1420-
sb.Append("1");
1421-
return decimal.Parse(sb.ToStringInvariant());
1422-
}
1420+
14231421
for (var i = 0; i < precision; i++)
14241422
{
14251423
sb.Append(i + 1 == precision ? "1" : "0");

0 commit comments

Comments
 (0)