Skip to content

coinprices/PriceQuote.hpp

Namespaces

Name
sgns

Classes

Name
struct sgns::PriceQuote
Provider-independent price quote (QUOTE-01).

Types

Name
enum class PriceSource { LocalCache, CoinGecko, GnusPriceService, OnChain}
Where a price quote came from (QUOTE-02).

Types Documentation

enum PriceSource

Enumerator Value Description
LocalCache
CoinGecko
GnusPriceService
OnChain

Where a price quote came from (QUOTE-02).

Note: OnChain is reserved for the SRC-01 deferred on-chain fallback tier and has no implementation in this phase.

Source code

#pragma once

#include <chrono>
#include <cstdint>
#include <string>

namespace sgns
{
    enum class PriceSource
    {
        LocalCache,
        CoinGecko,
        GnusPriceService,
        OnChain // reserved, SRC-01 deferred
    };

    struct PriceQuote
    {
        std::string asset;

        std::string currency;

        double price = 0.0;

        std::chrono::system_clock::time_point timestamp{};

        PriceSource source = PriceSource::CoinGecko;

        bool stale = false;

        int64_t FetchedAtEpochSeconds() const
        {
            return std::chrono::duration_cast<std::chrono::seconds>(
                       timestamp.time_since_epoch() )
                .count();
        }
    };
}

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