Reading the repo
Opening the box…
Reading the repo
Opening the box…
Assembly instructions
Full-stack financial research assistant with real-time market data, news aggregation, Fed intelligence, and ticker analysis
GitHub didn't answer, so this is the saved copy from 16 h ago
Will it work on macOS?
Heads-upBuilding it yourself? It also needs 8 settings in .env (3 secret).
DEVELOPMENT.mdComplete guide for developers working with Market Intelligence.
market-intelligence/
├── main.py # CLI entry point (argparse)
├── config.py # Configuration and env loading
├── requirements.txt # Python dependencies
├── .env.example # Template for API keys
│
├── agents/ # High-level orchestration modules
│ ├── market_agent.py # Real-time market data fetching
│ ├── news_agent.py # News aggregation & sentiment
│ ├── fed_agent.py # Federal Reserve & macro data
│ └── research_agent.py # Comprehensive ticker analysis
│
├── tools/ # Low-level utility modules
│ ├── data_sources.py # API wrappers and data fetching
│ ├── technical.py # Technical analysis calculations
│ ├── sentiment.py # News sentiment scoring
│ └── formatter.py # Terminal output formatting (Rich)
│
├── references/ # Documentation
│ ├── api-sources.md # API integration guide
│ ├── indicator-guide.md # Technical indicator reference
│ └── fed-calendar.md # FOMC and macro calendar
│
├── scripts/ # Standalone utility scripts
│ ├── fetch_market.sh # Quick shell wrapper
│ └── daily_brief.py # Scheduled daily summary
│
├── SKILL.md # Copilot skill definition
├── README.md # User documentation
└── DEVELOPMENT.md # This file
Separation of Concerns:
agents/: Business logic (what to fetch)tools/: Technical logic (how to fetch/calculate)config/: Settings and constantsmain.py: User interfaceData Flow:
main.py (CLI)
↓
agents/ (orchestration)
↓
tools/ (operations)
↓
API/Cache/Calculation
Error Handling:
DataSourceError for API failures_log() function (verbose mode)Caching:
"source:params"def get_new_data(symbol: str) -> Dict[str, Any]:
"""
Fetch data from new API.
Args:
symbol: Data symbol
Returns:
Dictionary with data
"""
cache_key = _cache_key("new_source", {"symbol": symbol})
cached = _get_cached(cache_key)
if cached:
return cached
try:
# API call here
result = {...}
_set_cached(cache_key, result)
return result
except Exception as e:
raise DataSourceError(f"API failed: {str(e)}")
NEW_API_KEY = os.getenv("NEW_API_KEY", "")
NEW_API_URL = "https://api.example.com"
NEW_API_KEY=your_key_here
from tools.data_sources import get_new_data
data = get_new_data(symbol)
def cmd_mycommand(args):
"""Handle mycommand command."""
print_info("Processing...")
# Your logic here
result = do_something(args)
if args.output == "table":
console.print(result)
elif args.output == "json":
console.print(json.dumps(result))
mycommand_parser = subparsers.add_parser("mycommand", help="My command")
mycommand_parser.add_argument("--option", help="Option description")
mycommand_parser.add_argument("--output", choices=["table", "json"], default="table")
elif args.command == "mycommand":
cmd_mycommand(args)
In tools/technical.py:
def calculate_my_indicator(prices: pd.Series, period: int = 14) -> pd.Series:
"""
Calculate custom indicator.
Args:
prices: Series of prices
period: Calculation period
Returns:
Series of indicator values
Formula:
My Indicator = (Price × Factor) / Divisor
"""
try:
result = (prices * some_factor) / some_divisor
return result
except Exception as e:
_log(f"Calculation failed: {str(e)}")
return pd.Series(dtype=float)
from tools.technical import calculate_my_indicator
def generate_research_report(ticker):
hist = get_historical_data(ticker)
prices = hist["Close"]
my_ind = calculate_my_indicator(prices)
report["sections"]["my_indicator"] = {
"value": my_ind.iloc[-1],
"signal": interpret_indicator(my_ind.iloc[-1]),
}
In tools/sentiment.py:
# Add keywords
CUSTOM_KEYWORDS = {"boom", "bust", "turnaround"}
# Or use custom scoring function
def custom_sentiment_score(headline: str) -> Tuple[float, str]:
"""Custom sentiment logic."""
# Your implementation
return (polarity, label)
from tools.sentiment import analyze_headline_sentiment
result = analyze_headline_sentiment("AAPL beats earnings expectations")
# Returns: {"sentiment": "Bullish", "confidence": 0.87, ...}
Set in config or CLI:
python main.py --demo market --ticker AAPL
Or in code:
from config import DEMO_MODE
if DEMO_MODE:
return get_demo_data()
All agents should have get_demo_*() functions:
def get_demo_stock_data() -> Dict[str, Any]:
return {
"ticker": "DEMO",
"price": 150.00,
...
}
--demo to verify output formatCurrent: 60-300 second TTL
Recommendations:
Built-in strategies:
Currently synchronous. For async support:
import asyncio
from aiohttp import ClientSession
async def fetch_all(tickers):
tasks = [fetch_one(ticker) for ticker in tickers]
return await asyncio.gather(*tasks)
python main.py --verbose market --ticker AAPL
Or:
VERBOSE=true
Used throughout codebase:
from config import VERBOSE
def _log(message: str):
if VERBOSE:
print(f"[DEBUG] {message}")
_log(f"Fetching data for {ticker}")
_log(f"Cache hit: {key}")
_log(f"API response: {response}")
def function_name(param1: str, param2: int) -> Dict[str, Any]:
"""
Short description (1 line).
Longer description if needed, explaining purpose and behavior.
Can include implementation notes.
Args:
param1: Description of param1
param2: Description of param2
Returns:
Description of return value
Raises:
CustomError: When error condition occurs
Example:
>>> result = function_name("value", 10)
>>> result["key"]
"expected"
"""
Always use type hints:
def process_data(
data: List[Dict[str, Any]],
filter_type: Optional[str] = None
) -> Dict[str, Any]:
pass
Solution: Ensure you're in project directory, and did pip install -r requirements.txt
Solution: Check .env file exists and has correct format
Solution: Use --demo flag or wait 60 seconds (cache TTL)
Solution: Verify ticker is valid (case-sensitive for crypto)
Solution:
--verbose to see API calls# Run linter
pylint *.py tools/*.py agents/*.py
# Run formatter
black --line-length 80 *.py tools/*.py agents/*.py
# Test basic functionality
python main.py --demo snapshot
python main.py --demo research --ticker AAPL
git checkout -b feature/my-featureFor issues:
--verbose--demo mode to isolate issueThen run bash setup.sh. It stops at the first error and is safe to run again. Servers and tests aren't started; it lists them at the end. Read it first.
Needs Git: xcode-select --install
git clone https://github.com/hasnain-akhtar-ha/market-intelligence.git cd market-intelligence
Python 3.x (no version pinned)
brew install python
Fill in secrets: FRED_API_KEY, NEWSAPI_KEY, ALPHA_VANTAGE_KEY
cp .env.example .env
python -m venv .venv source .venv/bin/activate pip install -r requirements.txt
python main.py
# Navigate to project directory (or copy to your workspace)
cd /path/to/market-intelligence
# Install dependencies
pip install -r requirements.txt
# Copy the example env file
cp .env.example .env
# Edit .env and add your API keys (optional)
# For free tier, just yfinance and CoinGecko work without keys
nano .env
# Get current stock price (no API key needed)
python main.py market --ticker AAPL
# Get Bitcoin price
python main.py market --ticker BTC --type crypto
# See full market snapshot
python main.py snapshot
# Demo mode (uses mock data)
python main.py --demo snapshot
python main.py research --ticker NVDA --output markdown
No reports for macOS yet.
GitManual AI Agent reads the 4 key files and writes a step-by-step guide for macOS. Once written, it's saved for everyone.