Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
386449a
feat: modernize project to v5.0.0 with full test suite
JCBauza Feb 19, 2026
4f29a51
chore: update all repo URLs from bitfinexcom to JCBauza
JCBauza Feb 19, 2026
135557c
feat!: v6.0.0 — Python 3.12+, pytest-cov, decimal_mode, rate limit he…
JCBauza Mar 16, 2026
be93bb0
chore(ci): add workflow_dispatch trigger for manual CI runs
JCBauza Mar 16, 2026
c3e9460
feat: enable mypy strict mode
JCBauza Mar 16, 2026
ea1cacc
test: add REST public endpoint tests, raise coverage threshold to 80%
JCBauza Mar 16, 2026
00a7052
ci: upgrade actions/checkout and actions/setup-node to v6
JCBauza Mar 17, 2026
f1b41b9
ci: add dependabot.yml for automated dependency updates
JCBauza Mar 17, 2026
be1a7a5
docs: add CLAUDE.md with project-specific guidance
JCBauza Mar 17, 2026
42db16e
chore: upgrade GitHub Actions to latest versions (Node.js 24 compat)
JCBauza Mar 21, 2026
aa747de
feat: add RateLimitError, InsufficientFundsError, NetworkError + retr…
JCBauza Mar 19, 2026
3ce64f1
ci: migrate GitHub Actions from ubuntu-latest to self-hosted runners
JCBauza Mar 23, 2026
791678c
security: SHA-pin GitHub Actions to prevent supply chain attacks
JCBauza Mar 25, 2026
9b9bfff
chore(ship): add .coverage and *.log to .gitignore
JCBauza Mar 31, 2026
352e8b2
chore: widen requests constraint to >=2.32.3
JCBauza Mar 31, 2026
2e3e27c
docs: add copilot-instructions.md for AI assistant guidance
JCBauza Apr 1, 2026
e7fd219
docs: point copilot to CLAUDE source of truth
JCBauza Apr 6, 2026
1f1ccb8
chore(ship): deduplicate REST/WS handlers and optimize hot paths
JCBauza Apr 6, 2026
489721b
fix(ci): use ubuntu-latest for Dependabot updater
JCBauza Apr 7, 2026
441b4a9
chore: add Claude Code rules and configuration
JCBauza Apr 12, 2026
6892c6a
security: replace datetime nonce with time.time_ns for monotonicity
JCBauza Apr 12, 2026
db84a2a
chore: add pre-push hooks, Claude rules, and repo standards
JCBauza Apr 13, 2026
c39ea0b
fix: resolve mypy errors, ruff lint, and 3 failing websocket tests
JCBauza Apr 13, 2026
af95114
chore(rules): add shared rule symlinks synced from Knowledge-Hub
JCBauza Apr 21, 2026
d7194b6
fix(auth): monotonic nonce to prevent collisions under concurrent use…
JCBauza Apr 21, 2026
4029b81
chore(rules): sync shared rules from Knowledge-Hub
JCBauza Apr 22, 2026
58e10bb
chore: add Copilot reviewer workflow
JCBauza Apr 23, 2026
e49c9cb
fix(json_decoder): swallow simplejson's encoding kwarg for Python 3.1…
JCBauza Apr 24, 2026
0279a34
chore(dependabot): group security-updates into single PR per ecosyste…
cloudingenium-automation[bot] Apr 25, 2026
0a37b91
chore(ci): add commitlint workflow + config
JCBauza Apr 25, 2026
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
1 change: 1 addition & 0 deletions .claude/rules/bitfinex-api.md
1 change: 1 addition & 0 deletions .claude/rules/blazor-server.md
1 change: 1 addition & 0 deletions .claude/rules/ci-deployment.md
1 change: 1 addition & 0 deletions .claude/rules/cloudflare-worker.md
1 change: 1 addition & 0 deletions .claude/rules/dotnet-auth.md
1 change: 1 addition & 0 deletions .claude/rules/git-hooks.md
1 change: 1 addition & 0 deletions .claude/rules/hono-cloudflare.md
1 change: 1 addition & 0 deletions .claude/rules/microsoft-graph.md
1 change: 1 addition & 0 deletions .claude/rules/shared-packages.md
1 change: 1 addition & 0 deletions .claude/rules/testing.md
13 changes: 13 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"type-enum": [
2,
"always",
["feat", "fix", "docs", "style", "refactor", "perf", "test", "chore", "build", "ci", "revert"]
],
"subject-case": [0, "always"],
"header-max-length": [1, "always", 100]
}
}

13 changes: 0 additions & 13 deletions .flake8

This file was deleted.

14 changes: 14 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Require owner review for CI/CD and security-sensitive files.
# Prevents unauthorized workflow changes (supply chain attack vector).

# Default owner — all files
* @JCBauza

# GitHub Actions workflows
.github/workflows/ @JCBauza

# Dependabot / security config
dependabot.yml @JCBauza

# This file itself
CODEOWNERS @JCBauza
21 changes: 21 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Project Guidelines

> **Primary reference:** Read the repo's `CLAUDE.md` first — it is the single source of truth. This file provides supplementary Copilot-specific context.


## Build and Test

- Use Python 3.12+. Install with `pip install -e ".[dev]"`. Test with `pytest` (coverage threshold 80%).
- Lint/format with Ruff. Type check with mypy (strict mode).

## Architecture

- CloudIngenium fork of official Bitfinex Python API client (v2).
- Published as `bitfinex-api-py` v6.0.0. Core library for BfxLendingBot.
- REST + WebSocket communication with Bitfinex exchange.

## Conventions

- Build system: Hatchling. Pre-commit hooks via Ruff.
- Always use `Decimal` for financial values — never `float`.
- WebSocket-first, REST as fallback.
24 changes: 24 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
groups:
all-security:
applies-to: security-updates
patterns: ["*"]
all-dependencies:
patterns: ["*"]
runs-on: "ubuntu-latest"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
all-security:
applies-to: security-updates
patterns: ["*"]
all-actions:
patterns: ["*"]
runs-on: "ubuntu-latest"
45 changes: 32 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,39 @@ on:
pull_request:
branches:
- master
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
lint:
runs-on: [self-hosted, Linux, Build]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python 3.13
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.13"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Run ruff linter
run: ruff check bfxapi/
- name: Run ruff formatter check
run: ruff format --check bfxapi/
- name: Run mypy type checking
run: mypy bfxapi/

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
test:
runs-on: [self-hosted, Linux, Build]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python 3.13
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.8'
- name: Install bitfinex-api-py's dependencies
run: python -m pip install -r dev-requirements.txt
- name: Run pre-commit hooks (see .pre-commit-config.yaml)
uses: pre-commit/action@v3.0.1
- name: Run mypy to ensure correct type hinting
run: python -m mypy bfxapi
python-version: "3.13"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Verify import
run: python -c "import bfxapi; print('Import successful')"
- name: Run tests with coverage
run: python -m pytest tests/ -v
- name: Run mypy
run: mypy bfxapi/
20 changes: 20 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Commit Lint
on:
pull_request:
branches: [main, master]
permissions:
contents: read
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Lint commits in PR
uses: wagoid/commitlint-github-action@v6
with:
configFile: ".commitlintrc.json"
failOnWarnings: false
firstParent: false

12 changes: 12 additions & 0 deletions .github/workflows/copilot-reviewer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Copilot Reviewer
on:
pull_request:
types: [opened, reopened, ready_for_review]

permissions:
pull-requests: write

jobs:
request:
uses: CloudIngenium/.github/.github/workflows/request-copilot-review.yml@main
secrets: inherit
21 changes: 19 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
.venv
venv/
.DS_Store
Thumbs.db
.vscode
.idea
.vim
*.swp
*.swo
.python-version
__pycache__

# Environment
.env
.env.local
.env.*.local

# Build / packaging
bitfinex_api_py.egg-info
bitfinex_api_py.dist-info
build/
dist/
pip-wheel-metadata/
.eggs

.idea
# Test / lint caches
.coverage
htmlcov/
.mypy_cache/
.pytest_cache/
.ruff_cache/

venv/
*.log
2 changes: 0 additions & 2 deletions .isort.cfg

This file was deleted.

20 changes: 5 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.1
hooks:
- id: isort
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.2.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8

additional_dependencies: [
flake8-bugbear
]
- id: ruff
args: [--fix]
- id: ruff-format
77 changes: 77 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# CLAUDE.md — bitfinex-api-py

## Project Purpose

CloudIngenium fork of the official Bitfinex Python API client (v2). Published as `bitfinex-api-py` v6.0.0. This is the core library used by BfxLendingBot for all Bitfinex REST and WebSocket communication.

## Stack

- **Language:** Python 3.12+ (targets 3.13)
- **Build system:** Hatchling
- **Lint/Format:** Ruff (line-length 80, pycodestyle + pyflakes + bugbear + pyupgrade + isort)
- **Type checking:** mypy (strict mode)
- **Test:** pytest + pytest-asyncio + pytest-cov (coverage threshold: 80%)
- **Pre-commit:** Ruff linting and formatting hooks

## Build & Dev

```bash
pip install -e ".[dev]" # Install in editable mode with dev deps
pytest # Run tests with coverage
mypy bfxapi/ # Type checking (strict)
ruff check bfxapi/ # Lint
ruff format bfxapi/ # Format
pre-commit run --all-files # Run all pre-commit hooks
```

## Structure

```
bfxapi/
__init__.py # Package entry — exports Client, host constants
_client.py # Main Client class (REST + WebSocket)
_version.py # Version string
_utils/ # Internal utilities
exceptions.py # Package-level exceptions
rest/
__init__.py
_bfx_rest_interface.py # REST interface base
_interface/
interface.py # Low-level HTTP interface
middleware.py # Request middleware (auth, etc.)
_interfaces/
rest_auth_endpoints.py # Authenticated REST endpoints
rest_public_endpoints.py # Public REST endpoints
exceptions.py # REST-specific exceptions
types/
__init__.py
dataclasses.py # All Bitfinex data types (Order, Trade, Candle, etc.)
labeler.py # Field labeling utilities
notification.py # Notification type
serializers.py # Type serialization
websocket/
__init__.py
_connection.py # WebSocket connection management
subscriptions.py # Subscription types and management
exceptions.py # WebSocket-specific exceptions
_client/
bfx_websocket_client.py # Main WebSocket client
bfx_websocket_bucket.py # Connection bucketing
bfx_websocket_inputs.py # WebSocket input operations
_event_emitter/
bfx_event_emitter.py # Event system
_handlers/
auth_events_handler.py # Authenticated event handling
public_channels_handler.py # Public channel handling
tests/ # pytest test suites
examples/ # Usage examples (REST + WebSocket)
```

## Conventions

- Import types from `bfxapi.types.dataclasses` (never `bfxapi.models` — removed in v4)
- Use `Decimal` for monetary values, never `float`
- WebSocket preferred over REST for real-time data (no rate limits)
- REST rate limit: 90 req/5min on private endpoints
- Never hardcode API keys — use environment variables
- asyncio-based WebSocket client; use `bfx.wss.run()` or `await bfx.wss.start()`
Loading