Skip to content

add liquidity filter to binance pack sweep #1012

add liquidity filter to binance pack sweep

add liquidity filter to binance pack sweep #1012

Workflow file for this run

name: Fast CI (GitHub Runners)
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: read
jobs:
lint:
name: Lint & Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Install linting dependencies
run: |
uv pip install --system ruff
- name: Run Ruff linter
run: |
RUFF_TARGETS="rl_trading_agent_binance/hybrid_prompt.py rl_trading_agent_binance/trade_binance_live.py evaluate_binance_lora_candidate.py scripts/evaluate_binance_lora_candidate.py trltraining tests/test_hybrid_allocation_prompt.py tests/test_hybrid_prompt_parsing.py tests/test_rl_only_fallback.py tests/test_evaluate_binance_lora_candidate.py tests/test_validate_hybrid_cycle_snapshots.py tests/test_trltraining.py"
ruff check $RUFF_TARGETS --output-format=github
- name: Run Ruff format check
run: |
RUFF_TARGETS="rl_trading_agent_binance/hybrid_prompt.py rl_trading_agent_binance/trade_binance_live.py evaluate_binance_lora_candidate.py scripts/evaluate_binance_lora_candidate.py trltraining tests/test_hybrid_allocation_prompt.py tests/test_hybrid_prompt_parsing.py tests/test_rl_only_fallback.py tests/test_evaluate_binance_lora_candidate.py tests/test_validate_hybrid_cycle_snapshots.py tests/test_trltraining.py"
ruff format --check $RUFF_TARGETS
- name: Report to CI Sentinel
if: always()
env:
CI_SENTINEL_ID: ${{ vars.CI_SENTINEL_ID }}
CI_SENTINEL_KEY: ${{ secrets.CODEX_INFINITY_API_KEY }}
run: |
if [ -z "$CI_SENTINEL_ID" ] || [ -z "$CI_SENTINEL_KEY" ]; then
echo "CI Sentinel not configured, skipping report"
exit 0
fi
# Collect failure output from previous steps
FAILURE_OUTPUT=""
if [ "${{ job.status }}" = "failure" ]; then
FAILURE_OUTPUT=$(cat /tmp/ci-failure-output.txt 2>/dev/null | tail -c 12288 || echo "See GitHub Actions logs")
fi
curl -sf -X POST "https://codex-infinity.com/api/ci-sentinels/${CI_SENTINEL_ID}/events" \
-H "Authorization: Bearer ${CI_SENTINEL_KEY}" \
-H "Content-Type: application/json" \
-d "{
\"external_id\": \"${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}\",
\"repo\": \"${GITHUB_REPOSITORY}\",
\"branch\": \"${GITHUB_REF_NAME}\",
\"commit_sha\": \"${GITHUB_SHA}\",
\"workflow\": \"${GITHUB_WORKFLOW}\",
\"job_name\": \"${GITHUB_JOB}\",
\"run_number\": ${GITHUB_RUN_NUMBER},
\"run_attempt\": ${GITHUB_RUN_ATTEMPT},
\"status\": \"completed\",
\"conclusion\": \"${{ job.status }}\",
\"logs_url\": \"https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}\",
\"failure_output\": $(echo "$FAILURE_OUTPUT" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))' 2>/dev/null || echo '\"\"')
}" || echo "Warning: Failed to report to CI Sentinel"
fast-unit-tests:
name: Fast Unit Tests (CPU)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]
env:
# CI mode flags
CI: "1"
FAST_CI: "1"
CPU_ONLY: "1"
FAST_SIMULATE: "1"
# Market simulator flags
MARKETSIM_ALLOW_MOCK_ANALYTICS: "1"
MARKETSIM_SKIP_REAL_IMPORT: "1"
MARKETSIM_ALLOW_CPU_FALLBACK: "1"
# Trading flags
ALP_PAPER: "1"
PYTHONUNBUFFERED: "1"
# Skip heavy dependencies for unit tests
SKIP_TORCH_CHECK: "0"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1 # Shallow clone for faster checkout
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: |
requirements.txt
requirements-ci.txt
- name: Install CPU-only dependencies
run: |
# Install all dependencies from CPU-only requirements
uv pip install --system --requirement requirements-ci.txt
uv pip install --system pytest-cov
- name: Run fast unit tests with coverage
run: |
python -m pytest \
-v \
-m "unit and not slow and not model_required and not cuda_required" \
--tb=short \
--maxfail=10 \
--cov=scripts --cov=src --cov=trade_daily_stock_prod \
--cov-report=term-missing \
--cov-report=html:htmlcov \
tests/
- name: Run smoke tests (minimal model tests)
continue-on-error: true
run: |
python -m pytest \
-v \
-m "smoke and model_required and not cuda_required" \
--tb=short \
--maxfail=3 \
tests/
- name: Report to CI Sentinel
if: always()
env:
CI_SENTINEL_ID: ${{ vars.CI_SENTINEL_ID }}
CI_SENTINEL_KEY: ${{ secrets.CODEX_INFINITY_API_KEY }}
run: |
if [ -z "$CI_SENTINEL_ID" ] || [ -z "$CI_SENTINEL_KEY" ]; then
echo "CI Sentinel not configured, skipping report"
exit 0
fi
# Collect failure output from previous steps
FAILURE_OUTPUT=""
if [ "${{ job.status }}" = "failure" ]; then
FAILURE_OUTPUT=$(cat /tmp/ci-failure-output.txt 2>/dev/null | tail -c 12288 || echo "See GitHub Actions logs")
fi
curl -sf -X POST "https://codex-infinity.com/api/ci-sentinels/${CI_SENTINEL_ID}/events" \
-H "Authorization: Bearer ${CI_SENTINEL_KEY}" \
-H "Content-Type: application/json" \
-d "{
\"external_id\": \"${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}\",
\"repo\": \"${GITHUB_REPOSITORY}\",
\"branch\": \"${GITHUB_REF_NAME}\",
\"commit_sha\": \"${GITHUB_SHA}\",
\"workflow\": \"${GITHUB_WORKFLOW}\",
\"job_name\": \"${GITHUB_JOB}\",
\"run_number\": ${GITHUB_RUN_NUMBER},
\"run_attempt\": ${GITHUB_RUN_ATTEMPT},
\"status\": \"completed\",
\"conclusion\": \"${{ job.status }}\",
\"logs_url\": \"https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}\",
\"failure_output\": $(echo "$FAILURE_OUTPUT" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))' 2>/dev/null || echo '\"\"')
}" || echo "Warning: Failed to report to CI Sentinel"
type-check:
name: Type Checking
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: requirements-ci.txt
- name: Install dependencies
run: |
uv pip install --system --requirement requirements-ci.txt
uv pip install --system ty pyright
- name: Type check with ty
run: |
ty check \
rl_trading_agent_binance/hybrid_prompt.py \
rl_trading_agent_binance/trade_binance_live.py \
evaluate_binance_lora_candidate.py \
scripts/evaluate_binance_lora_candidate.py \
trltraining
- name: Type check with Pyright
continue-on-error: true
run: python -m pyright src
- name: Report to CI Sentinel
if: always()
env:
CI_SENTINEL_ID: ${{ vars.CI_SENTINEL_ID }}
CI_SENTINEL_KEY: ${{ secrets.CODEX_INFINITY_API_KEY }}
run: |
if [ -z "$CI_SENTINEL_ID" ] || [ -z "$CI_SENTINEL_KEY" ]; then
echo "CI Sentinel not configured, skipping report"
exit 0
fi
# Collect failure output from previous steps
FAILURE_OUTPUT=""
if [ "${{ job.status }}" = "failure" ]; then
FAILURE_OUTPUT=$(cat /tmp/ci-failure-output.txt 2>/dev/null | tail -c 12288 || echo "See GitHub Actions logs")
fi
curl -sf -X POST "https://codex-infinity.com/api/ci-sentinels/${CI_SENTINEL_ID}/events" \
-H "Authorization: Bearer ${CI_SENTINEL_KEY}" \
-H "Content-Type: application/json" \
-d "{
\"external_id\": \"${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}\",
\"repo\": \"${GITHUB_REPOSITORY}\",
\"branch\": \"${GITHUB_REF_NAME}\",
\"commit_sha\": \"${GITHUB_SHA}\",
\"workflow\": \"${GITHUB_WORKFLOW}\",
\"job_name\": \"${GITHUB_JOB}\",
\"run_number\": ${GITHUB_RUN_NUMBER},
\"run_attempt\": ${GITHUB_RUN_ATTEMPT},
\"status\": \"completed\",
\"conclusion\": \"${{ job.status }}\",
\"logs_url\": \"https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}\",
\"failure_output\": $(echo "$FAILURE_OUTPUT" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))' 2>/dev/null || echo '\"\"')
}" || echo "Warning: Failed to report to CI Sentinel"