Skip to content

Commit

Permalink
Rename Time types into duration as they are actually durations
Browse files Browse the repository at this point in the history
  • Loading branch information
sjanel committed Mar 12, 2024
1 parent 218365d commit a0e45e9
Show file tree
Hide file tree
Showing 39 changed files with 145 additions and 139 deletions.
2 changes: 1 addition & 1 deletion src/api-objects/include/tradeoptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace cct {
class ExchangeConfig;
class TradeOptions {
public:
static constexpr Duration kDefaultMinTimeBetweenPriceUpdates = std::chrono::seconds(5);
static constexpr Duration kDefaultMinTimeBetweenPriceUpdates = seconds(5);

constexpr TradeOptions() noexcept = default;

Expand Down
2 changes: 1 addition & 1 deletion src/api-objects/include/withdrawoptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class WithdrawOptions {
private:
/// The waiting time between each query of withdraw info to check withdraw status from an exchange.
/// A very small value is not relevant as withdraw time order of magnitude are minutes or hours
static constexpr auto kWithdrawRefreshTime = std::chrono::seconds(5);
static constexpr auto kWithdrawRefreshTime = seconds(5);

Duration _withdrawRefreshTime = kWithdrawRefreshTime;
WithdrawSyncPolicy _withdrawSyncPolicy = WithdrawSyncPolicy::kSynchronous;
Expand Down
6 changes: 3 additions & 3 deletions src/api-objects/src/closed-order.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ string ClosedOrder::matchedTimeStr() const { return ToString(_matchedTime); }

ClosedOrder ClosedOrder::mergeWith(const ClosedOrder &closedOrder) const {
const MonetaryAmount totalMatchedVolume = closedOrder.matchedVolume() + matchedVolume();
const auto previousMatchedTs = TimestampToMs(matchedTime());
const auto currentMatchedTs = TimestampToMs(closedOrder.matchedTime());
const auto previousMatchedTs = TimestampToMillisecondsSinceEpoch(matchedTime());
const auto currentMatchedTs = TimestampToMillisecondsSinceEpoch(closedOrder.matchedTime());
const auto avgMatchedTs = (((previousMatchedTs * matchedVolume().toNeutral()) +
(currentMatchedTs * closedOrder.matchedVolume().toNeutral())) /
totalMatchedVolume.toNeutral())
.integerPart();
const TimePoint avgMatchedTime{TimeInMs{avgMatchedTs}};
const TimePoint avgMatchedTime{milliseconds{avgMatchedTs}};

MonetaryAmount avgPrice = price();
if (closedOrder.price() != price()) {
Expand Down
8 changes: 4 additions & 4 deletions src/api-objects/test/closed-order_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ namespace cct {

class ClosedOrderTest : public ::testing::Test {
protected:
TimePoint tp1{TimeInMs{std::numeric_limits<int64_t>::max() / 10000000}};
TimePoint tp2{TimeInMs{std::numeric_limits<int64_t>::max() / 9900000}};
TimePoint tp3{TimeInMs{std::numeric_limits<int64_t>::max() / 9800000}};
TimePoint tp1{milliseconds{std::numeric_limits<int64_t>::max() / 10000000}};
TimePoint tp2{milliseconds{std::numeric_limits<int64_t>::max() / 9900000}};
TimePoint tp3{milliseconds{std::numeric_limits<int64_t>::max() / 9800000}};

ClosedOrder closedOrder1{"1", MonetaryAmount(15, "BTC", 1), MonetaryAmount(35000, "USDT"), tp1, tp1, TradeSide::kBuy};
ClosedOrder closedOrder2{"2", MonetaryAmount(25, "BTC", 1), MonetaryAmount(45000, "USDT"), tp2, tp3, TradeSide::kBuy};
Expand All @@ -39,6 +39,6 @@ TEST_F(ClosedOrderTest, Merge) {
EXPECT_EQ(mergedClosedOrder.matchedVolume(), closedOrder1.matchedVolume() + closedOrder2.matchedVolume());
EXPECT_EQ(mergedClosedOrder.price(), MonetaryAmount(41250, closedOrder1.price().currencyCode()));
EXPECT_EQ(mergedClosedOrder.market(), closedOrder1.market());
EXPECT_EQ(mergedClosedOrder.matchedTime(), TimePoint{TimeInMs{934101708833}});
EXPECT_EQ(mergedClosedOrder.matchedTime(), TimePoint{milliseconds{934101708833}});
}
} // namespace cct
8 changes: 4 additions & 4 deletions src/api-objects/test/deposit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
namespace cct {
class DepositTest : public ::testing::Test {
protected:
TimePoint tp1{TimeInMs{std::numeric_limits<int64_t>::max() / 10000000}};
TimePoint tp2{TimeInMs{std::numeric_limits<int64_t>::max() / 9000000}};
TimePoint tp3{TimeInMs{std::numeric_limits<int64_t>::max() / 8000000}};
TimePoint tp4{TimeInMs{std::numeric_limits<int64_t>::max() / 7000000}};
TimePoint tp1{milliseconds{std::numeric_limits<int64_t>::max() / 10000000}};
TimePoint tp2{milliseconds{std::numeric_limits<int64_t>::max() / 9000000}};
TimePoint tp3{milliseconds{std::numeric_limits<int64_t>::max() / 8000000}};
TimePoint tp4{milliseconds{std::numeric_limits<int64_t>::max() / 7000000}};

Deposit deposit1{"id1", tp2, MonetaryAmount("0.045", "BTC"), Deposit::Status::kSuccess};
Deposit deposit2{"id2", tp4, MonetaryAmount(37, "XRP"), Deposit::Status::kSuccess};
Expand Down
2 changes: 1 addition & 1 deletion src/api-objects/test/recentdeposit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class RecentDepositTest : public ::testing::Test {
}

void setRecentDepositsDifferentAmounts() {
closestRecentDepositPicker.addDeposit(RecentDeposit(MonetaryAmount(37), refTimePoint - std::chrono::seconds(6)));
closestRecentDepositPicker.addDeposit(RecentDeposit(MonetaryAmount(37), refTimePoint - seconds(6)));
closestRecentDepositPicker.addDeposit(RecentDeposit(MonetaryAmount("37.5"), refTimePoint - std::chrono::hours(2)));
closestRecentDepositPicker.addDeposit(RecentDeposit(MonetaryAmount(32), refTimePoint - std::chrono::hours(8)));
closestRecentDepositPicker.addDeposit(RecentDeposit(MonetaryAmount(32), refTimePoint - std::chrono::hours(1)));
Expand Down
8 changes: 4 additions & 4 deletions src/api-objects/test/withdraw_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
namespace cct {
class WithdrawTest : public ::testing::Test {
protected:
TimePoint tp1{TimeInMs{std::numeric_limits<int64_t>::max() / 10000000}};
TimePoint tp2{TimeInMs{std::numeric_limits<int64_t>::max() / 9000000}};
TimePoint tp3{TimeInMs{std::numeric_limits<int64_t>::max() / 8000000}};
TimePoint tp4{TimeInMs{std::numeric_limits<int64_t>::max() / 7000000}};
TimePoint tp1{milliseconds{std::numeric_limits<int64_t>::max() / 10000000}};
TimePoint tp2{milliseconds{std::numeric_limits<int64_t>::max() / 9000000}};
TimePoint tp3{milliseconds{std::numeric_limits<int64_t>::max() / 8000000}};
TimePoint tp4{milliseconds{std::numeric_limits<int64_t>::max() / 7000000}};

Withdraw withdraw1{"id1", tp2, MonetaryAmount("0.045", "BTC"), Withdraw::Status::kSuccess,
MonetaryAmount("0.001", "BTC")};
Expand Down
6 changes: 3 additions & 3 deletions src/api/common/src/commonapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CommonAPI::CommonAPI(const CoincenterInfo& coincenterInfo, Duration fiatsUpdateF
fiats.emplace_hint(fiats.end(), std::move(val.get_ref<string&>()));
}
log::debug("Loaded {} fiats from cache file", fiats.size());
_fiatsCache.set(std::move(fiats), TimePoint(TimeInS(timeEpoch)));
_fiatsCache.set(std::move(fiats), TimePoint(seconds(timeEpoch)));
}
}
}
Expand Down Expand Up @@ -168,7 +168,7 @@ void CommonAPI::updateCacheFile() const {
const auto timeEpochIt = data.find("timeepoch");
if (timeEpochIt != data.end()) {
const int64_t lastTimeFileUpdated = timeEpochIt->get<int64_t>();
if (TimePoint(TimeInS(lastTimeFileUpdated)) >= fiatsPtrLastUpdatedTimePair.second) {
if (TimePoint(seconds(lastTimeFileUpdated)) >= fiatsPtrLastUpdatedTimePair.second) {
return; // No update
}
}
Expand All @@ -177,7 +177,7 @@ void CommonAPI::updateCacheFile() const {
for (CurrencyCode fiatCode : *fiatsPtrLastUpdatedTimePair.first) {
data["fiats"].emplace_back(fiatCode.str());
}
data["timeepoch"] = TimestampToS(fiatsPtrLastUpdatedTimePair.second);
data["timeepoch"] = TimestampToSecondsSinceEpoch(fiatsPtrLastUpdatedTimePair.second);
fiatsCacheFile.write(data);
}

Expand Down
6 changes: 3 additions & 3 deletions src/api/common/src/exchangeprivateapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ TradedAmounts ExchangePrivate::marketTrade(MonetaryAmount from, const TradeOptio
const CurrencyCode toCurrency = mk.opposite(fromCurrency);

const TimePoint timerStart = Clock::now();
const UserRefInt userRef =
static_cast<UserRefInt>(TimestampToS(timerStart) % static_cast<int64_t>(std::numeric_limits<UserRefInt>::max()));
const UserRefInt userRef = static_cast<UserRefInt>(TimestampToSecondsSinceEpoch(timerStart) %
static_cast<int64_t>(std::numeric_limits<UserRefInt>::max()));

const TradeSide side = fromCurrency == mk.base() ? TradeSide::kSell : TradeSide::kBuy;
TradeContext tradeContext(mk, side, userRef);
Expand Down Expand Up @@ -209,7 +209,7 @@ TradedAmounts ExchangePrivate::marketTrade(MonetaryAmount from, const TradeOptio

TimePoint nowTime = Clock::now();

const bool reachedEmergencyTime = options.maxTradeTime() < TimeInS(1) + nowTime - timerStart;
const bool reachedEmergencyTime = options.maxTradeTime() < seconds(1) + nowTime - timerStart;
bool updatePriceNeeded = false;
if (!options.isFixedPrice() && !reachedEmergencyTime &&
options.minTimeBetweenPriceUpdates() < nowTime - lastPriceUpdateTime) {
Expand Down
4 changes: 2 additions & 2 deletions src/api/common/src/fiatconverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ FiatConverter::FiatConverter(const CoincenterInfo& coincenterInfo, Duration rate
const int64_t timeStamp = rateAndTimeData["timeepoch"];

log::trace("Stored rate {} for market {} from {}", rate, marketStr, kRatesCacheFile);
_pricesMap.insert_or_assign(Market(marketStr, '-'), PriceTimedValue{rate, TimePoint(TimeInS(timeStamp))});
_pricesMap.insert_or_assign(Market(marketStr, '-'), PriceTimedValue{rate, TimePoint(seconds(timeStamp))});
}
log::debug("Loaded {} fiat currency rates from {}", _pricesMap.size(), kRatesCacheFile);
}
Expand All @@ -83,7 +83,7 @@ void FiatConverter::updateCacheFile() const {
const string marketPairStr = market.assetsPairStrUpper('-');

data[marketPairStr]["rate"] = priceTimeValue.rate;
data[marketPairStr]["timeepoch"] = TimestampToS(priceTimeValue.lastUpdatedTime);
data[marketPairStr]["timeepoch"] = TimestampToSecondsSinceEpoch(priceTimeValue.lastUpdatedTime);
}
GetRatesCacheFile(_dataDir).write(data);
}
Expand Down
4 changes: 2 additions & 2 deletions src/api/common/src/withdrawalfees-crawler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ WithdrawalFeesCrawler::WithdrawalFeesCrawler(const CoincenterInfo& coincenterInf
if (!data.empty()) {
const auto nowTime = Clock::now();
for (const auto& [exchangeName, exchangeData] : data.items()) {
TimePoint lastUpdatedTime(TimeInS(exchangeData["timeepoch"].get<int64_t>()));
TimePoint lastUpdatedTime(seconds(exchangeData["timeepoch"].get<int64_t>()));
if (nowTime < lastUpdatedTime + minDurationBetweenQueries) {
// we can reuse file data
WithdrawalInfoMaps withdrawalInfoMaps;
Expand Down Expand Up @@ -93,7 +93,7 @@ void WithdrawalFeesCrawler::updateCacheFile() const {
const WithdrawalInfoMaps& withdrawalInfoMaps = *withdrawalInfoMapsPtr;

json exchangeData;
exchangeData["timeepoch"] = TimestampToS(latestUpdate);
exchangeData["timeepoch"] = TimestampToSecondsSinceEpoch(latestUpdate);
for (const auto withdrawFee : withdrawalInfoMaps.first) {
string curCodeStr = withdrawFee.currencyCode().str();
exchangeData["assets"][curCodeStr]["min"] =
Expand Down
8 changes: 4 additions & 4 deletions src/api/common/test/exchangeprivateapi_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ TEST_F(ExchangePrivateTest, TradeAsyncPolicyTaker) {

MonetaryAmount vol(from / pri, market.base());
PriceOptions priceOptions(PriceStrategy::kTaker);
TradeOptions tradeOptions(priceOptions, TradeTimeoutAction::kCancel, TradeMode::kReal, std::chrono::seconds(10),
std::chrono::seconds(5), TradeTypePolicy::kDefault, TradeSyncPolicy::kAsynchronous);
TradeOptions tradeOptions(priceOptions, TradeTimeoutAction::kCancel, TradeMode::kReal, seconds(10), seconds(5),
TradeTypePolicy::kDefault, TradeSyncPolicy::kAsynchronous);
TradeContext tradeContext(market, TradeSide::kBuy);
TradeInfo tradeInfo = computeTradeInfo(tradeContext, tradeOptions);

Expand All @@ -198,8 +198,8 @@ TEST_F(ExchangePrivateTest, TradeAsyncPolicyMaker) {
TradeContext tradeContext(market, side);

PriceOptions priceOptions(PriceStrategy::kMaker);
TradeOptions tradeOptions(priceOptions, TradeTimeoutAction::kCancel, TradeMode::kReal, std::chrono::seconds(10),
std::chrono::seconds(5), TradeTypePolicy::kDefault, TradeSyncPolicy::kAsynchronous);
TradeOptions tradeOptions(priceOptions, TradeTimeoutAction::kCancel, TradeMode::kReal, seconds(10), seconds(5),
TradeTypePolicy::kDefault, TradeSyncPolicy::kAsynchronous);
TradeInfo tradeInfo = computeTradeInfo(tradeContext, tradeOptions);

EXPECT_CALL(exchangePublic, queryOrderBook(market, testing::_)).WillOnce(testing::Return(marketOrderBook1));
Expand Down
2 changes: 1 addition & 1 deletion src/api/common/test/fiatconverter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class FiatConverterTest : public ::testing::Test {
protected:
settings::RunMode runMode = settings::RunMode::kTestKeys;
CoincenterInfo coincenterInfo{runMode};
FiatConverter converter{coincenterInfo, TimeInMs(1), Reader()};
FiatConverter converter{coincenterInfo, milliseconds(1), Reader()};
};

TEST_F(FiatConverterTest, DirectConversion) {
Expand Down
24 changes: 12 additions & 12 deletions src/api/exchanges/src/binanceprivateapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void SetNonceAndSignature(const APIKey& apiKey, CurlPostData& postData, Duration

bool CheckErrorDoRetry(int statusCode, const json& ret, QueryDelayDir& queryDelayDir, Duration& sleepingTime,
Duration& queryDelay) {
static constexpr Duration kInitialDurationQueryDelay = TimeInMs(200);
static constexpr Duration kInitialDurationQueryDelay = milliseconds(200);
switch (statusCode) {
case kInvalidTimestamp: {
auto msgIt = ret.find("msg");
Expand Down Expand Up @@ -304,7 +304,7 @@ void FillOrders(const OrdersConstraints& ordersConstraints, const json& ordersAr
}
const auto placedTimeMsSinceEpoch = orderDetails["time"].get<int64_t>();

const TimePoint placedTime{TimeInMs(placedTimeMsSinceEpoch)};
const TimePoint placedTime{milliseconds(placedTimeMsSinceEpoch)};
if (!ordersConstraints.validatePlacedTime(placedTime)) {
continue;
}
Expand Down Expand Up @@ -336,7 +336,7 @@ void FillOrders(const OrdersConstraints& ordersConstraints, const json& ordersAr
orderVector.emplace_back(std::move(id), matchedVolume, remainingVolume, price, placedTime, side);
} else if constexpr (std::is_same_v<OrderType, ClosedOrder>) {
const auto matchedTimeMsSinceEpoch = orderDetails["updateTime"].get<int64_t>();
const TimePoint matchedTime{TimeInMs(matchedTimeMsSinceEpoch)};
const TimePoint matchedTime{milliseconds(matchedTimeMsSinceEpoch)};

orderVector.emplace_back(std::move(id), matchedVolume, price, placedTime, matchedTime, side);
} else {
Expand All @@ -357,10 +357,10 @@ ClosedOrderVector BinancePrivate::queryClosedOrders(const OrdersConstraints& clo
return closedOrders;
}
if (closedOrdersConstraints.isPlacedTimeAfterDefined()) {
params.append("startTime", TimestampToMs(closedOrdersConstraints.placedAfter()));
params.append("startTime", TimestampToMillisecondsSinceEpoch(closedOrdersConstraints.placedAfter()));
}
if (closedOrdersConstraints.isPlacedTimeBeforeDefined()) {
params.append("endTime", TimestampToMs(closedOrdersConstraints.placedBefore()));
params.append("endTime", TimestampToMillisecondsSinceEpoch(closedOrdersConstraints.placedBefore()));
}
const json result =
PrivateQuery(_curlHandle, _apiKey, HttpRequestType::kGet, "/api/v3/allOrders", _queryDelay, std::move(params));
Expand Down Expand Up @@ -464,10 +464,10 @@ DepositsSet BinancePrivate::queryRecentDeposits(const DepositsConstraints& depos
options.append("coin", depositsConstraints.currencyCode().str());
}
if (depositsConstraints.isTimeAfterDefined()) {
options.append("startTime", TimestampToMs(depositsConstraints.timeAfter()));
options.append("startTime", TimestampToMillisecondsSinceEpoch(depositsConstraints.timeAfter()));
}
if (depositsConstraints.isTimeBeforeDefined()) {
options.append("endTime", TimestampToMs(depositsConstraints.timeBefore()));
options.append("endTime", TimestampToMillisecondsSinceEpoch(depositsConstraints.timeBefore()));
}
if (depositsConstraints.isIdDefined()) {
if (depositsConstraints.idSet().size() == 1) {
Expand All @@ -484,7 +484,7 @@ DepositsSet BinancePrivate::queryRecentDeposits(const DepositsConstraints& depos
string& id = depositDetail["id"].get_ref<string&>();
MonetaryAmount amountReceived(depositDetail["amount"].get<double>(), currencyCode);
int64_t millisecondsSinceEpoch = depositDetail["insertTime"].get<int64_t>();
TimePoint timestamp{TimeInMs(millisecondsSinceEpoch)};
TimePoint timestamp{milliseconds(millisecondsSinceEpoch)};

deposits.emplace_back(std::move(id), timestamp, amountReceived, status);
}
Expand Down Expand Up @@ -544,7 +544,7 @@ TimePoint RetrieveTimeStampFromWithdrawJson(const json& withdrawJson) {
} else {
millisecondsSinceEpoch = withdrawJson["applyTime"].get<int64_t>();
}
return TimePoint{TimeInMs(millisecondsSinceEpoch)};
return TimePoint{milliseconds(millisecondsSinceEpoch)};
}

CurlPostData CreateOptionsFromWithdrawConstraints(const WithdrawsConstraints& withdrawsConstraints) {
Expand All @@ -553,10 +553,10 @@ CurlPostData CreateOptionsFromWithdrawConstraints(const WithdrawsConstraints& wi
options.append("coin", withdrawsConstraints.currencyCode().str());
}
if (withdrawsConstraints.isTimeAfterDefined()) {
options.append("startTime", TimestampToMs(withdrawsConstraints.timeAfter()));
options.append("startTime", TimestampToMillisecondsSinceEpoch(withdrawsConstraints.timeAfter()));
}
if (withdrawsConstraints.isTimeBeforeDefined()) {
options.append("endTime", TimestampToMs(withdrawsConstraints.timeBefore()));
options.append("endTime", TimestampToMillisecondsSinceEpoch(withdrawsConstraints.timeBefore()));
}
return options;
}
Expand Down Expand Up @@ -786,7 +786,7 @@ MonetaryAmount BinancePrivate::queryWithdrawDelivery(const InitiatedWithdrawInfo
MonetaryAmount amountReceived(depositDetail["amount"].get<double>(), currencyCode);
int64_t millisecondsSinceEpoch = depositDetail["insertTime"].get<int64_t>();

TimePoint timestamp{TimeInMs(millisecondsSinceEpoch)};
TimePoint timestamp{milliseconds(millisecondsSinceEpoch)};

closestRecentDepositPicker.addDeposit(RecentDeposit(amountReceived, timestamp));
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/exchanges/src/binancepublicapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ TradesVector BinancePublic::queryLastTrades(Market mk, int nbTrades) {
int64_t millisecondsSinceEpoch = detail["time"].get<int64_t>();
TradeSide tradeSide = detail["isBuyerMaker"].get<bool>() ? TradeSide::kSell : TradeSide::kBuy;

ret.emplace_back(tradeSide, amount, price, TimePoint(std::chrono::milliseconds(millisecondsSinceEpoch)));
ret.emplace_back(tradeSide, amount, price, TimePoint(milliseconds(millisecondsSinceEpoch)));
}
std::ranges::sort(ret);
return ret;
Expand Down
12 changes: 6 additions & 6 deletions src/api/exchanges/src/bithumbprivateapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ bool LoadCurrencyInfoField(const json& currencyOrderInfoJson, std::string_view k
val = valIt->get<ValueType>();
log::debug("Loaded {} for '{}' from cache file", val, keyStr);
}
ts = TimePoint(std::chrono::seconds(tsIt->get<int64_t>()));
ts = TimePoint(seconds(tsIt->get<int64_t>()));
return true;
}
return false;
Expand All @@ -144,7 +144,7 @@ json CurrencyOrderInfoField2Json(const ValueType& val, TimePoint ts) {
} else {
data.emplace(kValueKeyStr, val);
}
data.emplace(kTimestampKeyStr, TimestampToS(ts));
data.emplace(kTimestampKeyStr, TimestampToSecondsSinceEpoch(ts));
return data;
}

Expand Down Expand Up @@ -415,7 +415,7 @@ TimePoint RetrieveTimePointFromTrxJson(const json& trx, std::string_view fieldNa
throw exception("Cannot understand '{}' parameter type", fieldName);
}

return TimePoint{TimeInUs(microsecondsSinceEpoch)};
return TimePoint{microseconds(microsecondsSinceEpoch)};
}

auto FillOrderCurrencies(const OrdersConstraints& ordersConstraints, ExchangePublic& exchangePublic,
Expand Down Expand Up @@ -470,7 +470,7 @@ OrderVectorType QueryOrders(const OrdersConstraints& ordersConstraints, Exchange

OrderVectorType orders;
if (ordersConstraints.isPlacedTimeAfterDefined()) {
params.append("after", TimestampToMs(ordersConstraints.placedAfter()));
params.append("after", TimestampToMillisecondsSinceEpoch(ordersConstraints.placedAfter()));
}
if (orderCurrencies.size() > 1) {
if constexpr (std::is_same_v<OrderType, ClosedOrder>) {
Expand Down Expand Up @@ -542,7 +542,7 @@ string GenerateDepositIdFromTrx(TimePoint timestamp, const json& trx) {
// Bithumb does not provide any transaction id, let's generate it from currency and timestamp...
string id{trx[kOrderCurrencyParamStr].get<std::string_view>()};
id.push_back('-');
AppendString(id, TimestampToMs(timestamp));
AppendString(id, TimestampToMillisecondsSinceEpoch(timestamp));
return id;
}

Expand Down Expand Up @@ -1079,7 +1079,7 @@ InitiatedWithdrawInfo BithumbPrivate::launchWithdraw(MonetaryAmount grossAmount,

// Query the withdraws, hopefully we will be able to find our withdraw
json newWithdrawTrx;
TimeInS sleepingTime(1);
seconds sleepingTime(1);
static constexpr int kNbRetriesCatchWindow = 15;
for (int retryPos = 0; retryPos < kNbRetriesCatchWindow && newWithdrawTrx.empty(); ++retryPos) {
if (retryPos != 0) {
Expand Down
Loading

0 comments on commit a0e45e9

Please sign in to comment.