use crate::Value;
use crate::exchange::Exchange;
#[derive(Clone)]
pub struct PredictionExchange {
pub exchange: Exchange,
pub outcomes: Value,
pub outcomes_by_id: Value,
pub events: Value,
pub events_by_slug: Value,
}
impl PredictionExchange {
pub fn new(config: Option<Value>) -> Self {
Self {
exchange: Exchange::new(config),
outcomes: Value::Null,
outcomes_by_id: Value::Null,
events: Value::Null,
events_by_slug: Value::Null,
}
}
}
pub trait PredictionRuntime: crate::prediction_exchange_generated::PredictionBase {
fn super_fetch_outcome(&mut self, outcome_symbol: Value) -> impl ::std::future::Future<Output = Value> + Send { async move {
<Self as crate::prediction_exchange_generated::PredictionBase>::fetch_outcome(self, outcome_symbol).await
} }
fn super_fetch_ohlcv(&mut self, symbol: Value, timeframe: Value, since: Value, limit: Value, params: Value) -> impl ::std::future::Future<Output = Value> + Send { async move {
<Self as crate::exchange_generated::ExchangeBase>::fetch_ohlcv(self, symbol, &[timeframe, since, limit, params]).await
} }
}
impl<T: crate::prediction_exchange_generated::PredictionBase> PredictionRuntime for T {}
impl std::ops::Deref for PredictionExchange {
type Target = Exchange;
fn deref(&self) -> &Self::Target { &self.exchange }
}
impl std::ops::DerefMut for PredictionExchange {
fn deref_mut(&mut self) -> &mut Self::Target { &mut self.exchange }
}