Thanks for your interest in contributing. This guide covers how to set up a development environment, the code conventions we follow, and how to submit changes.
git clone https://github.com/RyoK3N/Buck_V1.git
cd Buck_V1python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
pip install -r requirements.txtcd UI/frontend
npm install
cd ../..cp .env.example .env
# Edit .env with your API key# Run tests
pytest tests/ -v
# Start the app
python main.py
# Check tool discovery
PYTHONPATH=. python -c "from agent_scripts.tools import ToolFactory; print(ToolFactory.get_available_tools())"The tools/ directory has three categories with detailed specs waiting to be implemented:
tools/ml/— 6 scikit-learn tools (Random Forest, Gradient Boosting, Isolation Forest, SVM, Logistic Regression, KNN). Seetools/ml/readme.md.tools/utility/— 6 risk/portfolio tools (risk metrics, volatility analysis, correlation, position sizing, feature engineering, drawdown analysis). Seetools/utility/readme.md.tools/web/— 7 external data tools (news sentiment, economic calendar, earnings, SEC filings, social sentiment, insider transactions, options flow). Seetools/web/readme.md.
Each readme has the tool name, parameters, output fields, signal convention, and dependencies. Pick one and implement it.
- Tests — we need more coverage, especially for the tools and analyzers
- Documentation — improving inline code comments, adding docstrings
- Bug fixes — check the GitHub issues
- Frontend improvements — UI/UX polish, new chart types
- Performance — profiling and optimizing the analysis pipeline
- Python 3.10+ (we use
X | Yunion syntax andlist[T]generics) - Type hints on all function signatures
- Imports:
from __future__ import annotationsat the top of every file - Formatting: standard PEP 8, 4-space indentation
- Logging: use
LOGGERfromagent_scripts.config, notprint()
Every tool file in tools/<category>/ must follow this pattern:
"""Docstring explaining what the tool does."""
from __future__ import annotations
import json
from typing import Any, Dict
import pandas as pd
from langchain_core.tools import tool
from agent_scripts.tools import BaseTool, get_stock_data
class MyTool(BaseTool):
def __init__(self):
super().__init__("my_tool", "One-line description")
def execute(self, data: pd.DataFrame, **kwargs) -> Dict[str, Any]:
# Analysis logic
return {"signal": "BUY", "strength": 0.7}
@tool
def my_tool() -> str:
"""Docstring the LLM sees."""
data = get_stock_data()
if data is None:
return json.dumps({"error": "No stock data available"})
return json.dumps(MyTool().execute(data), default=str)
TOOL_CLASS = MyTool
TOOL_FUNC = my_toolRules:
- Every tool must return at minimum
signal(BUY/SELL/HOLD) andstrength(0.0 to 1.0) - The
@toolfunction must return a JSON string (the LLM reads it) - No look-ahead bias in ML/DL tools: labels at bar
iuse only data from bars0..i - Handle edge cases (insufficient data, NaN values) gracefully — return HOLD with strength 0.0
- Export
TOOL_CLASSandTOOL_FUNCat module level
- TypeScript strict mode
- Functional components with hooks
- Tailwind CSS for styling (no separate CSS files)
- Types defined in
UI/frontend/src/types/index.ts
- Write clear commit messages: what changed and why
- Keep commits focused — one logical change per commit
- Reference issue numbers when applicable (
Fixes #12)
-
Create a feature branch from
main:git checkout -b feature/my-feature
-
Make your changes
-
Run the tests:
pytest tests/ -v
-
For frontend changes, verify TypeScript compiles:
cd UI/frontend && npx tsc --noEmit
-
Push and open a PR against
main:git push origin feature/my-feature
-
Fill in the PR description:
- What does this change do?
- How did you test it?
- Any breaking changes?
- Tests pass (
pytest tests/ -v) - New or changed code includes matching tests (see testing requirements)
- No new linting errors
- TypeScript compiles if frontend was changed (
npx tsc --noEmit) - New tools follow the
TOOL_CLASS+TOOL_FUNCpattern - New dependencies added to
requirements.txt - Readme updated if applicable (tool directory readme or top-level README)
- PRs need at least one review before merge
- CI must pass (Python 3.10 and 3.11 test matrix)
- We'll provide feedback within a few days
The test suite is split into two categories:
| Category | Marker | What it tests | Network? |
|---|---|---|---|
| Unit tests | (default) | Tools, analyzers, predictors, Buck orchestrator, config | No — all external calls are mocked |
| Integration tests | @pytest.mark.network |
Live data from Yahoo Finance / Indian API | Yes — requires internet |
# Full test suite (unit + integration)
pytest tests/ -v
# Unit tests only (offline, no API keys needed)
pytest tests/ -v -m "not network"
# Specific file
pytest tests/test_tools.py -v
# With coverage report
pytest tests/ --cov=agent_scripts --cov-report=term-missing
# HTML coverage report
pytest tests/ --cov=agent_scripts --cov-report=html
open htmlcov/index.htmlThe conftest.py provides reusable fixtures for all test files:
| Fixture | Type | Description |
|---|---|---|
sample_ohlcv_df |
pd.DataFrame |
200-row OHLCV DataFrame with DatetimeIndex |
sample_stock_data |
StockData |
TypedDict wrapping the DataFrame |
sample_news_data |
NewsData |
TypedDict with mixed-sentiment headlines |
sample_analysis_result |
AnalysisResult |
Pre-built analysis result for predictor tests |
_patch_settings |
(auto-use) | Sets OPENAI_API_KEY=test-key and clears the LRU cache |
When you submit a PR, your tests must match the area you changed:
| If you changed… | Add / update tests in… |
|---|---|
A tool in tools/ |
tests/test_tools.py |
agent_scripts/analyzers.py |
tests/test_analyzers.py |
agent_scripts/predictors.py |
tests/test_predictors.py |
agent_scripts/buck.py |
tests/test_buck.py |
agent_scripts/config.py |
tests/test_config.py |
agent_scripts/data_providers.py |
tests/test_data_provider.py |
New tools must include at least one test in test_tools.py that:
- Calls
execute()withsample_ohlcv_df - Asserts the result contains
signal(BUY/SELL/HOLD) andstrength(0.0–1.0)
If you're new to the codebase, here's the reading order:
agent_scripts/interfaces.py— the protocols everything implementsagent_scripts/tools.py— BaseTool, ToolFactory, data contexttools/maths/rsi.py— a simple tool to understand the patternagent_scripts/analyzers.py— how tools are coordinatedagent_scripts/predictors.py— how analysis results become LLM promptsagent_scripts/buck.py— the orchestrator that ties it all together
We follow the Contributor Covenant. Be respectful, be constructive, and focus on the work.
Open an issue on GitHub. We're happy to help you get started.