We are committed to providing a welcoming and inspiring community for all. Please read and follow our Code of Conduct.
-
Fork and Clone
git clone https://github.com/ashioyajotham/fingpt-trader.git cd fingpt-trader
-
Environment Setup
python -m venv venv source venv/bin/activate # Linux/Mac # or .\venv\Scripts\activate # Windows pip install -r requirements.txt
-
Install Development Dependencies
pip install -r requirements-dev.txt pre-commit install
main
: Production-ready codedevelop
: Development branch- Feature branches:
feature/your-feature
- Bugfix branches:
fix/issue-description
# Create feature branch
git checkout -b feature/your-feature develop
# Create bugfix branch
git checkout -b fix/issue-description develop
We follow PEP 8 with these modifications:
# Maximum line length
max_line_length = 88 # Black formatter default
# Import ordering
import numpy as np
import pandas as pd
from typing import Dict, List, Optional
# Class definitions
class YourClass:
"""Docstring following Google style."""
def __init__(self, param: str):
"""
Args:
param: Description
"""
self.param = param
All code must include tests:
# test_your_feature.py
import pytest
from your_module import YourClass
def test_your_feature():
obj = YourClass("test")
assert obj.method() == expected_result
@pytest.mark.parametrize("input,expected", [
("case1", result1),
("case2", result2)
])
def test_parametrized(input, expected):
assert function(input) == expected
Run tests:
pytest tests/
pytest tests/your_specific_test.py -v
-
Docstrings: Google style
def function(param1: str, param2: int) -> Dict[str, Any]: """Short description. Longer description if needed. Args: param1: Description of param1 param2: Description of param2 Returns: Dict containing processed results Raises: ValueError: If param1 is invalid """
-
README Updates: Keep module READMEs updated
-
API Documentation: Update API docs for public interfaces
-
Before Submitting
- Run all tests
- Update documentation
- Add changelog entry
- Rebase on latest develop
-
PR Template
## Description Brief description of changes ## Type of Change - [ ] Bug fix - [ ] New feature - [ ] Breaking change ## Testing - [ ] Added unit tests - [ ] Updated existing tests ## Documentation - [ ] Updated docstrings - [ ] Updated README - [ ] Updated API docs
-
Review Process
- Two approvals required
- All tests must pass
- Documentation must be complete
-
Profiling
import cProfile import pstats def profile_code(): profiler = cProfile.Profile() profiler.enable() # Your code here profiler.disable() stats = pstats.Stats(profiler).sort_stats('cumtime') stats.print_stats()
-
Benchmarks
import timeit def benchmark_function(): setup = "from your_module import your_function" stmt = "your_function(test_data)" return timeit.timeit(stmt, setup, number=1000)
When adding new features, follow the existing structure:
models/
├── new_feature/
│ ├── __init__.py
│ ├── core.py
│ ├── utils.py
│ └── README.md # Feature documentation
tests/
└── new_feature/
├── __init__.py
├── test_core.py
└── test_utils.py
-
Create model structure:
mkdir models/your_model touch models/your_model/{__init__,core,utils}.py
-
Create tests:
mkdir tests/your_model touch tests/your_model/test_{core,utils}.py
-
Update documentation:
- Add model README
- Update API docs
- Add examples
- Create issue if none exists
- Create fix branch
- Add regression test
- Update changelog
- Submit PR
- Check Discussions
- Tag maintainers in issues
By contributing, you agree that your contributions will be licensed under the MIT License. Read more in LICENSE.