Spaces:
No application file
No application file
Dmitry Beresnev commited on
Commit ·
a71dd82
1
Parent(s): 7b8151d
uv migrations
Browse files- .gitignore +3 -0
- README.md +7 -1
- app.py +5 -0
- docs/CURRENT_VERSION.md +2 -2
- pyproject.toml +24 -0
- requirements.txt +0 -6
- src/__init__.py +1 -0
- src/core/main.py +23 -2
.gitignore
CHANGED
|
@@ -165,3 +165,6 @@ poetry.lock
|
|
| 165 |
|
| 166 |
# Model checkpoints
|
| 167 |
*.ckpt
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
|
| 166 |
# Model checkpoints
|
| 167 |
*.ckpt
|
| 168 |
+
|
| 169 |
+
*.md
|
| 170 |
+
*.python-version
|
README.md
CHANGED
|
@@ -31,7 +31,13 @@ Defined in `configs/topics.yaml`:
|
|
| 31 |
|
| 32 |
## Run
|
| 33 |
```bash
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
```
|
| 36 |
|
| 37 |
## Notes
|
|
|
|
| 31 |
|
| 32 |
## Run
|
| 33 |
```bash
|
| 34 |
+
uv sync
|
| 35 |
+
uv run python -m src.core.main
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
## App Entrypoint
|
| 39 |
+
```bash
|
| 40 |
+
uv run python app.py
|
| 41 |
```
|
| 42 |
|
| 43 |
## Notes
|
app.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from src.core.main import run_forever
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
if __name__ == "__main__":
|
| 5 |
+
run_forever()
|
docs/CURRENT_VERSION.md
CHANGED
|
@@ -255,8 +255,8 @@ Important values:
|
|
| 255 |
|
| 256 |
Install dependencies and run:
|
| 257 |
```bash
|
| 258 |
-
|
| 259 |
-
python -m src.core.main
|
| 260 |
```
|
| 261 |
|
| 262 |
Recommended quick checks:
|
|
|
|
| 255 |
|
| 256 |
Install dependencies and run:
|
| 257 |
```bash
|
| 258 |
+
uv sync
|
| 259 |
+
uv run python -m src.core.main
|
| 260 |
```
|
| 261 |
|
| 262 |
Recommended quick checks:
|
pyproject.toml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[project]
|
| 2 |
+
name = "market-analyzing-platform"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
description = "Market-wide risk radar with universe loading, price ingestion, and alerting."
|
| 5 |
+
readme = "README.md"
|
| 6 |
+
requires-python = ">=3.10,<3.13"
|
| 7 |
+
dependencies = [
|
| 8 |
+
"lxml",
|
| 9 |
+
"numpy",
|
| 10 |
+
"pandas",
|
| 11 |
+
"pyyaml",
|
| 12 |
+
"requests",
|
| 13 |
+
"yfinance",
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
[project.scripts]
|
| 17 |
+
market-analyzing-platform = "src.core.main:run_forever"
|
| 18 |
+
|
| 19 |
+
[build-system]
|
| 20 |
+
requires = ["hatchling"]
|
| 21 |
+
build-backend = "hatchling.build"
|
| 22 |
+
|
| 23 |
+
[tool.hatch.build.targets.wheel]
|
| 24 |
+
packages = ["src"]
|
requirements.txt
DELETED
|
@@ -1,6 +0,0 @@
|
|
| 1 |
-
yfinance
|
| 2 |
-
pandas
|
| 3 |
-
numpy
|
| 4 |
-
requests
|
| 5 |
-
lxml
|
| 6 |
-
pyyaml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"""Top-level package marker for local imports and packaging."""
|
src/core/main.py
CHANGED
|
@@ -41,7 +41,7 @@ def _infer_asset_class(venue_key: str) -> str:
|
|
| 41 |
return "equity"
|
| 42 |
|
| 43 |
|
| 44 |
-
|
| 45 |
pubsub = PubSub()
|
| 46 |
notifier = TelegramNotifier()
|
| 47 |
queue = AlertQueue(max_retries=ALERT_MAX_RETRIES, backoff_base_sec=ALERT_BACKOFF_BASE_SEC)
|
|
@@ -66,6 +66,27 @@ if __name__ == "__main__":
|
|
| 66 |
snapshot = loader.build_snapshot(universe)
|
| 67 |
pubsub.publish(TOPICS["universe_snapshot"], snapshot)
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
while True:
|
| 70 |
-
run_once(pubsub, loader, universe, queue, notifier)
|
| 71 |
time.sleep(POLL_INTERVAL_SEC)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
return "equity"
|
| 42 |
|
| 43 |
|
| 44 |
+
def build_runtime():
|
| 45 |
pubsub = PubSub()
|
| 46 |
notifier = TelegramNotifier()
|
| 47 |
queue = AlertQueue(max_retries=ALERT_MAX_RETRIES, backoff_base_sec=ALERT_BACKOFF_BASE_SEC)
|
|
|
|
| 66 |
snapshot = loader.build_snapshot(universe)
|
| 67 |
pubsub.publish(TOPICS["universe_snapshot"], snapshot)
|
| 68 |
|
| 69 |
+
return {
|
| 70 |
+
"pubsub": pubsub,
|
| 71 |
+
"notifier": notifier,
|
| 72 |
+
"queue": queue,
|
| 73 |
+
"loader": loader,
|
| 74 |
+
"universe": universe,
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def run_single_cycle(runtime=None):
|
| 79 |
+
state = runtime or build_runtime()
|
| 80 |
+
run_once(state["pubsub"], state["loader"], state["universe"], state["queue"], state["notifier"])
|
| 81 |
+
return state
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def run_forever():
|
| 85 |
+
state = build_runtime()
|
| 86 |
while True:
|
| 87 |
+
run_once(state["pubsub"], state["loader"], state["universe"], state["queue"], state["notifier"])
|
| 88 |
time.sleep(POLL_INTERVAL_SEC)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
if __name__ == "__main__":
|
| 92 |
+
run_forever()
|