Developer SDK for validating and publishing trading signals
Project description
Quant Signal SDK
This repository now contains only the developer SDK package: quant_signal_sdk.
Local executor client code has been moved to local-executor-client in the workspace.
Features
- Pydantic signal models and enums (
SignalPayload,SignalSide,SignalAction). - Retry-enabled HTTP transport (
NetworkClient) usingrequestsandurllib3.Retry. - Optional HMAC SHA-256 payload signing helper (
generate_hmac_signature). - High-level API client (
QuantSignalClient) for authenticated signal submission. - Minimal
BaseStrategycontract for strategy inheritance. - In-memory portfolio backtest runner with OHLCV replay and execution-policy enforcement.
Quickstart
from quant_signal_sdk import QuantSignalClient, SignalPayload
client = QuantSignalClient(
base_url="https://api.example.com",
api_key="your-api-key",
signer_secret="optional-signing-secret",
)
signal = SignalPayload(
side="LONG",
action="OPEN_LONG",
symbol="BTCUSDT",
tp=72000,
sl=68500,
confidence_score=0.84,
metadata={"strategy": "trend_v1"},
)
result = client.send_signal(signal)
print(result)
Backtest
Create a my_bot.py file that exports a strategy class or STRATEGY object with on_event(...), then run:
quant-sdk backtest --bot-file my_bot.py --data-csv candles.csv --initial-cash 1000
The backtest engine replays OHLCV candles, queues signals for the next tick, and prints a simple portfolio summary when the run completes.
If your OHLCV data is stored as Parquet (recommended per GUIDE_DATA.md), point the CLI at the Parquet file or directory. Example using the dataset layout in GUIDE_DATA.md:
python -m quant_signal_sdk.cli backtest --bot-file my_bot.py \
--data-parquet "D:\Code\Projects\self-projects\macd-overlay - Copy\data\ohlcv\BTCUSDT.parquet" \
--timestamp-column timestamp --initial-cash 1000 --output-dir backtest_output_parquet --export-html
The CLI accepts either --data-csv (legacy) or --data-parquet (preferred). When a directory is passed to --data-parquet the first *.parquet file is used.
Requirements
- Python 3.10+
Setup
Install the library for local development:
pip install -e .
Install with SDK development tools:
pip install -e .[dev]
Install optional market-data helpers:
pip install -e .[market-data]
Install both dev and market-data extras together:
pip install -e .[dev,market-data]
After publishing to PyPI, users can install the released package with:
pip install quant-signal-sdk
Tests
python -m unittest discover -s tests -v
Release
Build the distribution and validate the artifacts before upload:
python -m build --sdist --wheel
python -m twine check dist/*
python -m twine upload dist/*
Example: register -> signer secret behavior
When registering a bot via the example examples/sample_bot.py, the backend returns
both an apiKey (runtime API key) and a rawSecret (signer secret). The example
attaches the returned rawSecret to the QuantSignalClient as the signer_secret
when the user did not already supply one. This ensures subsequent signal POSTs
include the required X-Timestamp and X-Signature headers that the server
validates.
If you prefer to manage signing secrets yourself, pass --bot-signer-secret to
the example and the returned rawSecret will not overwrite it.
Build
python -m build --sdist --wheel
Contract Fixtures
- SDK fixtures are versioned under
tests/fixtures/contracts. - SDK compatibility checks are in
tests/test_contract_compatibility_sdk.py.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quant_signal_sdk-0.1.0.tar.gz.
File metadata
- Download URL: quant_signal_sdk-0.1.0.tar.gz
- Upload date:
- Size: 47.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6ef0a78935ff31010633659a88f05515db442c200b5a3e069c3f1b90f66efd7
|
|
| MD5 |
435c107778058681dadff70fef229119
|
|
| BLAKE2b-256 |
961c00b2efaa953956d9323e9214548fa8df14d2f881c9e24fdc1aeed71e2b5b
|
Provenance
The following attestation bundles were made for quant_signal_sdk-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on gnuhhung317/marcus-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quant_signal_sdk-0.1.0.tar.gz -
Subject digest:
e6ef0a78935ff31010633659a88f05515db442c200b5a3e069c3f1b90f66efd7 - Sigstore transparency entry: 1720972863
- Sigstore integration time:
-
Permalink:
gnuhhung317/marcus-py@2aaf415d94e654ed2f4ce7d935b1b638aed146ec -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/gnuhhung317
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@2aaf415d94e654ed2f4ce7d935b1b638aed146ec -
Trigger Event:
release
-
Statement type:
File details
Details for the file quant_signal_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: quant_signal_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 43.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43b77c7002fbefef5f2918fd81c0b72e35aa896165bc25882dd3be72e8d7cf4c
|
|
| MD5 |
d9ca521df112b5df97ccb0acc3b0ae21
|
|
| BLAKE2b-256 |
3f5793ebb3b39bd6d872c1ff3af19540dbfbdb77655873f998ebe48df55aca85
|
Provenance
The following attestation bundles were made for quant_signal_sdk-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on gnuhhung317/marcus-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quant_signal_sdk-0.1.0-py3-none-any.whl -
Subject digest:
43b77c7002fbefef5f2918fd81c0b72e35aa896165bc25882dd3be72e8d7cf4c - Sigstore transparency entry: 1720973139
- Sigstore integration time:
-
Permalink:
gnuhhung317/marcus-py@2aaf415d94e654ed2f4ce7d935b1b638aed146ec -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/gnuhhung317
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@2aaf415d94e654ed2f4ce7d935b1b638aed146ec -
Trigger Event:
release
-
Statement type: