Crate prediction_sdk

Crate prediction_sdk 

Source
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§

analysis
analysis_deep
cache
dto
handler
implementation

Structs§

ChartCandle
Candlestick data derived from CoinGecko endpoints or locally aggregated.
CovariatePoint
ForecastBandPoint
ForecastChart
ForecastDecomposition
Breakdown of a short-term forecast signal.
ForecastRequest
Request payload for generating forecasts.
ForecastResponse
IntervalCalibration
LongForecastResult
Result of a long-horizon forecast.
MlForecast
MlModelConfig
MonteCarloBenchmark
MonteCarloRun
PredictionSdk
PricePoint
Time-series market observation used for forecasting.
SamplePath
SentimentSnapshot
Sentiment snapshot applied as an optional modifier to forecasts.
ShortForecastResult
Result of a short-horizon forecast.
SimulationStepSample
TechnicalSignals

Enums§

ForecastHorizon
Wrapper for selecting either a short or long forecast horizon.
ForecastResult
Forecast output paired with the horizon variant.
LongForecastHorizon
Longer-term forecast horizons ranging from one day to four years.
MlModelKind
PredictionError
Errors that can be returned by the SDK when fetching data or producing forecasts.
ShortForecastHorizon
Short forecast horizons used for intraday predictions.

Functions§

run_prediction_handler
Execute a forecast based on a ForecastRequest, returning serialized JSON.