- Fetch /coins/dragonx-2/tickers once per session (App::refreshExchanges, reusing the
price-fetch worker path) and build the exchange registry at runtime into
state.market.exchanges; parseCoinGeckoTickers groups tickers by venue. The Market tab
sources from this live list and falls back to the compiled-in registry (now including
OurBit + Nonkyc.io) when offline. Fixes the missing OurBit pair and auto-tracks future
listings.
- Fix stale selection defaults (TradeOgre / DRGX-BTC -> Nonkyc.io / DRGX/USDT) that never
matched the registry, and make the attribution generic ("Price data from CoinGecko").
- Reframe the single-asset portfolio card as a DRGX holdings dashboard: relabel to
"MY DRGX" and show the 24h change on the holdings value (colored by direction).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
// DragonX Wallet - ImGui Edition
|
|
// Copyright 2024-2026 The Hush Developers
|
|
// Released under the GPLv3
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace dragonx {
|
|
namespace data {
|
|
|
|
/**
|
|
* @brief A single trading pair on an exchange (e.g. DRGX/BTC)
|
|
*/
|
|
struct ExchangePair {
|
|
std::string base; ///< e.g. "DRGX"
|
|
std::string quote; ///< e.g. "BTC"
|
|
std::string displayName; ///< e.g. "DRGX/BTC"
|
|
std::string tradeUrl; ///< Link to the exchange pair page
|
|
};
|
|
|
|
/**
|
|
* @brief Metadata for a supported exchange
|
|
*/
|
|
struct ExchangeInfo {
|
|
std::string name; ///< e.g. "TradeOgre"
|
|
std::string baseUrl; ///< e.g. "https://tradeogre.com"
|
|
std::vector<ExchangePair> pairs;
|
|
};
|
|
|
|
/**
|
|
* @brief Returns the static registry of supported exchanges + pairs.
|
|
* Used as the offline fallback / seed when the live CoinGecko list is unavailable.
|
|
*/
|
|
const std::vector<ExchangeInfo>& getExchangeRegistry();
|
|
|
|
/**
|
|
* @brief Parse a CoinGecko /coins/{id}/tickers JSON body into the exchange registry.
|
|
*
|
|
* Groups tickers by exchange (market.name), preserving first-seen order, into
|
|
* ExchangeInfo entries (each pair carries base/target/displayName/trade_url). Returns
|
|
* an empty vector on parse failure or when no usable tickers are present. Pure (no I/O).
|
|
*/
|
|
std::vector<ExchangeInfo> parseCoinGeckoTickers(const std::string& json);
|
|
|
|
} // namespace data
|
|
} // namespace dragonx
|