mod alphavantage;
mod coinbase;
mod coincap;
mod coinmarketcap;
mod eastmoneyfund;
mod ecb;
mod oanda;
mod quandl;
mod ratesapi;
mod tsp;
mod yahoo;
pub use alphavantage::AlphaVantageSource;
pub use coinbase::CoinbaseSource;
pub use coincap::CoinCapSource;
pub use coinmarketcap::CoinMarketCapSource;
pub use eastmoneyfund::EastMoneyFundSource;
pub use ecb::EcbSource;
pub use oanda::OandaSource;
pub use quandl::QuandlSource;
pub use ratesapi::RatesApiSource;
pub use tsp::TspSource;
pub use yahoo::YahooFinanceSource;
use super::{PriceRequest, PriceResponse};
use anyhow::Result;
pub trait PriceSource: Send + Sync {
fn name(&self) -> &'static str;
fn description(&self) -> &'static str;
fn requires_api_key(&self) -> bool {
false
}
fn api_key_env_var(&self) -> Option<&'static str> {
None
}
fn fetch_price(&self, request: &PriceRequest) -> Result<PriceResponse>;
}
pub(crate) const fn user_agent() -> &'static str {
"Mozilla/5.0 (compatible; rustledger/1.0; +https://github.com/rustledger/rustledger)"
}