cadlag-starter 1.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cadlag-starter might be problematic. Click here for more details.

Files changed (36) hide show
  1. cadlag_starter-1.0.4/LICENSE +17 -0
  2. cadlag_starter-1.0.4/PKG-INFO +65 -0
  3. cadlag_starter-1.0.4/README.md +33 -0
  4. cadlag_starter-1.0.4/cadlag_starter/__init__.py +13 -0
  5. cadlag_starter-1.0.4/cadlag_starter/data/__init__.py +8 -0
  6. cadlag_starter-1.0.4/cadlag_starter/data/assets/sample_ohlcv.parquet +0 -0
  7. cadlag_starter-1.0.4/cadlag_starter/data/fixtures.py +78 -0
  8. cadlag_starter-1.0.4/cadlag_starter/examples/sdk_demo.ipynb +620 -0
  9. cadlag_starter-1.0.4/cadlag_starter/features/__init__.py +8 -0
  10. cadlag_starter-1.0.4/cadlag_starter/features/sma_rsi.py +93 -0
  11. cadlag_starter-1.0.4/cadlag_starter/models/__init__.py +80 -0
  12. cadlag_starter-1.0.4/cadlag_starter/models/pytorch/__init__.py +8 -0
  13. cadlag_starter-1.0.4/cadlag_starter/models/pytorch/basic_lstm.py +164 -0
  14. cadlag_starter-1.0.4/cadlag_starter/models/sklearn/__init__.py +8 -0
  15. cadlag_starter-1.0.4/cadlag_starter/models/sklearn/random_forest.py +102 -0
  16. cadlag_starter-1.0.4/cadlag_starter/models/tensorflow/__init__.py +8 -0
  17. cadlag_starter-1.0.4/cadlag_starter/models/tensorflow/basic_lstm.py +129 -0
  18. cadlag_starter-1.0.4/cadlag_starter/py.typed +0 -0
  19. cadlag_starter-1.0.4/cadlag_starter/scripts/__init__.py +6 -0
  20. cadlag_starter-1.0.4/cadlag_starter/scripts/ingest_mt5.py +84 -0
  21. cadlag_starter-1.0.4/cadlag_starter/strategies/__init__.py +61 -0
  22. cadlag_starter-1.0.4/cadlag_starter/strategies/sma_crossover.py +111 -0
  23. cadlag_starter-1.0.4/cadlag_starter/strategies/threshold_ml.py +107 -0
  24. cadlag_starter-1.0.4/cadlag_starter/trainers/__init__.py +9 -0
  25. cadlag_starter-1.0.4/cadlag_starter/trainers/common.py +104 -0
  26. cadlag_starter-1.0.4/cadlag_starter/trainers/pytorch_basic.py +159 -0
  27. cadlag_starter-1.0.4/cadlag_starter/trainers/tensorflow_basic.py +172 -0
  28. cadlag_starter-1.0.4/cadlag_starter.egg-info/PKG-INFO +65 -0
  29. cadlag_starter-1.0.4/cadlag_starter.egg-info/SOURCES.txt +34 -0
  30. cadlag_starter-1.0.4/cadlag_starter.egg-info/dependency_links.txt +1 -0
  31. cadlag_starter-1.0.4/cadlag_starter.egg-info/entry_points.txt +11 -0
  32. cadlag_starter-1.0.4/cadlag_starter.egg-info/requires.txt +23 -0
  33. cadlag_starter-1.0.4/cadlag_starter.egg-info/top_level.txt +1 -0
  34. cadlag_starter-1.0.4/pyproject.toml +82 -0
  35. cadlag_starter-1.0.4/setup.cfg +4 -0
  36. cadlag_starter-1.0.4/tests/test_entry_points.py +62 -0
@@ -0,0 +1,17 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright (c) 2026 Cadlag
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: cadlag-starter
3
+ Version: 1.0.4
4
+ Summary: Cadlag Starter — public SDK demo models, strategies, data fixtures, and notebook walkthrough
5
+ Maintainer-email: Cadlag <info@cadlag.pro>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://cadlag.pro
8
+ Project-URL: Repository, https://github.com/cadlag-quant/cadlag
9
+ Requires-Python: >=3.11
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: cadlag-sdk<2.0,>=1.0.4
13
+ Requires-Dist: numpy>=1.24
14
+ Requires-Dist: pandas>=2.0
15
+ Requires-Dist: pyarrow>=14.0
16
+ Provides-Extra: dev
17
+ Requires-Dist: pytest>=7.4; extra == "dev"
18
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
19
+ Requires-Dist: nbconvert>=7.0; extra == "dev"
20
+ Requires-Dist: nbformat>=5.9; extra == "dev"
21
+ Requires-Dist: ipykernel>=6.0; extra == "dev"
22
+ Requires-Dist: ruff>=0.3; extra == "dev"
23
+ Requires-Dist: mypy>=1.8; extra == "dev"
24
+ Provides-Extra: tensorflow
25
+ Requires-Dist: tensorflow<2.16,>=2.14; extra == "tensorflow"
26
+ Provides-Extra: pytorch
27
+ Requires-Dist: torch>=2.1; extra == "pytorch"
28
+ Provides-Extra: sklearn
29
+ Requires-Dist: scikit-learn>=1.3; extra == "sklearn"
30
+ Requires-Dist: joblib>=1.3; extra == "sklearn"
31
+ Dynamic: license-file
32
+
33
+ # Cadlag Starter
34
+
35
+ Cadlag Starter is a small Apache-2.0 SDK demo package for building against a running Cadlag platform. It provides a synthetic OHLCV fixture, a thin MT5 ingest command, lightweight model and strategy provider entry points, and a packaged notebook walkthrough.
36
+
37
+ ## Install
38
+
39
+ ```bash
40
+ pip install -e './cadlag-starter[dev,tensorflow,pytorch,sklearn]'
41
+ ```
42
+
43
+ ## Data Fixture
44
+
45
+ ```python
46
+ from cadlag_starter.data import load_sample_ohlcv
47
+
48
+ bars = load_sample_ohlcv()
49
+ print(bars.head())
50
+ ```
51
+
52
+ The bundled sample is deterministic synthetic data with public metadata attached to the returned DataFrame.
53
+
54
+ ## MT5 Ingest
55
+
56
+ ```bash
57
+ cadlag-starter-ingest-mt5 \
58
+ --symbol EURUSD \
59
+ --interval H1 \
60
+ --start-date 2026-01-01 \
61
+ --end-date 2026-01-07 \
62
+ --dataset-name starter-eurusd-h1
63
+ ```
64
+
65
+ The command is a convenience wrapper around `CadlagClient.data.ingest()` and can optionally query the platform after ingest with `--verify-readback`.
@@ -0,0 +1,33 @@
1
+ # Cadlag Starter
2
+
3
+ Cadlag Starter is a small Apache-2.0 SDK demo package for building against a running Cadlag platform. It provides a synthetic OHLCV fixture, a thin MT5 ingest command, lightweight model and strategy provider entry points, and a packaged notebook walkthrough.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install -e './cadlag-starter[dev,tensorflow,pytorch,sklearn]'
9
+ ```
10
+
11
+ ## Data Fixture
12
+
13
+ ```python
14
+ from cadlag_starter.data import load_sample_ohlcv
15
+
16
+ bars = load_sample_ohlcv()
17
+ print(bars.head())
18
+ ```
19
+
20
+ The bundled sample is deterministic synthetic data with public metadata attached to the returned DataFrame.
21
+
22
+ ## MT5 Ingest
23
+
24
+ ```bash
25
+ cadlag-starter-ingest-mt5 \
26
+ --symbol EURUSD \
27
+ --interval H1 \
28
+ --start-date 2026-01-01 \
29
+ --end-date 2026-01-07 \
30
+ --dataset-name starter-eurusd-h1
31
+ ```
32
+
33
+ The command is a convenience wrapper around `CadlagClient.data.ingest()` and can optionally query the platform after ingest with `--verify-readback`.
@@ -0,0 +1,13 @@
1
+ # Copyright (c) 2026 Cadlag. Licensed under Apache 2.0.
2
+ """Public SDK demo assets for Cadlag."""
3
+
4
+ from __future__ import annotations
5
+
6
+ from importlib.metadata import PackageNotFoundError, version
7
+
8
+ try:
9
+ __version__ = version("cadlag-starter")
10
+ except PackageNotFoundError:
11
+ __version__ = "0+unknown"
12
+
13
+ __all__ = ["__version__"]
@@ -0,0 +1,8 @@
1
+ # Copyright (c) 2026 Cadlag. Licensed under Apache 2.0.
2
+ """Synthetic public data fixtures for Cadlag Starter."""
3
+
4
+ from __future__ import annotations
5
+
6
+ from cadlag_starter.data.fixtures import load_sample_ohlcv, sample_asset_path, write_sample_ohlcv
7
+
8
+ __all__ = ["load_sample_ohlcv", "sample_asset_path", "write_sample_ohlcv"]
@@ -0,0 +1,78 @@
1
+ # Copyright (c) 2026 Cadlag. Licensed under Apache 2.0.
2
+ """Deterministic synthetic OHLCV fixtures for demos and tests."""
3
+
4
+ from __future__ import annotations
5
+
6
+ from pathlib import Path
7
+ from typing import Final
8
+
9
+ import numpy as np
10
+ import pandas as pd
11
+
12
+ _FIXTURE_NAME: Final = "sample_ohlcv"
13
+ _METADATA: Final[dict[str, str]] = {
14
+ "fixture_name": _FIXTURE_NAME,
15
+ "fixture_kind": "public_synthetic_ohlcv",
16
+ "symbol": "QOSDEMO",
17
+ "interval": "H1",
18
+ }
19
+
20
+
21
+ def sample_asset_path(name: str = _FIXTURE_NAME) -> Path:
22
+ """Return the path to a bundled sample asset."""
23
+ if name != _FIXTURE_NAME:
24
+ raise ValueError(f"Unknown Cadlag Starter fixture: {name}")
25
+ return Path(__file__).resolve().parent / "assets" / f"{_FIXTURE_NAME}.parquet"
26
+
27
+
28
+ def load_sample_ohlcv(name_or_path: str | Path = _FIXTURE_NAME) -> pd.DataFrame:
29
+ """Load the bundled synthetic OHLCV sample or a compatible Parquet file."""
30
+ path = (
31
+ sample_asset_path(name_or_path)
32
+ if isinstance(name_or_path, str) and name_or_path == _FIXTURE_NAME
33
+ else Path(name_or_path)
34
+ )
35
+ if not path.exists():
36
+ raise ValueError(f"OHLCV fixture does not exist: {path}")
37
+ frame = pd.read_parquet(path)
38
+ if "timestamp" in frame.columns:
39
+ frame["timestamp"] = pd.to_datetime(frame["timestamp"], utc=True)
40
+ frame.attrs.update(_METADATA)
41
+ return frame
42
+
43
+
44
+ def write_sample_ohlcv(path: str | Path, *, rows: int = 240) -> Path:
45
+ """Write a deterministic public synthetic OHLCV Parquet fixture."""
46
+ if rows < 32:
47
+ raise ValueError("rows must be at least 32")
48
+
49
+ output_path = Path(path)
50
+ output_path.parent.mkdir(parents=True, exist_ok=True)
51
+
52
+ rng = np.random.default_rng(20260523)
53
+ timestamp = pd.date_range("2026-01-01T00:00:00Z", periods=rows, freq="h")
54
+ steps = rng.normal(loc=0.0002, scale=0.0035, size=rows).cumsum()
55
+ close = 100.0 + steps
56
+ open_ = close + rng.normal(loc=0.0, scale=0.05, size=rows)
57
+ spread = rng.uniform(0.03, 0.18, size=rows)
58
+ high = np.maximum(open_, close) + spread
59
+ low = np.minimum(open_, close) - spread
60
+ volume = rng.integers(900, 3200, size=rows)
61
+
62
+ frame = pd.DataFrame(
63
+ {
64
+ "timestamp": timestamp,
65
+ "symbol": _METADATA["symbol"],
66
+ "interval": _METADATA["interval"],
67
+ "open": open_.round(5),
68
+ "high": high.round(5),
69
+ "low": low.round(5),
70
+ "close": close.round(5),
71
+ "volume": volume.astype("int64"),
72
+ "provider": "synthetic",
73
+ "data_type": "ohlcv",
74
+ }
75
+ )
76
+ frame.attrs.update(_METADATA)
77
+ frame.to_parquet(output_path, index=False)
78
+ return output_path