Contributing to SQA::TAI¶
Thank you for your interest in contributing to SQA::TAI! This document provides guidelines for contributing to the project.
Code of Conduct¶
We are committed to providing a welcoming and inspiring community for all. Please be respectful and constructive in all interactions.
How to Contribute¶
Reporting Bugs¶
If you find a bug, please create an issue on GitHub with:
- Clear description of the problem
- Steps to reproduce
- Expected vs actual behavior
- Ruby version and gem version
- TA-Lib version
- Sample code if applicable
Example Bug Report:
**Description:** RSI calculation returns nil values
**Steps to Reproduce:**
1. Install gem version X.X.X
2. Run: SQA::TAI.rsi([1,2,3,4,5], period: 14)
3. Observe nil values in output
**Expected:** Array with RSI values
**Actual:** Array with many nil values
**Environment:**
- Ruby: 3.2.0
- sqa-tai: 0.1.0
- TA-Lib: 0.4.0
Suggesting Enhancements¶
Enhancement suggestions are welcome! Please create an issue with:
- Clear description of the enhancement
- Use case / motivation
- Proposed implementation (if any)
- Examples of how it would be used
Pull Requests¶
We love pull requests! Here's the process:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests (required for new features)
- Run the test suite
- Update documentation if needed
- Commit your changes
- Push to your fork
- Create a Pull Request on GitHub
Development Setup¶
Prerequisites¶
- Install TA-Lib C library
macOS:
Ubuntu/Debian:
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib/
./configure --prefix=/usr
make
sudo make install
-
Clone the repository
-
Install dependencies
Running Tests¶
Run the full test suite:
Run a specific test file:
Run tests with coverage:
Code Style¶
We follow standard Ruby style guidelines:
- Use 2 spaces for indentation
- Keep lines under 120 characters
- Use descriptive variable names
- Add comments for complex logic
- Follow Ruby naming conventions
Testing Guidelines¶
- Write tests for all new features
- Ensure existing tests pass
- Aim for high code coverage
- Use descriptive test names
- Test edge cases and error conditions
Example Test:
require 'test_helper'
class TAITest < Minitest::Test
def test_sma_calculates_correctly
prices = [1, 2, 3, 4, 5]
result = SQA::TAI.sma(prices, period: 3)
assert_equal 5, result.length
assert_nil result[0]
assert_nil result[1]
assert_in_delta 2.0, result[2], 0.001
assert_in_delta 3.0, result[3], 0.001
assert_in_delta 4.0, result[4], 0.001
end
def test_sma_handles_insufficient_data
prices = [1, 2]
result = SQA::TAI.sma(prices, period: 10)
assert_equal 2, result.length
assert result.all?(&:nil?)
end
end
Documentation¶
Code Documentation¶
- Add YARD documentation comments to all public methods
- Include parameter types and return types
- Provide usage examples
Example:
# Calculate Simple Moving Average
#
# @param prices [Array<Float>] Array of price values
# @param period [Integer] Number of periods for calculation
# @return [Array<Float, nil>] Array of SMA values (nil for warmup period)
#
# @example Calculate 10-period SMA
# prices = [44.34, 44.09, 44.15, 43.61, 44.33]
# sma = SQA::TAI.sma(prices, period: 5)
# puts sma.last
def sma(prices, period: 30)
# Implementation
end
User Documentation¶
When adding features that affect users:
- Update README.md if needed
- Add examples to docs/examples/
- Update indicator documentation in docs/indicators/
- Add to CHANGELOG.md
Documentation Style¶
- Use clear, simple language
- Include code examples
- Explain the "why" not just the "how"
- Link to related documentation
Project Structure¶
sqa-tai/
├── lib/
│ └── sqa/
│ └── tai.rb # Main library code
├── test/
│ └── sqa/
│ └── tai_test.rb # Test files
├── docs/ # MkDocs documentation
│ ├── index.md
│ ├── getting-started/
│ ├── indicators/
│ └── examples/
├── README.md
├── CHANGELOG.md
├── Gemfile
└── sqa-tai.gemspec
Commit Message Guidelines¶
Write clear, descriptive commit messages:
- Use present tense ("Add feature" not "Added feature")
- Use imperative mood ("Move cursor to..." not "Moves cursor to...")
- First line: brief summary (50 chars or less)
- Blank line
- Detailed description if needed
Good examples:
Add RSI divergence detection
Implement bullish and bearish RSI divergence detection.
Includes tests and documentation.
Fix: SMA calculation with insufficient data
Previously returned incorrect nil placement.
Now correctly handles edge cases.
Release Process¶
(For maintainers)
- Update version in
lib/sqa/tai/version.rb - Update CHANGELOG.md
- Commit changes
- Create git tag:
git tag v0.1.0 - Push tag:
git push --tags - Build gem:
gem build sqa-tai.gemspec - Push to RubyGems:
gem push sqa-tai-0.1.0.gem
Getting Help¶
- Documentation: https://madbomber.github.io/sqa-tai
- Issues: GitHub Issues
- Email: dvanhoozer@gmail.com
Recognition¶
Contributors will be acknowledged in: - CHANGELOG.md - GitHub contributors page - Documentation (for significant contributions)
License¶
By contributing to SQA::TAI, you agree that your contributions will be licensed under the MIT License.
Questions?¶
Don't hesitate to ask questions by: - Opening an issue - Emailing the maintainer - Starting a discussion on GitHub
We appreciate all contributions, whether it's: - Reporting bugs - Suggesting features - Writing documentation - Submitting code - Helping other users
Thank you for making SQA::TAI better!