File size: 2,848 Bytes
65bd6bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
title: Kronos + Laya Portfolio & Trade Analysis Engine
emoji: πŸš€
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 5.20.0
app_file: app.py
pinned: false
---

# πŸš€ Kronos Foundation Models + Laya Portfolio + Dual Trade-Analysis Engine

A 24/7/365 production quantitative intelligence and self-improving trading suite running natively on Hugging Face CPU Basic:

1. **πŸ“ˆ Kronos Foundation Models** (`Kronos-mini`, `Kronos-small`, `Kronos-base`): Autoregressive K-line price path simulation with 5%, 50%, 95% quantile cones.
2. **⚑ Laya Portfolio & Risk Engine (System 1)**: Sub-50ms calibrated portfolio risk gating, dynamic stop loss/take profit levels, and capital preservation.
3. **πŸ”¬ Trade Execution Post-Mortem Analyst** (`Qwen/Qwen2.5-1.5B-Instruct`): Grades closed trades (A+ to F), diagnoses statistical edge vs execution error vs macro shock, and produces calibrated rule adjustments for self-improving bots.
4. **πŸ“° Financial Catalyst Correlator** (`ProsusAI/finbert`): Sub-15ms macroeconomic news and headline sentiment analyzer scoring market bias (-1.0 to +1.0).

---

## 🌐 API Endpoints

### 1. `POST /v1/predict-trade` β€” Quantitative Forecast & Laya Risk Signal
```bash
curl -X POST https://devinblaze-laya-engine.hf.space/v1/predict-trade \
  -H "Content-Type: application/json" \
  -d '{
    "symbol": "BTC-USD",
    "model_size": "mini",
    "interval": "1h",
    "pred_len": 12,
    "paths_count": 10,
    "headline": "Fed signals potential rate pause in upcoming FOMC meeting"
  }'
```

### 2. `POST /v1/analyze-trade` β€” Dual-Model Trade Diagnosis & Self-Improvement
Sent automatically by your trading bot after each closed trade to grade execution and recalibrate strategy parameters:
```bash
curl -X POST https://devinblaze-laya-engine.hf.space/v1/analyze-trade \
  -H "Content-Type: application/json" \
  -d '{
    "symbol": "BTC-USD",
    "trade_type": "LONG",
    "entry_price": 85000.0,
    "exit_price": 83400.0,
    "pnl_pct": -1.88,
    "duration_hours": 4,
    "kronos_q5": 84100.0,
    "kronos_q50": 86200.0,
    "kronos_q95": 87500.0,
    "macro_news": "Hot CPI inflation release caused sudden flash dump"
  }'
```

### 3. `POST /v1/chat/completions` β€” OpenAI Compatible Endpoint
High-speed CPU-optimized quantitative inference for OmniRoute, Hermes Agent, and custom tools:
```bash
curl -X POST https://devinblaze-laya-engine.hf.space/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-1.5b-analyst",
    "messages": [{"role": "user", "content": "Explain why volatility cones widen during high CPI prints."}]
  }'
```

### 4. `POST /v1/systemone` β€” Laya 33ms Reflex Router
Fast zero-token portfolio triage and risk filtering.

### 5. `GET /health` β€” Service Status & Active Model Registry
Check runtime health and verify active model weights.