From c2f8c6c1dba1226dd86c4fcf149a70e63573f9a3 Mon Sep 17 00:00:00 2001 From: Stephane Janel Date: Thu, 4 Jan 2024 18:21:49 +0100 Subject: [PATCH 1/2] Update Upbit withdraw fees --- data/static/withdrawfees.json | 153 ++-------------------------------- 1 file changed, 9 insertions(+), 144 deletions(-) diff --git a/data/static/withdrawfees.json b/data/static/withdrawfees.json index a6eaa4b9..6f3ee57e 100644 --- a/data/static/withdrawfees.json +++ b/data/static/withdrawfees.json @@ -1,77 +1,28 @@ { "upbit": { - "1INCH": "3.1", - "AAVE": "0.1", - "ACM": "0.5", - "ACN": "20", - "ACS": "25", "ADA": "0.5", - "ADD": "0", - "AERGO": "23.7", - "AFC": "0.5", - "AGLD": "4.8", - "AHT": "200", "ALGO": "0.1", - "ANKR": "60.1", - "APE": "0.3", - "APENFT": "0", - "API3": "1.2", "APT": "0.01", - "AQT": "1.3", - "AQUA": "0.6", - "ARB": "0.5", "ARDR": "2", "ARK": "0.1", - "ARPA": "57.6", "ASTR": "2", - "ATM": "0.5", "ATOM": "0.01", - "AUCTION": "0.3", - "AUDIO": "9", - "AVAX": "0.01", - "AXS": "0.1", - "BAR": "0.5", - "BAT": "5.2", + "AVAX": "0.1", "BCH": "0.001", "BFC": "1", - "BLACK": "0", - "BLUR": "10", - "BNT": "5", - "BOBA": "10", - "BORA": "2", "BSV": "0.001", "BTC": "0.0009", "BTG": "0.001", - "BTT": "50000", - "CBK": "2", "CELO": "0.8", - "CHL": "0", - "CHR": "12", - "CHZ": "18.2", - "CITY": "0.5", - "COMP": "0.1", - "CRE": "311", + "CHZ": "2", "CRO": "6.3", - "CRV": "1.9", - "CTC": "8", - "CTSI": "14.5", - "CVC": "16.5", - "DAD": "193", - "DAI": "2.8", - "DAWN": "0.9", - "DENT": "1900", "DGB": "0.2", - "DKA": "16.6", - "DNT": "165", "DOGE": "12", - "DON": "0", "DOT": "0.1", "EGLD": "0.003", "ELF": "4.3", - "ENJ": "3.6", - "ENS": "0.2", + "ENJ": "0.2", "EOS": "0", - "EOSDAC": "0", "ETC": "0.01", "ETH": "0.01", "ETHF": "0.01", @@ -81,141 +32,55 @@ "FIL": "0.1", "FLOW": "0.3", "FLR": "0.01", - "FOR": "123", - "FX": "10.5", - "GAL": "4.5", - "GAS": "0.5", - "GLM": "8.4", - "GMT": "0.5", + "GLMR": "0.1", "GO": "0.01", "GRS": "0.2", - "GRT": "19.5", - "GTC": "1", "HBAR": "0.01", - "HBD": "0.01", - "HIFI": "3.4", "HIVE": "0.01", - "HORUS": "0", - "HUM": "4.5", - "HUNT": "6.2", "ICX": "0.01", "ICZ": "0.1", - "IMX": "2.3", - "INJ": "1.1", - "INTER": "0.5", "IOST": "0", "IOTA": "0", "IOTX": "22.8", - "IQ": "0", - "JST": "30", - "JUV": "0.1", "KAVA": "0.4", - "KNC": "2.3", - "LINA": "297", - "LINK": "0.3", - "LOOM": "56.7", - "LPT": "0.1", - "LRC": "5.5", "LSK": "0.1", "LUNA2": "0.1", - "LZM": "10", - "MAGIC": "0.37", - "MANA": "1.9", - "MARO": "1", - "MASK": "0.8", - "MATIC": "2.7", - "MBL": "172", + "MATIC": "0.05", "MED": "1.1", - "MEETONE": "0", "META": "0.01", - "MIR": "4", - "MKR": "0.003", - "MLK": "0.5", - "MOC": "25", - "MTL": "1.9", - "MVL": "200", - "NAP": "0.5", + "MINA": "0.5", "NEAR": "0.2", "NEO": "0.1", "NKN": "6.6", - "NMR": "0.1", - "OBSR": "400", - "OCEAN": "12.5", - "OGN": "11", - "OGV": "15", - "ONG": "1", - "ONIT": "17.1", "ONT": "0.5", - "ONX": "2", - "ORBS": "28.2", - "OXT": "17", - "PLA": "4", "POLYX": "0.4", - "POWR": "8.9", - "PROM": "0.3", - "PSG": "0.1", - "PUNDIX": "2.8", - "QI": "5", "QKC": "0.01", - "QTCON": "1123", "QTUM": "0.01", - "RAD": "0.9", - "RAY": "0.5", "REI": "0.1", - "REP": "0.3", - "RFR": "124", - "RLC": "2", - "RLY": "70", - "RNDR": "3.4", - "RSR": "371.4", "RVC": "0.1", "RVN": "0.1", - "SAND": "2", - "SBD": "0.01", "SC": "0.1", + "SEI": "0.1", "SGB": "0.005", - "SHIB": "710000", - "SNT": "183.8", - "SNX": "1.7", "SOL": "0.01", - "SOLO": "0.1", - "SOLVE": "86", - "SSX": "33.1", "STEEM": "0.01", - "STMX": "358.1", - "STORJ": "3.8", - "STPT": "32.4", "STRAX": "0.2", - "STRK": "0.1", "STX": "3", - "SUN": "1.8", + "SUI": "0.01", "SXP": "0.2", - "T": "93.6", - "TFUEL": "2", "THETA": "0.5", - "TON": "1.4", "TRX": "1", "TT": "1", - "TUSD": "3", - "UNI": "0.4", - "UPP": "11", - "USDP": "0.01", - "USDT": "3", "VAL": "0.2", "VET": "32.6", - "VTHO": "100", "WAVES": "0.001", "WAXP": "0", - "WIN": "0", "XEC": "1000", "XEM": "4", "XLM": "0.01", - "XPR": "5", "XRP": "1", "XTZ": "0.1", "XYM": "5", - "YGG": "6.5", - "ZIL": "0.5", - "ZRX": "6.6" + "ZIL": "0.5" } } \ No newline at end of file From 85a8f60858b9a8d51ff070580265a5c2719beff1 Mon Sep 17 00:00:00 2001 From: Stephane Janel Date: Thu, 4 Jan 2024 18:22:29 +0100 Subject: [PATCH 2/2] [Upbit] Addition of net_type required parameter for withdraw-apply --- src/api/exchanges/src/upbitprivateapi.cpp | 19 +++++++++++-------- src/api/exchanges/test/commonapi_test.hpp | 5 ++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/api/exchanges/src/upbitprivateapi.cpp b/src/api/exchanges/src/upbitprivateapi.cpp index c123ce1a..11f8c0c8 100644 --- a/src/api/exchanges/src/upbitprivateapi.cpp +++ b/src/api/exchanges/src/upbitprivateapi.cpp @@ -129,8 +129,7 @@ UpbitPrivate::UpbitPrivate(const CoincenterInfo& config, UpbitPublic& upbitPubli bool UpbitPrivate::validateApiKey() { json ret = PrivateQuery(_curlHandle, _apiKey, HttpRequestType::kGet, "/v1/api_keys", CurlPostData(), IfError::kNoThrow); - auto errorIt = ret.find("error"); - return errorIt == ret.end() && !ret.empty(); + return !ret.empty() && ret.find("error") == ret.end(); } CurrencyExchangeFlatSet UpbitPrivate::TradableCurrenciesFunc::operator()() { @@ -173,17 +172,20 @@ CurrencyExchangeFlatSet UpbitPrivate::TradableCurrenciesFunc::operator()() { } BalancePortfolio UpbitPrivate::queryAccountBalance(const BalanceOptions& balanceOptions) { - BalancePortfolio ret; - bool withBalanceInUse = + const bool withBalanceInUse = balanceOptions.amountIncludePolicy() == BalanceOptions::AmountIncludePolicy::kWithBalanceInUse; - CurrencyCode equiCurrency = balanceOptions.equiCurrency(); + const CurrencyCode equiCurrency = balanceOptions.equiCurrency(); + + BalancePortfolio ret; for (const json& accountDetail : PrivateQuery(_curlHandle, _apiKey, HttpRequestType::kGet, "/v1/accounts")) { - CurrencyCode currencyCode(accountDetail["currency"].get()); - MonetaryAmount availableAmount(accountDetail["balance"].get(), currencyCode); + const CurrencyCode currencyCode(accountDetail["currency"].get()); + const MonetaryAmount availableAmount(accountDetail["balance"].get(), currencyCode); + this->addBalance(ret, availableAmount, equiCurrency); if (withBalanceInUse) { - MonetaryAmount amountInUse(accountDetail["locked"].get(), currencyCode); + const MonetaryAmount amountInUse(accountDetail["locked"].get(), currencyCode); + this->addBalance(ret, amountInUse, equiCurrency); } } @@ -597,6 +599,7 @@ InitiatedWithdrawInfo UpbitPrivate::launchWithdraw(MonetaryAmount grossAmount, W MonetaryAmount withdrawFee = _exchangePublic.queryWithdrawalFeeOrZero(currencyCode); MonetaryAmount netEmittedAmount = grossAmount - withdrawFee; CurlPostData withdrawPostData{{"currency", currencyCode.str()}, + {"net_type", currencyCode.str()}, {"amount", netEmittedAmount.amountStr()}, {"address", destinationWallet.address()}}; if (destinationWallet.hasTag()) { diff --git a/src/api/exchanges/test/commonapi_test.hpp b/src/api/exchanges/test/commonapi_test.hpp index f69c75ee..cd25877c 100644 --- a/src/api/exchanges/test/commonapi_test.hpp +++ b/src/api/exchanges/test/commonapi_test.hpp @@ -78,7 +78,10 @@ class TestAPI { // if (exchangePrivateOpt) { // json d; // for (const auto &c : currencies) { - // d[string(c.standardStr())] = *exchangePrivateOpt->queryWithdrawalFee(c.standardCode()).amountStr(); + // const auto optFeeAmount = exchangePrivateOpt->queryWithdrawalFee(c.standardCode()); + // if (optFeeAmount) { + // d[c.standardStr()] = optFeeAmount->amountStr(); + // } // } // std::cout << d.dump(2) << '\n'; // }