Foundation model adapter layer for quantitative forecasting in the Mimic ecosystem
Project description
mimic-forecast
Foundation model adapter layer for the Mimic ecosystem.
Replace LLM-guessed financial numbers with real quantitative forecasts.
Without mimic-forecast:
twin.simulate("oil spikes") → LLM guesses financial impact
With mimic-forecast:
twin.simulate("oil spikes") → TimesFM forecasts price trajectory
→ Chronos forecasts market dynamics
→ LLM reasons on top of real numbers
Install
# Core only (abstractions + ensemble, no model deps)
pip install mimic-forecast
# With a specific model
pip install 'mimic-forecast[timesfm]'
pip install 'mimic-forecast[chronos]'
pip install 'mimic-forecast[finbert]'
# With data utilities (FRED + yfinance)
pip install 'mimic-forecast[data]'
# Everything
pip install 'mimic-forecast[all]'
Quickstart
from mimic_forecast import TimesFMAdapter
import yfinance as yf
adapter = TimesFMAdapter()
data = yf.download("WMT", period="2y")["Close"].squeeze()
forecast = adapter.forecast(data, horizon=30, frequency="D")
print(forecast.point) # 30-day point forecast
print(forecast.quantiles[0.1]) # P10 (downside)
print(forecast.quantiles[0.9]) # P90 (upside)
print(forecast.summary()) # compact dict for LLM prompts
Models
| Adapter | Model | Best For | Quantiles |
|---|---|---|---|
TimesFMAdapter |
google/timesfm-2.0-500m | Demand, retail, energy | ✓ |
ChronosAdapter |
amazon/chronos-t5-large | Multivariate, covariates | ✓ |
FinBERT2Adapter |
ProsusAI/finbert | News sentiment → signal | ✓ |
KronosAdapter |
AntGroup/Kronos | Price microstructure | ✓ |
MoiraiAdapter |
Salesforce/moirai-1.0-R-large | Zero-shot benchmark | ✓ |
BISTROAdapter |
bis-models/bistro | Macro (GDP, CPI, rates) | ✓ |
EnsembleAdapter |
weighted combination | Maximum accuracy | ✓ |
Auto-select
from mimic_forecast import AutoForecaster
# Picks the best available model per series type
af = AutoForecaster()
results = af.forecast_for_event(
context={"ticker": "WMT"},
event="oil spikes to $150",
horizon=30,
)
# results["oil_price"]["point_end"] → float
# results["oil_price"]["q10"] → float (downside)
# results["oil_price"]["model"] → "kronos-499m"
Compare Models
from mimic_forecast import compare_models, TimesFMAdapter, ChronosAdapter
results = compare_models(
series=data,
models=[TimesFMAdapter(), ChronosAdapter()],
horizon=30,
metric="RMSE",
)
print(results.winner) # "timesfm-2.0-500m"
print(results.scores) # {"timesfm-2.0-500m": 0.042, "chronos-t5-large": 0.051}
Mimic Integration
mimic-forecast is a zero-hard-dependency plugin for mimic. When installed, mimic automatically upgrades from LLM number-guessing to real forecasts.
# In mimic/core/twin.py — this is what mimic does internally:
try:
from mimic_forecast import get_forecaster
forecaster = get_forecaster(auto=True)
forecast_context = forecaster.forecast_for_event(self.context, event)
except ImportError:
forecast_context = {} # graceful fallback to LLM estimates
Architecture
mimic_forecast/
├── base.py ← ForecasterAdapter + ForecastResult
├── registry.py ← Model registry + event → series mapping
├── ensemble.py ← EnsembleAdapter
├── benchmarks.py ← Model comparison (walk-forward backtest)
├── adapters/
│ ├── timesfm.py ← Google TimesFM 2.0
│ ├── chronos.py ← Amazon Chronos T5-Large
│ ├── finbert.py ← FinBERT sentiment
│ ├── kronos.py ← Kronos market microstructure
│ ├── moirai.py ← Salesforce Moirai
│ └── bistro.py ← BIS macro model
├── data/
│ ├── series.py ← Pull from FRED / yfinance
│ └── covariates.py ← Build covariate matrices
└── integration/
└── mimic_plugin.py ← Plugin interface for mimic core
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mimic_forecast-0.1.0.tar.gz.
File metadata
- Download URL: mimic_forecast-0.1.0.tar.gz
- Upload date:
- Size: 22.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0772b09c66df9d2005407b097e3e023c4d4f4b2ee1ffd25b80d08bcbbd297852
|
|
| MD5 |
76fcc3bbd084a5062129aef8b324593a
|
|
| BLAKE2b-256 |
7aaea83d3bf099b5194bc4643668f111fd87e2629d672540fa9df281f96f3703
|
File details
Details for the file mimic_forecast-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mimic_forecast-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4b0a7b04b3f910848d624a702f727e210436b4bd9b02bf1e65c9bc6c2899a8c
|
|
| MD5 |
48daeec4c02a3f9b14222cec8c36c24b
|
|
| BLAKE2b-256 |
0eb7cf216d69436cec3b3eb6bc1d1d82e84a4819a36a7ce0c36e2c2308288ab9
|