sqphi-trade-kit
Shared Python utilities for crypto trading systems. Provides database connectors (PostgreSQL, ArcticDB), Telegram notifications, AWS Secrets Manager access, and common helpers.
Installation
pip install sqphi-trade-kit
# or
uv add sqphi-trade-kit
Modules
Top-level imports
from sqphi_trade_kit import send_telegram_message, print_markdown, time_logger
| Function | Description |
|---|---|
send_telegram_message(message, thread_id) |
Send a notification to Telegram |
print_markdown(message) |
Print a DataFrame as markdown table, or plain print() otherwise |
time_logger |
Decorator that logs function execution time |
sqphi_trade_kit.db — Database connectors
from sqphi_trade_kit.db import get_engine, get_database_url
from sqphi_trade_kit.db import get_ohlcv, get_ohlcv_resampled, get_arctic, get_library
PostgreSQL (sqphi_trade_kit.db.postgres):
get_database_url()— Resolves DB URL fromDATABASE_URLenv var (local) or AWS Secrets Manager +DB_ENDPOINT(ECS)get_engine()— Lazily-created shared SQLAlchemy engine
ArcticDB (sqphi_trade_kit.db.arctic):
get_arctic()— Connect viaARCTIC_URIenv varget_library(name)— Return a named ArcticDB libraryget_ohlcv(start_date, end_date, bases, exchange)— Fetch 1-minute OHLCV candles. Symbol format:{exchange}__{base}__USDT-USDTget_ohlcv_resampled(start_date, end_date, bases, freq, exchange)— Fetch and resample to1hor1d
sqphi_trade_kit.notifications — Telegram
from sqphi_trade_kit.notifications import send_telegram_message
Requires TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID env vars.
sqphi_trade_kit.secrets — AWS Secrets Manager
from sqphi_trade_kit.secrets import get_aws_secrets
creds = get_aws_secrets("trading-systems-prod-db-credentials")
CLI: sqphi-sync-secrets
Sync .env keys to AWS Secrets Manager:
sqphi-sync-secrets --app my-app --env prod --keys KEY1,KEY2,KEY3
Environment variables
| Variable | Required by | Description |
|---|---|---|
DATABASE_URL |
db.postgres |
PostgreSQL connection string (local dev) |
DB_ENDPOINT |
db.postgres |
RDS endpoint (AWS ECS — required when DATABASE_URL is not set) |
ENV |
db.postgres |
prod or demo (default: prod) |
ARCTIC_URI |
db.arctic |
ArcticDB connection URI (e.g. lmdb:///path or s3://bucket/path) |
OHLCV_EXCHANGE |
db.arctic |
Exchange name for OHLCV symbols (default: binance) |
TELEGRAM_BOT_TOKEN |
notifications |
Telegram bot API token |
TELEGRAM_CHAT_ID |
notifications |
Telegram chat/group ID |
Dependencies
arcticdb,boto3,pandas,requests,psycopg2,sqlalchemy,tabulate- Python >= 3.12
License
MIT
Metadata
Release files for sqphi-trade-kit 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sqphi_trade_kit-0.5.0.tar.gz | 11.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqphi_trade_kit-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.0 kB
Release files / sqphi_trade_kit-0.5.0.tar.gz
| Download URL | sqphi_trade_kit-0.5.0.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
699ea81441d488de30ce82a40b61e542cdbd656f2c5c75f0f96f726224d546a4
|
|
BLAKE2b-256 checksum How to use checksums |
e16aa69ea639b8272a85bddf27b2772e0c8f93fbd787019389237595db8dcc19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.
Transparency logRelease files / sqphi_trade_kit-0.5.0-py3-none-any.whl
| Download URL | sqphi_trade_kit-0.5.0-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff78bf774481080581c7d7fcbe8e0f0c65ccd5604178ab831c24d49ea29e6a98
|
|
BLAKE2b-256 checksum How to use checksums |
acb9dfc617dec56a730a7d56b51b9c504622fafd234fc52c8729a10e6d6b60c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.
Transparency log