Skip to content

Commit

Permalink
Fix GetCurrencies for KuCoin
Browse files Browse the repository at this point in the history
  • Loading branch information
v36u committed Nov 22, 2024
1 parent a6da81b commit b15a960
Showing 1 changed file with 68 additions and 10 deletions.
78 changes: 68 additions & 10 deletions src/ExchangeSharp/API/Exchanges/KuCoin/ExchangeKuCoinAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,24 +126,82 @@ protected override async Task<
IReadOnlyDictionary<string, ExchangeCurrency>
> OnGetCurrenciesAsync()
{
/**
{
"code": "200000",
"data": [
{
"currency": "BTC",
"name": "BTC",
"fullName": "Bitcoin",
"precision": 8,
"confirms": null,
"contractAddress": null,
"isMarginEnabled": true,
"isDebitEnabled": true,
"chains": [
{
"chainName" : "BTC",
"withdrawalMinFee" : "0.001",
"withdrawalMinSize" : "0.0012",
"withdrawFeeRate" : "0",
"depositMinSize" : "0.0002",
"isWithdrawEnabled" : true,
"isDepositEnabled" : true,
"preConfirms" : 1,
"contractAddress" : "",
"chainId" : "btc",
"confirms" : 3
},
{
"chainName" : "KCC",
"withdrawalMinFee" : "0.00002",
"withdrawalMinSize" : "0.0008",
"withdrawFeeRate" : "0",
"depositMinSize" : null,
"isWithdrawEnabled" : true,
"isDepositEnabled" : true,
"preConfirms" : 20,
"contractAddress" : "0xfa93c12cd345c658bc4644d1d4e1b9615952258c",
"chainId" : "kcc",
"confirms" : 20
},
{
"chainName" : "BTC-Segwit",
"withdrawalMinFee" : "0.0005",
"withdrawalMinSize" : "0.0008",
"withdrawFeeRate" : "0",
"depositMinSize" : "0.0002",
"isWithdrawEnabled" : false,
"isDepositEnabled" : true,
"preConfirms" : 2,
"contractAddress" : "",
"chainId" : "bech32",
"confirms" : 2
}
]
}
]
}
*/

Dictionary<string, ExchangeCurrency> currencies =
new Dictionary<string, ExchangeCurrency>();
List<string> symbols = new List<string>();
// [ { "withdrawMinFee": 100000, "withdrawMinAmount": 200000, "withdrawFeeRate": 0.001, "confirmationCount": 12, "name": "Bitcoin", "tradePrecision": 7, "coin": "BTC","infoUrl": null, "enableWithdraw": true, "enableDeposit": true, "depositRemark": "", "withdrawRemark": "" } ... ]
JToken token = await MakeJsonRequestAsync<JToken>("/market/open/coins");
JToken token = await MakeJsonRequestAsync<JToken>("/currencies");
foreach (JToken currency in token)
currencies.Add(
currency["coin"].ToStringInvariant(),
currency["currency"].ToStringInvariant(),
new ExchangeCurrency()
{
Name = currency["coin"].ToStringInvariant(),
FullName = currency["name"].ToStringInvariant(),
WithdrawalEnabled = currency["enableWithdraw"].ConvertInvariant<bool>(),
DepositEnabled = currency["enableDepost"].ConvertInvariant<bool>(),
TxFee = currency["withdrawFeeRate"].ConvertInvariant<decimal>(),
MinConfirmations = currency["confirmationCount"].ConvertInvariant<int>(),
Name = currency["currency"].ToStringInvariant(),
FullName = currency["fullName"].ToStringInvariant(),
WithdrawalEnabled = currency["isDepositEnabled"].ConvertInvariant<bool>(),
DepositEnabled = currency["isWithdrawEnabled"].ConvertInvariant<bool>(),
TxFee = currency["withdrawalMinFee"].ConvertInvariant<decimal>(),
MinConfirmations = currency["confirms"].ConvertInvariant<int>(),
MinWithdrawalSize = currency[
"withdrawMinAmount"
"withdrawalMinSize"
].ConvertInvariant<decimal>(),
}
);
Expand Down

0 comments on commit b15a960

Please sign in to comment.