Skip to content

Commit

Permalink
[Upbit] Consider only main networks for currencies, fix deposit-info …
Browse files Browse the repository at this point in the history
…command
  • Loading branch information
sjanel committed Nov 4, 2023
1 parent 0b319c0 commit 59ac25e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/api/exchanges/include/binancepublicapi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "monetaryamount.hpp"
#include "permanentcurloptions.hpp"
#include "runmodes.hpp"
#include "timedef.hpp"

namespace cct {

Expand Down
3 changes: 2 additions & 1 deletion src/api/exchanges/include/bithumbpublicapi.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#pragma once

#include <string_view>

#include "cachedresult.hpp"
#include "curlhandle.hpp"
#include "exchangepublicapi.hpp"
#include "exchangepublicapitypes.hpp"
#include "timedef.hpp"

namespace cct {

Expand Down
4 changes: 0 additions & 4 deletions src/api/exchanges/include/upbitprivateapi.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#pragma once

#include <span>
#include <unordered_map>

#include "cachedresult.hpp"
#include "cct_json.hpp"
#include "curlhandle.hpp"
#include "exchangeprivateapi.hpp"
#include "exchangeprivateapitypes.hpp"
Expand Down
6 changes: 5 additions & 1 deletion src/api/exchanges/src/upbitprivateapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ CurrencyExchangeFlatSet UpbitPrivate::TradableCurrenciesFunc::operator()() {
const CurrencyCodeSet& excludedCurrencies = _exchangeInfo.excludedCurrenciesAll();
CurrencyExchangeVector currencies;
json result = PrivateQuery(_curlHandle, _apiKey, HttpRequestType::kGet, "/v1/status/wallet");
currencies.reserve(static_cast<CurrencyExchangeVector::size_type>(result.size() - excludedCurrencies.size()));
for (const json& curDetails : result) {
CurrencyCode cur(curDetails["currency"].get<std::string_view>());
CurrencyCode networkName(curDetails["net_type"].get<std::string_view>());
if (cur != networkName) {
log::debug("Forgive about {}-{} as net type is not the main one", cur, networkName);
continue;
}
if (UpbitPublic::CheckCurrencyCode(cur, excludedCurrencies)) {
std::string_view walletState = curDetails["wallet_state"].get<std::string_view>();
CurrencyExchange::Withdraw withdrawStatus = CurrencyExchange::Withdraw::kUnavailable;
Expand Down
2 changes: 1 addition & 1 deletion src/api/exchanges/test/commonapi_test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class TestAPI {
});
if (!depositableCryptos.empty()) {
CurrencyExchangeFlatSet sample;
int nbSamples = exchangePrivateOpt->canGenerateDepositAddress() ? 1 : 5;
const int nbSamples = exchangePrivateOpt->canGenerateDepositAddress() ? 1 : 5;
std::ranges::sample(depositableCryptos, std::inserter(sample, sample.end()), nbSamples,
std::mt19937{std::random_device{}()});

Expand Down

0 comments on commit 59ac25e

Please sign in to comment.