Expand description
Entry point for the prediction SDK crate. Consumers should import exported types via the crate root.
§Example
use chrono::{Duration, Utc};
use prediction_sdk::{
ForecastHorizon, PredictionSdk, PricePoint, SentimentSnapshot, ShortForecastHorizon,
};
#[tokio::main]
async fn main() -> Result<(), prediction_sdk::PredictionError> {
let sdk = PredictionSdk::new()?;
let history: Vec<PricePoint> = (0..50)
.map(|idx| PricePoint {
timestamp: Utc::now() - Duration::minutes(idx),
price: 100.0 + idx as f64,
volume: None,
})
.collect();
let sentiment = SentimentSnapshot {
news_score: 0.25,
social_score: 0.1,
};
let forecast = sdk
.forecast(
&history,
ForecastHorizon::Short(ShortForecastHorizon::OneHour),
Some(sentiment),
)
.await?;
println!("{forecast:?}");
Ok(())
}Modules§
Structs§
- Chart
Candle - Candlestick data derived from CoinGecko endpoints or locally aggregated.
- Covariate
Point - Forecast
Band Point - Forecast
Chart - Forecast
Decomposition - Breakdown of a short-term forecast signal.
- Forecast
Request - Request payload for generating forecasts.
- Forecast
Response - Interval
Calibration - Long
Forecast Result - Result of a long-horizon forecast.
- MlForecast
- MlModel
Config - Monte
Carlo Benchmark - Monte
Carlo Run - Prediction
Sdk - Price
Point - Time-series market observation used for forecasting.
- Sample
Path - Sentiment
Snapshot - Sentiment snapshot applied as an optional modifier to forecasts.
- Short
Forecast Result - Result of a short-horizon forecast.
- Simulation
Step Sample - Technical
Signals
Enums§
- Forecast
Horizon - Wrapper for selecting either a short or long forecast horizon.
- Forecast
Result - Forecast output paired with the horizon variant.
- Long
Forecast Horizon - Longer-term forecast horizons ranging from one day to four years.
- MlModel
Kind - Prediction
Error - Errors that can be returned by the SDK when fetching data or producing forecasts.
- Short
Forecast Horizon - Short forecast horizons used for intraday predictions.
Functions§
- run_
prediction_ handler - Execute a forecast based on a
ForecastRequest, returning serialized JSON.