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
99 changes: 99 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: CI

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics

- name: Format check with black
run: |
black --check --diff .

- name: Sort imports check with isort
run: |
isort --check-only --diff .

- name: Type check with mypy
run: |
mypy ohheycrypto --ignore-missing-imports
continue-on-error: true # Don't fail CI on mypy errors yet

- name: Security check with bandit
run: |
bandit -r ohheycrypto -f json -o bandit-report.json || true
bandit -r ohheycrypto
continue-on-error: true

- name: Test CLI functionality
run: |
# Test that the CLI can be imported and basic commands work
ohheycrypto --version
ohheycrypto init test_config.json
ohheycrypto validate test_config.json || true # Expected to fail without API keys

- name: Run tests
run: |
pytest --cov=ohheycrypto --cov-report=xml --cov-report=term-missing -v

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: python -m build

- name: Check package
run: twine check dist/*

- name: Test installation
run: |
pip install dist/*.whl
ohheycrypto --version
89 changes: 89 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Publish to PyPI

on:
release:
types: [published]
workflow_dispatch: # Allow manual triggering

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run tests
run: |
pytest --cov=ohheycrypto --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

build:
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: python -m build

- name: Check package
run: twine check dist/*

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/

publish:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
environment:
name: pypi
url: https://pypi.org/p/ohheycrypto
permissions:
id-token: write # For trusted publishing

steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
96 changes: 96 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Create Release

on:
push:
tags:
- 'v*.*.*' # Triggers on version tags like v0.2.0, v1.0.0

jobs:
create-release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for changelog

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
pip install -e ".[dev]"

- name: Run tests
run: |
pytest --cov=ohheycrypto

- name: Build package
run: python -m build

- name: Check package
run: twine check dist/*

- name: Extract version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

- name: Generate changelog
id: changelog
run: |
# Simple changelog generation - you can improve this
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
echo "## What's Changed" >> $GITHUB_OUTPUT
git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 HEAD^)..HEAD >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/$(git describe --tags --abbrev=0 HEAD^)...v${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release v${{ steps.get_version.outputs.VERSION }}
body: |
# OhHeyCrypto v${{ steps.get_version.outputs.VERSION }}

${{ steps.changelog.outputs.CHANGELOG }}

## Installation

```bash
pip install ohheycrypto==${{ steps.get_version.outputs.VERSION }}
```

## Quick Start

```bash
ohheycrypto init config.json
# Edit config.json with your API keys
ohheycrypto validate config.json
ohheycrypto run config.json
```

## Docker

```bash
docker run -v $(pwd)/config.json:/app/config.json ohheycrypto:v${{ steps.get_version.outputs.VERSION }}
```
draft: false
prerelease: ${{ contains(steps.get_version.outputs.VERSION, 'alpha') || contains(steps.get_version.outputs.VERSION, 'beta') || contains(steps.get_version.outputs.VERSION, 'rc') }}

- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/ohheycrypto-${{ steps.get_version.outputs.VERSION }}-py3-none-any.whl
asset_name: ohheycrypto-${{ steps.get_version.outputs.VERSION }}-py3-none-any.whl
asset_content_type: application/zip
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,5 @@ logs/
plan.md
.claude
.cursor
.pycharm
.pycharm
PUBLISHING.md
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ This is a **crypto trading bot** that uses sophisticated technical analysis and

![Trading Bot Screenshot](static/screenshot.png)

### Install:

```shell
pip install ohheycrypto
```

## Features

### Core Trading Features
Expand All @@ -24,15 +30,7 @@ This is a **crypto trading bot** that uses sophisticated technical analysis and
- **Technical Indicators**: RSI-based entry/exit signals for better timing
- **Comprehensive Logging**: Detailed market conditions and trading decisions

## Installation

### Install from PyPI (recommended):

```shell
pip install ohheycrypto
```

### Quick Start:
## Quick Start:

```shell
# Create a configuration file
Expand Down Expand Up @@ -233,7 +231,7 @@ ohheycrypto run production_config.json

### Development/Source Installation:
```bash
git clone https://github.com/ohheycrypto/bot
git clone https://github.com/sn/ohheycrypto
cd bot
pip install -e .
ohheycrypto init dev_config.json
Expand Down
2 changes: 1 addition & 1 deletion ohheycrypto/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def main():
ohheycrypto run config.json # Run the trading bot
ohheycrypto run config.json --dry # Dry run (analysis only, no trades)

For more information, visit: https://github.com/ohheycrypto/bot
For more information, visit: https://github.com/sn/ohheycrypto
"""
)

Expand Down
Loading
Loading