Skip to content

title: sgns::PriceHttpClientSource summary: Production tier adapter: a PriceHttpClient wrapped in the IPriceSource seam, closing over the manager's io_context (D-04).


sgns::PriceHttpClientSource

Production tier adapter: a PriceHttpClient wrapped in the IPriceSource seam, closing over the manager's io_context (D-04).

#include <PriceHttpClientSource.hpp>

Inherits from sgns::IPriceSource

Public Functions

Name
PriceHttpClientSource(std::shared_ptr< boost::asio::io_context > ioc, std::string baseUrl, RetryConfig retryConfig ={}, std::chrono::seconds holdOffDuration =std::chrono::seconds(60), RateLimitHoldOff::Clock clock =[] { return std::chrono::system_clock::now();}, std::chrono::milliseconds requestTimeout =std::chrono::milliseconds(5000), ResponseFormat responseFormat =ResponseFormat::CoinGeckoSimplePrice)
Construct the adapter; forwards every config argument to the wrapped PriceHttpClient (same defaults).
virtual PriceResult< std::vector< PriceQuote > > FetchPrices(const std::vector< std::string > & tokenIds, const std::string & currency ="usd") override
Forward to the facade. The ioc parameter of PriceHttpClient::FetchPrices is currently unused inside the facade (a fresh per-attempt context is built at PriceHttpClient.cpp:109) — the adapter closes over the manager's ioc to satisfy D-02/D-04's construction-time wiring with zero Phase 2 signature changes and zero runtime effect today; do not build machinery around that parameter.

Additional inherited members

Public Functions inherited from sgns::IPriceSource

Name
virtual ~IPriceSource() =default
Virtual destructor to prevent memory leaks from derived classes.

Public Functions Documentation

function PriceHttpClientSource

inline PriceHttpClientSource(
    std::shared_ptr< boost::asio::io_context > ioc,
    std::string baseUrl,
    RetryConfig retryConfig ={},
    std::chrono::seconds holdOffDuration =std::chrono::seconds(60),
    RateLimitHoldOff::Clock clock =[] { return std::chrono::system_clock::now();},
    std::chrono::milliseconds requestTimeout =std::chrono::milliseconds(5000),
    ResponseFormat responseFormat =ResponseFormat::CoinGeckoSimplePrice
)

Construct the adapter; forwards every config argument to the wrapped PriceHttpClient (same defaults).

Parameters:

  • ioc The manager's io_context — closed over at construction
  • baseUrl Tier base URL
  • retryConfig Retry schedule
  • holdOffDuration 429 hold-off window
  • clock Injectable clock for hermetic hold-off tests
  • requestTimeout Per-request connect/handshake/read timeout

function FetchPrices

inline virtual PriceResult< std::vector< PriceQuote > > FetchPrices(
    const std::vector< std::string > & tokenIds,
    const std::string & currency ="usd"
) override

Forward to the facade. The ioc parameter of PriceHttpClient::FetchPrices is currently unused inside the facade (a fresh per-attempt context is built at PriceHttpClient.cpp:109) — the adapter closes over the manager's ioc to satisfy D-02/D-04's construction-time wiring with zero Phase 2 signature changes and zero runtime effect today; do not build machinery around that parameter.

Parameters:

  • tokenIds Asset ids
  • currency Target currency

Return: One PriceQuote per id the source returned, or a failure

Reimplements: sgns::IPriceSource::FetchPrices


Updated on 2026-10-09 at 04:02:48 +0000