YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
CNT 2.1 β HF Inference Endpoint
Price-only credit spread profitability predictor for NIFTY options.
60 close-price candles β Chronos-2 base (768D) β MLP classifiers β bull/bear probabilities
Serves both spread widths per direction: width-100 (legacy keys, primary
bull_probability/bear_probability) and width-200 (_w200 keys). One
embedding pass feeds all classifiers.
Files
handler.pyβ Endpoint handlerrequirements.txtβ Python dependenciesmodel_store/β Classifier weights, scalers, metadata (built from the MLflow registry)model_store/deployment_manifest.jsonβ registry versions, run IDs, hashes of this build.hfignoreβ Excluded from upload
No adapter directory needed β loads amazon/chronos-2 base model from HF hub.
Prepare & Upload
python -m deploy.build_model_store # pulls @production versions from MLflow registry
cd hf_inference && python test_handler.py # local smoke test
Then, from the project root, python upload_to_hf.py. A push is an immediate
production release β the endpoint auto-tracks the latest revision. Verify
locally first; after pushing run python test_hf_point.py and compare
thresholds against deployment_manifest.json.
(sync_assets.sh is the legacy path-based sync β deprecated, see
DEPLOYMENT_AUDIT_CNT21.md for why.)
Input contract
POST JSON body:
{
"inputs": [
{"date": "2025-06-30 09:15:00", "close": 24150.5},
{"date": "2025-06-30 09:18:00", "close": 24148.2}
],
"parameters": {"context_length": 60}
}
Required columns
| Column | Type | Description |
|---|---|---|
date |
str | Datetime (e.g. "2025-06-30 09:15:00") |
close |
float | NIFTY 50 spot close price |
Minimum 60 rows (3-min candles), sorted ascending by date.
Parameters
| Key | Type | Default | Description |
|---|---|---|---|
context_length |
int | 60 | Number of trailing candles for context window |
Output contract
{
"context_window_start": "2025-06-30 09:15:00",
"context_window_end": "2025-06-30 12:12:00",
"embedding_dim": 768,
"bull_probability": 0.39,
"bear_probability": 0.63,
"bull_probability_w200": 0.41,
"bear_probability_w200": 0.65,
"predictions": {
"bull_put_credit": { "model_key": "bull_put_credit", "target_column": "bull_put_credit_label", "prob_label_1": 0.39, "threshold": 0.633, "y_pred_bin": 0, "y_pred_label": -1 },
"bear_call_credit": { "model_key": "bear_call_credit", "target_column": "bear_call_credit_label", "prob_label_1": 0.63, "threshold": 0.627, "y_pred_bin": 1, "y_pred_label": 1 },
"bull_put_credit_w200": { "model_key": "bull_put_credit_w200", "target_column": "bull_put_credit_label", "prob_label_1": 0.41, "threshold": 0.656, "y_pred_bin": 0, "y_pred_label": -1 },
"bear_call_credit_w200": { "model_key": "bear_call_credit_w200", "target_column": "bear_call_credit_label", "prob_label_1": 0.65, "threshold": 0.648, "y_pred_bin": 1, "y_pred_label": 1 }
}
}
| Field | Type | Description |
|---|---|---|
bull_probability |
float | P(profitable), bull put credit spread, width 100 (primary) |
bear_probability |
float | P(profitable), bear call credit spread, width 100 (primary) |
bull_probability_w200 |
float | P(profitable), bull put credit spread, width 200 |
bear_probability_w200 |
float | P(profitable), bear call credit spread, width 200 |
y_pred_label |
int | 1 = profitable, -1 = not profitable |
threshold |
float | Decision threshold (tuned for high precision at β₯20% recall) |
Current build thresholds: w100 bear_call 0.6268, bull_put 0.6326; w200
bear_call 0.6482, bull_put 0.6564 (see deployment_manifest.json).
Dependency note
- Keep torch aligned with HF base image to avoid ABI errors.
- No
peftdependency needed (base model only, no LoRA adapter).