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
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ __pycache__/
.pytest_cache/
.vscode/
tree.py
celerybeat-schedule

# pytest
.pytest_cache/
.cache/
start_dev.ps1
scripts

# coverage
.coverage
Expand Down
17 changes: 10 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
# Database Configuration
DATABASE__HOST=localhost
DATABASE__PORT=5432
DATABASE__PORT=5433
DATABASE__USER=postgres
DATABASE__PASSWORD=your_secure_password
DATABASE__DB=deribit_tracker

# Deribit API Configuration
DERIBIT_API__CLIENT_ID=your_client_id
DERIBIT_API__CLIENT_SECRET=your_client_secret
DERIBIT_API__BASE_URL=https://www.deribit.com/api/v2

# Redis Configuration
REDIS__HOST=localhost
REDIS__HOST=redis
REDIS__PORT=6379
REDIS__DB=0
REDIS__PASSWORD=your_secure_password_or_empty_for_local_dev
REDIS__SSL=False

CELERY__WORKER_CONCURRENCY=2
CELERY__BEAT_ENABLED=True
CELERY__TASK_TRACK_STARTED=True

# Application Configuration
APPLICATION__DEBUG=False
APPLICATION__API_V1_PREFIX=/api/v1
APPLICATION__PROJECT_NAME=Deribit Price Tracker API
APPLICATION__VERSION=0.3.0

# CORS Configuration
CORS__ORIGINS=["http://localhost:8000","http://127.0.0.1:8000"]

APP_PORT=8000
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,33 @@ jobs:
- name: Create .env file for tests
run: |
cat > .env << 'EOF'
# Database Configuration
DATABASE__HOST=localhost
DATABASE__PORT=5432
DATABASE__PORT=5433
DATABASE__USER=test_user
DATABASE__PASSWORD=test_password
DATABASE__DB=test_db

# Deribit API Configuration
DERIBIT_API__CLIENT_ID=test_client_id
DERIBIT_API__CLIENT_SECRET=test_client_secret

# Redis Configuration
REDIS__HOST=localhost
REDIS__PORT=6379
REDIS__DB=0
REDIS__PASSWORD=your_secure_password_or_empty_for_local_dev
REDIS__SSL=False

CELERY__WORKER_CONCURRENCY=2
CELERY__BEAT_ENABLED=True
CELERY__TASK_TRACK_STARTED=True

# Application Configuration
APPLICATION__DEBUG=false
APPLICATION__API_V1_PREFIX=/api/v1
APPLICATION__PROJECT_NAME=Deribit Price Tracker Test
APPLICATION__VERSION=1.0.0

# CORS Configuration
CORS__ORIGINS=["http://localhost:8000"]

APP_PORT=8000
EOF

echo "=== Created .env file ==="
Expand Down Expand Up @@ -103,7 +106,7 @@ jobs:
run: |
cat > .env << 'EOF'
DATABASE__HOST=localhost
DATABASE__PORT=5432
DATABASE__PORT=5433
DATABASE__USER=test_user
DATABASE__PASSWORD=test_password
DATABASE__DB=test_db
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ credentials/
.cache/
scan_project.py
project_scan_output.txt
start_dev.ps1
scripts

# coverage
.coverage
Expand Down Expand Up @@ -51,6 +53,7 @@ wheels/
.installed.cfg
*.egg
MANIFEST
celerybeat-schedule

# Virtual Environment
.venv/
Expand Down
12 changes: 10 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ before_script:
- |
@'
DATABASE__HOST=localhost
DATABASE__PORT=5432
DATABASE__PORT=5433
DATABASE__USER=test_user
DATABASE__PASSWORD=test_password
DATABASE__DB=test_db
Expand All @@ -33,13 +33,21 @@ before_script:
REDIS__HOST=localhost
REDIS__PORT=6379
REDIS__DB=0
REDIS__PASSWORD=your_secure_password_or_empty_for_local_dev
REDIS__SSL=False

CELERY__WORKER_CONCURRENCY=2
CELERY__BEAT_ENABLED=True
CELERY__TASK_TRACK_STARTED=True

APPLICATION__DEBUG=false
APPLICATION__API_V1_PREFIX=/api/v1
APPLICATION__PROJECT_NAME=Deribit Price Tracker Test
APPLICATION__VERSION=1.0.0

CORS__ORIGINS=["http://localhost:8000"]

APP_PORT=8000
'@ | Out-File -FilePath .env -Encoding UTF8

Write-Host "=== Created .env file ==="
Expand Down Expand Up @@ -69,7 +77,7 @@ security:
- |
@'
DATABASE__HOST=localhost
DATABASE__PORT=5432
DATABASE__PORT=5433
DATABASE__USER=test_user
DATABASE__PASSWORD=test_password
DATABASE__DB=test_db
Expand Down
34 changes: 15 additions & 19 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_baseline_file",
"filename": ".secrets.baseline"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
Expand Down Expand Up @@ -131,7 +127,7 @@
{
"type": "Secret Keyword",
"filename": ".github\\workflows\\ci.yml",
"hashed_secret": "da64b94ccfb1a5e2a598831ed28878c880f60dfc",
"hashed_secret": "df842c49d8d3277a0170ffac5782a3cbe61b1feb",
"is_verified": false,
"line_number": 31
},
Expand All @@ -140,7 +136,7 @@
"filename": ".github\\workflows\\ci.yml",
"hashed_secret": "dc5f72fcc64e44ece1aa8dfab21ddfce0fc8772b",
"is_verified": false,
"line_number": 103
"line_number": 106
}
],
"alembic.ini": [
Expand All @@ -152,11 +148,11 @@
"line_number": 89
}
],
"alembic\\versions\\b1494e573776_create_price_ticks_table.py": [
"alembic\\versions\\2026\\01\\25_2149_52_19cfef6b2cba_create_price_ticks_table.py": [
{
"type": "Hex High Entropy String",
"filename": "alembic\\versions\\b1494e573776_create_price_ticks_table.py",
"hashed_secret": "365aef3fd6fec3397a72177f4930f4bb20510b88",
"filename": "alembic\\versions\\2026\\01\\25_2149_52_19cfef6b2cba_create_price_ticks_table.py",
"hashed_secret": "89c7743c6aa460fa307ce918c3a8cb8a15935865",
"is_verified": false,
"line_number": 16
}
Expand All @@ -167,7 +163,7 @@
"filename": "app\\core\\config.py",
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
"is_verified": false,
"line_number": 54
"line_number": 43
}
],
"tests\\test_config.py": [
Expand All @@ -176,58 +172,58 @@
"filename": "tests\\test_config.py",
"hashed_secret": "e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4",
"is_verified": false,
"line_number": 33
"line_number": 32
},
{
"type": "Secret Keyword",
"filename": "tests\\test_config.py",
"hashed_secret": "c94d65f02a652d11c2e5c2e1ccf38dce5a076e1e",
"is_verified": false,
"line_number": 74
"line_number": 73
},
{
"type": "Basic Auth Credentials",
"filename": "tests\\test_config.py",
"hashed_secret": "c94d65f02a652d11c2e5c2e1ccf38dce5a076e1e",
"is_verified": false,
"line_number": 79
"line_number": 78
},
{
"type": "Secret Keyword",
"filename": "tests\\test_config.py",
"hashed_secret": "1adfce9fa4bc6b1cbdf95ac2dc6180175da7558b",
"is_verified": false,
"line_number": 90
"line_number": 89
},
{
"type": "Secret Keyword",
"filename": "tests\\test_config.py",
"hashed_secret": "72cb70dbbafe97e5ea13ad88acd65d08389439b0",
"is_verified": false,
"line_number": 122
"line_number": 121
},
{
"type": "Secret Keyword",
"filename": "tests\\test_config.py",
"hashed_secret": "ee27c133da056b1013f88c712f92460bc7b3c90a",
"is_verified": false,
"line_number": 130
"line_number": 129
},
{
"type": "Secret Keyword",
"filename": "tests\\test_config.py",
"hashed_secret": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
"is_verified": false,
"line_number": 241
"line_number": 240
},
{
"type": "Secret Keyword",
"filename": "tests\\test_config.py",
"hashed_secret": "fca268ae2442d5cabc3e12d87b349adf8bf7d76c",
"is_verified": false,
"line_number": 373
"line_number": 316
}
]
},
"generated_at": "2026-01-24T19:55:12Z"
"generated_at": "2026-01-26T20:19:50Z"
}
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM python:3.11-slim

WORKDIR /app

RUN apt-get update && apt-get install -y \
gcc \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*

RUN pip install poetry==2.3.1

COPY pyproject.toml poetry.lock README.md ./

RUN poetry config virtualenvs.create false \
&& poetry install --only main --no-interaction --no-ansi --no-root

COPY . .

RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser

CMD ["poetry", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
4 changes: 2 additions & 2 deletions alembic.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ script_location = %(here)s/alembic
# for all available tokens
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
# Or organize into date-based subdirectories (requires recursive_version_locations = true)
# file_template = %%(year)d/%%(month).2d/%%(day).2d_%%(hour).2d%%(minute).2d_%%(second).2d_%%(rev)s_%%(slug)s
file_template = %%(year)d/%%(month).2d/%%(day).2d_%%(hour).2d%%(minute).2d_%%(second).2d_%%(rev)s_%%(slug)s

# sys.path path, will be prepended to sys.path if present.
# defaults to the current working directory. for multiple paths, the path separator
Expand Down Expand Up @@ -77,7 +77,7 @@ path_separator = os
# set to 'true' to search source files recursively
# in each "version_locations" directory
# new in Alembic version 1.10
# recursive_version_locations = false
recursive_version_locations = true

# the output encoding used when revision files
# are written from script.py.mako
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Create price_ticks table
"""create_price_ticks_table

Revision ID: b1494e573776
Revision ID: 19cfef6b2cba
Revises:
Create Date: 2026-01-24 21:27:51.504960
Create Date: 2026-01-25 21:49:52.138420

"""

Expand All @@ -13,7 +13,7 @@
from alembic import op # type: ignore

# revision identifiers, used by Alembic.
revision: str = "b1494e573776"
revision: str = "19cfef6b2cba"
down_revision: str | Sequence[str] | None = None
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
Expand All @@ -37,10 +37,7 @@ def upgrade() -> None:
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
op.f("ix_price_ticks_ticker"),
"price_ticks",
["ticker"],
unique=False,
op.f("ix_price_ticks_ticker"), "price_ticks", ["ticker"], unique=False
)
op.create_index(
op.f("ix_price_ticks_timestamp"),
Expand Down
Loading