File size: 3,086 Bytes
be10aa0
 
 
 
 
 
 
 
 
37173e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
title: Maythos Live
emoji: 📈
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
---
# MAYTHOS Live Docker Space

This Space wraps the uploaded `maythos_patched.py` file without changing its engine meaning or public contract.

## What is included

- `maythos_patched.py`: the uploaded engine file, kept unchanged
- `runtime.py`: live data adapter, candle aggregator, signal timeline, expiry tracker, and engine runner
- `app.py`: FastAPI server and health/API endpoints
- `frontend/`: live UI for charts, raw output, debug trace, health, and source viewing
- `Dockerfile` and `requirements.txt`

## How the wiring works

The runtime loads `maythos_patched.py` dynamically, instantiates `MAYTHOS(debug_mode=True)`, and feeds it only closed 30-second candles built locally from the Deriv tick stream. The same tick stream also powers the 1m, 2m, 3m, and 5m chart views so the display stays internally consistent.

The UI shows:

- live candle chart
- live price stream
- full `MAYTHOS.tick()` output
- nested `debug_trace`
- engine health and validation errors
- warm-up state
- compact log viewer
- source-code viewer with line numbers, search, and copy

## Signal timing model

The engine itself does not emit absolute timestamps for signal creation or expiry. The wrapper keeps those as derived UI fields using the candle close time as the canonical UTC reference:

- `signal_generated_at`
- `signal_expires_at`
- `signal_countdown`
- `signal_age`
- `lifecycle_state`

These are derived from the actual lifecycle output and the same 30-second candle clock that drives the engine feed.

## Live candle aggregation

The Deriv public tick stream is bucketed locally into:

- 30s
- 1m
- 2m
- 3m
- 5m

Every timeframe uses the same tick source and the same UTC epoch boundaries, so the candles do not drift relative to each other. The engine is fed from the 30s candle close stream.

## Deriv configuration

Optional environment variables:

- `DERIV_WS_URL`: override the websocket URL
- `DERIV_APP_ID`: optional app_id query parameter, if you want to use one
- `SYMBOL_DEFAULT`: default symbol such as `frxEURUSD` or `cryBTCUSD`
- `BASE_TIMEFRAME`: engine feed timeframe in seconds; default `30`

If live data is unavailable, the runtime falls back to a visible demo mode and clearly marks it in the UI.

## Setup for Hugging Face Spaces

1. Create a new **Docker** Space.
2. Add these project files to the repo.
3. Keep the uploaded `maythos_patched.py` at the repo root unchanged.
4. Optionally set the environment variables above in Space settings.
5. Deploy.

## Notes from analysis

The file already exposes `validate()` and `engine_health()` through the `MAYTHOS` orchestrator. The output contract includes the usual signal and scoring fields plus `debug_trace`, but it does not include absolute timestamp fields for signal generation or expiry, so the wrapper derives those in the UI layer rather than altering engine output.

## Health endpoint

`GET /health` returns `OK` when the runtime is healthy. `GET /api/health` returns structured diagnostics.