CtrlK
BlogDocsLog inGet started
Tessl Logo

finance-agent

NSE stock market analysis using Groww API. Use when users ask about Indian stocks, live prices, technical analysis, RSI, moving averages, or market comparison.

85

Quality

81%

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Advisory

Suggest reviewing before use

SKILL.md
Quality
Evals
Security

Finance Agent

Read-only NSE stock analysis using Groww Trading API.

Architecture

┌─────────────────────────────────────────┐
│         Opencode Agent                  │
│  (handles reasoning & decisions)        │
└─────────────────────────────────────────┘
           │
           ▼
┌─────────────────────────────────────────┐
│         Markdown Skills                 │
├─────────────────────────────────────────┤
│  stock-data.md      - Live/HIST data    │
│  technical.md        - RSI, MA, MACD     │
│  compare.md          - Stock comparison  │
│  news-analysis.md    - News & sentiment  │
│  analysis-workflow.md - Complete workflow │
└─────────────────────────────────────────┘
           │
           ▼
┌─────────────────────────────────────────┐
│         Data Sources                     │
├─────────────────────────────────────────┤
│  Groww API          - Live prices, RSI   │
│  Web Search          - News, sentiment   │
│  Python Tools        - Analysis scripts  │
└─────────────────────────────────────────┘

Setup

# Install dependencies
pip install growwapi pyotp python-dotenv

# Set environment variables
cp .env.example .env
# Edit .env with your Groww API credentials

Environment Variables

# Option 1: API Key + Secret
GROWW_API_KEY=your_api_key
GROWW_API_SECRET=your_api_secret

# Option 2: TOTP (no daily re-auth)
GROWW_API_KEY=your_totp_token
GROWW_USE_TOTP=true
GROWW_TOTP_SECRET=your_totp_secret

# Option 3: Pre-generated access token
GROWW_ACCESS_TOKEN=your_access_token

Quick Start

CLI Usage

# Get stock data with RSI
python tools/stock_data.py RELIANCE INFY --quote --rsi

# Calculate technical indicators
python tools/technical.py RELIANCE --indicators rsi,ma,macd

# Compare multiple stocks
python tools/compare.py RELIANCE INFY TCS --full

Python API

from tools.groww_client import GrowwClient
from tools.portfolio_analyzer import PortfolioAnalyzer
from tools.technical import calculate_indicators
from tools.compare import compare_stocks

# Initialize
client = GrowwClient()

# Get prices
prices = client.get_ltp(["RELIANCE", "INFY"])
# {'NSE_RELIANCE': 2500.5, 'NSE_INFY': 1580.25}

# Get full quote
quote = client.get_quote("RELIANCE")

# Calculate RSI
rsi = client.calculate_rsi("RELIANCE")
# 58.5

# Get moving averages
ma = client.calculate_moving_averages("RELIANCE")
# {'sma_20': 2450.0, 'sma_50': 2400.0}

# Portfolio - Holdings
holdings = client.get_holdings()
# {'holdings': [{'trading_symbol': 'RELIANCE', 'quantity': 10, 'average_price': 2500}]}

# Portfolio - Positions
positions = client.get_positions()
# {'positions': [{'trading_symbol': 'RELIANCE', 'segment': 'CASH', 'realised_pnl': 500}]}

# Full Portfolio Analysis
analyzer = PortfolioAnalyzer()
summary = analyzer.analyze_portfolio()
# {'total_invested': 65500, 'current_value': 65900, 'total_pl_percentage': 0.61, ...}

# Compare stocks
comparison = compare_stocks(["RELIANCE", "INFY", "TCS"], full=True)

Skills

1. Stock Data (skills/stock-data.md)

  • Live prices (LTP)
  • OHLC data
  • Volume, 52-week high/low
  • Historical candles

2. Technical Analysis (skills/technical.md)

  • RSI (Relative Strength Index)
  • Moving Averages (SMA 20/50/200)
  • MACD signals
  • Support/Resistance levels
  • Trend determination

3. Compare (skills/compare.md)

  • Side-by-side stock comparison
  • Ranking by momentum/RSI
  • Quick selection tool

4. Portfolio Analyzer (skills/portfolio.md)

  • Holdings view (delivery stocks from Demat)
  • Positions view (intraday/derivatives)
  • P&L analysis with unrealized gains/losses
  • Best/worst performer identification
  • Groww Portfolio API integration

5. News Analysis (skills/news-analysis.md)

  • Recent news research via web search
  • Sentiment classification (POSITIVE/NEGATIVE/NEUTRAL)
  • Impact assessment
  • Catalyst identification
  • Use agent's websearch tool to fetch news

6. Workflow (skills/analysis-workflow.md)

  • Complete analysis template
  • Signal interpretation
  • Example analysis

Example Session

User: "What's the RSI for RELIANCE and INFY?"

Agent:

python tools/stock_data.py RELIANCE INFY --rsi

Response:

{
  "RELIANCE": {"ltp": 2500.5, "rsi": 58.5},
  "INFY": {"ltp": 1580.25, "rsi": 62.3}
}

Interpretation: Both in neutral zone (30-70), INFY slightly overbought.


User: "Compare RELIANCE vs TCS for short-term trading"

Agent:

python tools/compare.py RELIANCE TCS --full
python tools/technical.py RELIANCE --indicators rsi,ma,trend
python tools/technical.py TCS --indicators rsi,ma,trend

Available Tools

ToolPurposeExample
stock_data.pyGet prices/datapython tools/stock_data.py RELIANCE --quote
technical.pyCalculate indicatorspython tools/technical.py RELIANCE --indicators rsi,ma
compare.pyCompare stockspython tools/compare.py RELIANCE INFY
portfolio_analyzer.pyPortfolio analysispython tools/portfolio_analyzer.py --analyze
groww_client.pyAPI wrapperclient.get_holdings()
news_tools.pySentiment analysisanalyze_sentiment(news_data)

Portfolio Analysis

# View your holdings with P&L
python tools/portfolio_analyzer.py --holdings

# Full portfolio analysis
python tools/portfolio_analyzer.py --analyze

# View positions (intraday/F&O)
python tools/portfolio_analyzer.py --positions --segment FNO

Python API

from tools.groww_client import GrowwClient
from tools.portfolio_analyzer import PortfolioAnalyzer

client = GrowwClient()

# Get holdings
holdings = client.get_holdings()
# {'holdings': [{'trading_symbol': 'RELIANCE', 'quantity': 10, 'average_price': 2500, ...}]}

# Get positions
positions = client.get_positions()
# {'positions': [{'trading_symbol': 'RELIANCE', 'segment': 'CASH', 'realised_pnl': 500, ...}]}

# Full analysis with P&L
analyzer = PortfolioAnalyzer()
summary = analyzer.analyze_portfolio()
# Returns total invested, current value, P&L, best/worst performers

News Research Workflow

  1. Search news: Use agent's websearch tool

    websearch(query="HDFCBANK stock news March 2026", numResults=10)
  2. Analyze sentiment: Use analyze_sentiment() from news_tools

    from skills.news_tools import analyze_sentiment
    sentiment = analyze_sentiment({"results": news_articles})
  3. Assess impact: Combine with technical data for complete analysis

Read-Only

This agent only reads market data. No order placement, no trading.

Repository
lakhanjindam/opencode-finance-agent
Last updated
Created

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.