pulse-core
Shared models, strategy framework, and DB session for Pulse.
This package is the foundation layer consumed by both pulse-backend (FastAPI) and Airflow DAGs. It owns the SQLModel/SQLAlchemy models, the strategy engine abstraction, and a lightweight DB session factory.
Package structure
pulse_core/
├── db.py # Singleton engine + context-managed Session
├── models/
│ ├── engine.py # Engine table (registry metadata)
│ ├── market.py # Exchange, Instrument, Listing, DataSource
│ ├── mixins.py # TimestampMixin, SoftDeleteMixin
│ ├── prices.py # TimeFrame, PriceOHLCV
│ └── signals.py # Strategy, Signal, Subscription, Delivery*
└── strategies/
├── base.py # BaseStrategy ABC, SignalOutput, UniverseFilter
├── indicators.py # Pure-numpy indicator library (SMA, ADX, BB, …)
├── registry.py # StrategyRegistry (decorator-based)
├── sync.py # sync_engine_registry() — Python ↔ DB reconciliation
└── engines/
├── mean_reversion.py # Dual MA mean-reversion
└── regime_mean_reversion.py # Regime-based probabilistic mean-reversion
Installation
# from the repo root
uv pip install -e pulse-core
Or as a dependency in another package's pyproject.toml:
dependencies = [
"pulse-core @ file:///${PROJECT_ROOT}/pulse-core",
]
Usage
Database session
from pulse_core.db import get_session
# Reads PULSE_DB_URL from the environment
with get_session() as session:
...
Models
from pulse_core.models import Listing, PriceOHLCV, Signal, Engine
Writing a strategy engine
Subclass BaseStrategy, implement validate_parameters() and compute(), then register it with the @StrategyRegistry.register decorator:
from pulse_core.strategies import BaseStrategy, SignalOutput, StrategyRegistry
@StrategyRegistry.register("my_engine")
class MyEngine(BaseStrategy):
display_name = "My Engine"
description = "Short description of the strategy."
def validate_parameters(self) -> None:
# raise ValueError if self.parameters is invalid
...
def compute(self, listing, candles, as_of) -> SignalOutput | None:
# return a SignalOutput or None
...
The engine is auto-discovered at import time via pulse_core.strategies.engines.__init__.
Syncing the registry to the database
from pulse_core.db import get_session
from pulse_core.strategies.sync import sync_engine_registry
with get_session() as session:
result = sync_engine_registry(session)
print(f"upserted={result.upserted}, deactivated={result.deactivated}")
Requirements
- Python >= 3.12
- PostgreSQL (TimescaleDB) — connected via
PULSE_DB_URL
Development
# lint
uv run --group dev ruff check .
# tests
uv run --group test pytest
Metadata
Release files for pulse-core 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pulse_core-0.1.3.tar.gz | 41.5 kB | Without provenance | Details for pulse_core-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pulse_core-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for pulse_core-0.1.3-py3-none-any.whl |
Total release size: 63.7 kB
Release files / pulse_core-0.1.3.tar.gz
| Download URL | pulse_core-0.1.3.tar.gz |
|---|---|
| Size | 41.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
230c4357c99f732d0e32efe9c5e0cfbfccc457eeccbc2632ff68dcfa68d985e7
|
|
BLAKE2b-256 checksum How to use checksums |
488f6bedfa69251bfcde983326bfb61c6befa75336e316524a72cc9d875493c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pulse_core-0.1.3-py3-none-any.whl
| Download URL | pulse_core-0.1.3-py3-none-any.whl |
|---|---|
| Size | 22.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f8195ce5bde37ab5fcb752686b146097465a057df3557a6d61d2a5e290b2400
|
|
BLAKE2b-256 checksum How to use checksums |
9f809e78e84e14e1879c8e53deecc48ae6e485f9fefe9a92555f980824b06934
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for pulse-core 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.