-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Bithumb withdrawal fees parsing, factorize crawlers code
- Loading branch information
Showing
21 changed files
with
369 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#pragma once | ||
|
||
#include <string_view> | ||
#include <unordered_map> | ||
#include <utility> | ||
|
||
#include "cachedresult.hpp" | ||
#include "cachedresultvault.hpp" | ||
#include "coincenterinfo.hpp" | ||
#include "curlhandle.hpp" | ||
#include "currencycode.hpp" | ||
#include "monetaryamount.hpp" | ||
#include "monetaryamountbycurrencyset.hpp" | ||
#include "timedef.hpp" | ||
|
||
namespace cct { | ||
|
||
/// This class is able to crawl some public withdrawal fees web pages in order to retrieve them from unofficial sources, | ||
/// which is better than nothing. This class is non thread-safe. | ||
class WithdrawalFeesCrawler { | ||
public: | ||
WithdrawalFeesCrawler(const CoincenterInfo& coincenterInfo, Duration minDurationBetweenQueries, | ||
CachedResultVault& cachedResultVault); | ||
|
||
using WithdrawalMinMap = std::unordered_map<CurrencyCode, MonetaryAmount>; | ||
using WithdrawalInfoMaps = std::pair<MonetaryAmountByCurrencySet, WithdrawalMinMap>; | ||
|
||
WithdrawalInfoMaps get(std::string_view exchangeName) { return _withdrawalFeesCache.get(exchangeName); } | ||
|
||
void updateCacheFile() const; | ||
|
||
private: | ||
class WithdrawalFeesFunc { | ||
public: | ||
explicit WithdrawalFeesFunc(const CoincenterInfo& coincenterInfo); | ||
|
||
WithdrawalInfoMaps operator()(std::string_view exchangeName); | ||
|
||
private: | ||
WithdrawalInfoMaps get1(std::string_view exchangeName); | ||
WithdrawalInfoMaps get2(std::string_view exchangeName); | ||
|
||
CurlHandle _curlHandle1; | ||
CurlHandle _curlHandle2; | ||
}; | ||
|
||
const CoincenterInfo& _coincenterInfo; | ||
CachedResult<WithdrawalFeesFunc, std::string_view> _withdrawalFeesCache; | ||
}; | ||
|
||
} // namespace cct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.