Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ coverage.xml
.mypy_cache/
.ruff_cache/

# Build-context trimming (not needed inside the image)
artifacts/
quant-strategies/
tests/

# Temporary files
*.tmp
*.temp
Expand Down
17 changes: 5 additions & 12 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ PGADMIN_DEFAULT_EMAIL=admin@quant.local
PGADMIN_DEFAULT_PASSWORD=quantpass
PGADMIN_CONFIG_SERVER_MODE=False

# Optional Redis for recent overlay cache
# To enable Redis service by default in Compose: export COMPOSE_PROFILES=redis
USE_REDIS_RECENT=false
REDIS_URL=redis://redis:6379/0

# Cache directory (for temporary files)
CACHE_DIR=./cache

Expand All @@ -79,15 +84,3 @@ OPENAI_MODEL=gpt-5-mini
# Get API key at: https://console.anthropic.com/
ANTHROPIC_API_KEY=your_anthropic_api_key_here
ANTHROPIC_MODEL=claude-3-5-sonnet-20241022

# ======================
# CONFIGURATION PREFIX
# ======================
# All config environment variables use QUANTPY_ prefix
# Example: QUANTPY_DATA_DEFAULT_INTERVAL=1h
# Example: QUANTPY_BACKTEST_INITIAL_CAPITAL=100000

# Common overrides:
# QUANTPY_DATA_DEFAULT_INTERVAL=1h
# QUANTPY_BACKTEST_INITIAL_CAPITAL=100000
# QUANTPY_BACKTEST_DEFAULT_COMMISSION=0.001
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: CI

permissions:
contents: read

on:
push:
branches: [ main ]
Expand All @@ -10,6 +13,10 @@ jobs:
ci:
name: Code Quality & Tests
runs-on: ubuntu-latest
env:
UNIFIED_MODELS_SQLITE: "1" # Force SQLite for unified models during CI
TESTING: "true" # Enable test-mode code paths
DATABASE_URL: "sqlite:///quant_unified_test.db" # Safety: default DB points to SQLite
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Release

permissions:
contents: read

on:
push:
tags:
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ exports/*
!exports/**/.gitkeep
dist/
build/
artifacts/
*.tar.gz
*.whl

Expand All @@ -60,6 +61,11 @@ lean_config.json
*.iml
*.iws

# pyenv / direnv
.python-version
.direnv/
.envrc

# Testing and Type Checking
.coverage
.coverage.*
Expand Down
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing

Thanks for your interest in contributing to quant-system!

## License and Use

This repository is released under the Business Source License 1.1 (BUSL‑1.1).
Commercial use is restricted until the Change Date listed in `LICENSE`. On that
date, the project will convert to the MIT License.

## Deprecations and Import Paths

We recently renamed modules:

- `src.core.portfolio_manager` → `src.core.collection_manager` (class: `PortfolioManager`)
- `src.utils.tradingview_alert_exporter` → `src.utils.tv_alert_exporter`

Compatibility shims exist for now and will emit `DeprecationWarning`. Please
update imports to the new modules. The shims are scheduled for removal after
the next minor release.

## Development

- Use `docker compose` and the unified CLI. See `README.md` and `docs/docker.md`.
- Run `pre-commit` locally: `pre-commit install && pre-commit run -a`.
- Tests run inside Docker via the pre-commit hook.

## Pull Requests

- Keep PRs focused and small.
- Include tests for behavior changes.
- Pass pre-commit hooks (format, lint, tests).
12 changes: 6 additions & 6 deletions DOCKERFILE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Multi-stage build for optimized production image
FROM python:3.12-slim as base
FROM python:3.12-slim AS base

# Set environment variables
ENV PYTHONUNBUFFERED=1 \
Expand Down Expand Up @@ -35,7 +35,7 @@ RUN poetry config virtualenvs.create false \
&& rm -rf $POETRY_CACHE_DIR

# Production stage
FROM python:3.12-slim as production
FROM python:3.12-slim AS production

# Set environment variables
ENV PYTHONUNBUFFERED=1 \
Expand Down Expand Up @@ -78,7 +78,7 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD ["python", "-m", "src.cli.unified_cli", "--help"]

# Development stage
FROM base as development
FROM base AS development

# Install development dependencies
RUN poetry install --no-root
Expand All @@ -96,7 +96,7 @@ ENV ENVIRONMENT=development
CMD ["bash"]

# Testing stage
FROM development as testing
FROM development AS testing

# Install test dependencies
RUN poetry install
Expand All @@ -109,7 +109,7 @@ COPY pytest.ini ./
CMD ["poetry", "run", "pytest", "tests/", "-v"]

# Jupyter stage for data analysis
FROM development as jupyter
FROM development AS jupyter

# Install Jupyter and additional analysis tools
RUN poetry add jupyter jupyterlab plotly seaborn
Expand All @@ -128,7 +128,7 @@ RUN mkdir -p /app/.jupyter && \
CMD ["jupyter", "lab", "--allow-root", "--config=/app/.jupyter/jupyter_notebook_config.py"]

# API stage for web services
FROM production as api
FROM production AS api

# Expose API port
EXPOSE 8000
Expand Down
55 changes: 34 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
MIT License

Copyright (c) 2024 Louis Letcher

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Business Source License 1.1

Licensor: Louis Letcher

Licensed Work: quant-system
The Licensed Work is the repository at the following URL:
https://github.com/LouisLetcher/quant-system (or its successors)

Additional Use Grant: You may use, copy, modify, create derivative works, and
redistribute the Licensed Work, for non-commercial purposes only.

Change Date: 2028-01-01

Change License: On the Change Date, the Licensor will make the Licensed Work
available under the MIT License.

Terms

The Licensor permits you to use, copy, modify, create derivative works, and
redistribute the Licensed Work; provided, however, that any use is for
non-commercial purposes only. Any commercial use of the Licensed Work is
prohibited, except with the Licensor's prior written approval.

This License does not grant you any trademark rights for the Licensor’s marks.

To the extent permitted by applicable law, the Licensed Work is provided "as is"
and the Licensor disclaims all warranties and conditions, whether express or
implied, including but not limited to implied warranties of merchantability,
fitness for a particular purpose, title, and non-infringement.

Any copy of the Licensed Work you make must include this License.

For more information about the Business Source License, please see
https://mariadb.com/bsl11/
Loading