Skip to content

Latest commit

 

History

History
381 lines (293 loc) · 9.17 KB

File metadata and controls

381 lines (293 loc) · 9.17 KB

Alphabots Agent Skills

This document enables any AI agent to integrate with Alphabots for order placement via webhooks and MCP.


Quick Reference

Integration Method Use Case
Webhook API HTTP POST Direct order placement from any system
MCP Server MCP Protocol Enhanced portfolio data, analysis, Indian markets

1. Webhook-Based Order Placement

The Alphabots Signal Webhook allows any system to send trading orders via HTTP POST.

Webhook URL Format

``` https://algoexestaging.alphabots.in/api/v1/signal/webhook-handler/{UUID} ```

Get your unique webhook UUID from alphabots.in.

Order Format (JSON)

```json { "order": [{ "type": "ENTRY", "symbol": "NSE:NIFTY25APRFUT", "quantity": 1, "side": "B", "ordertype": "MARKET", "segment": "FUT", "product": "N" }] } ```

Field Reference

Field Type Values Required Notes
`type` string "ENTRY", "EXIT" Yes Order type
`symbol` string "NSE:SBIN-EQ", "NSE:NIFTY25APRFUT" Yes NSE: or BSE: prefixed symbols
`quantity` number > 0 Yes Number of shares/lots
`side` string "B", "S" Yes Buy or Sell
`ordertype` string "MARKET", "LIMIT", "STOP", "STOPLIMIT" Yes Order execution type
`segment` string "EQ", "FUT", "OPT" ENTRY only Equity, Future, Options
`product` string "I", "D", "N" ENTRY only Intraday, Delivery, Normal
`limit_price` number > 0 LIMIT, STOPLIMIT Limit order price
`stop_price` number > 0 STOP, STOPLIMIT Stop loss price

Example Requests

Entry Order (Market Buy)

```bash curl -X POST https://algoexestaging.alphabots.in/api/v1/signal/webhook-handler/YOUR_UUID \ -H "Content-Type: application/json" \ -d '{"order":[{"type":"ENTRY","symbol":"NSE:NIFTY25APRFUT","quantity":1,"side":"B","ordertype":"MARKET","segment":"FUT","product":"N"}]}' ```

Entry Order (Limit Sell)

```json { "order": [{ "type": "ENTRY", "symbol": "NSE:SBIN-EQ", "quantity": 100, "side": "S", "ordertype": "LIMIT", "segment": "EQ", "product": "I", "limit_price": 750.50 }] } ```

Exit Order

```json { "order": [{ "type": "EXIT", "symbol": "NSE:NIFTY25APRFUT", "quantity": 1, "side": "S", "ordertype": "MARKET" }] } ```

Symbol Format Reference

Category Example Format Notes
Equity `NSE:SBIN-EQ`, `NSE:RELIANCE-EQ` Stock symbols with -EQ suffix
Index Futures `NSE:NIFTY25APRFUT`, `NSE:BANKNIFTY25APRFUT` YYMM format for expiry
Stock Futures `NSE:SBIN25APRFUT` Same expiry format
Options `NSE:NIFTY25APR24200CE` Symbol + YYMM + Strike + CE/PE

Integration Methods

1. TradingView (Pine Script)

```pinescript // Alert message with JSON alertJson = '{"order":[{"type":"ENTRY","symbol":"' + symbolName + '","side":"B","quantity":1,"ordertype":"MARKET","segment":"FUT","product":"N"}]}' alert(alertJson, alert.freq_once_per_bar_close) ```

See `tradingview/strategies/` for complete examples.

2. Amibroker Plugin

The `amibroker-plugin/` contains a file monitor that reads JSON files and forwards to webhook.

  1. Run `signal_file_monitor.exe`
  2. Write signals to `signal.json`
  3. Configure `.env` with webhook URL

3. Any Programming Language

Python: ```python import requests

url = "https://algoexestaging.alphabots.in/api/v1/signal/webhook-handler/YOUR_UUID" order = { "order": [{ "type": "ENTRY", "symbol": "NSE:NIFTY25APRFUT", "quantity": 1, "side": "B", "ordertype": "MARKET", "segment": "FUT", "product": "N" }] }

response = requests.post(url, json=order) print(response.status_code, response.text) ```

Node.js: ```javascript const fetch = require('node-fetch');

const url = 'https://algoexestaging.alphabots.in/api/v1/signal/webhook-handler/YOUR_UUID'; const order = { order: [{ type: 'ENTRY', symbol: 'NSE:NIFTY25APRFUT', quantity: 1, side: 'B', ordertype: 'MARKET', segment: 'FUT', product: 'N' }] };

fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(order) }).then(r => r.json()).then(console.log); ```


2. MCP Server Integration

The Alphabots MCP Server provides advanced portfolio insights and market data optimized for AI agents.

Installation

```bash npx alphabots-mcp-server@1.0.12 ```

Configuration (Claude Desktop / Trae.ai / Cursor)

Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):

```json { "mcpServers": { "alphabots": { "command": "npx", "args": ["alphabots-mcp-server@1.0.12"], "env": { "mcp_token": "YOUR_MCP_TOKEN_HERE" } } } } ```

Trae.ai / Cursor / ChatGPT (`~/mcp.json`):

```json { "mcpServers": { "alphabots": { "command": "npx", "args": ["alphabots-mcp-server@1.0.12"], "ENV": { "mcp_token": "YOUR_MCP_TOKEN_HERE" } } } } ```

Bundle Import

For IDEs with native MCP support (VS Code, JetBrains):

  1. Download `mcp-server/alphabots_bundle.mcpb`
  2. Import via IDE's MCP extension
  3. Set your MCP token

Available MCP Tools

The MCP server exposes these tools:

Tool Description
`get_portfolio_summary` Complete portfolio overview with P&L
`get_broker_insights` Broker-specific analytics and stats
`get_holdings` List all current holdings with details
`analyze_options` CE/PE options analysis with Greeks
`get_advanced_analysis` Deep portfolio metrics and trends
`get_weekly_expiry_options` Weekly options positions and exposure

Example MCP Usage

Get Portfolio Summary

``` Agent: Show my portfolio summary

Response: 📊 Portfolio Summary

Total Value: ₹12,45,678 Today's P&L: +₹23,450 (+1.92%) Total P&L: +₹2,34,567 (+23.2%)

Holdings: 32 positions Cash: ₹1,23,456 ```

Analyze Options

``` Agent: Analyze my options positions

Response: 📈 Options Analysis

NIFTY 24200 CE: ₹125 | Delta: 0.52 | Theta: -₹8.5/day BANKNIFTY 49000 PE: ₹180 | Delta: -0.38 | Theta: -₹12.2/day

Total Options P&L: +₹15,678 Weekly Exposure: ₹8,50,000 ```

Token Configuration

Replace `YOUR_MCP_TOKEN_HERE` with your actual token: ``` mcp_Dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ```

Get your MCP token from Alphabots portal.

Features

  • Portfolio Insights: Complete summary with advanced analytics
  • Options Analysis: Intelligent CE/PE detection with Greeks
  • Enhanced Symbol Processing: NSE:/BSE: prefixed symbols
  • Weekly Expiry Support: YYMDD format parsing
  • Real-time Data: Yahoo Finance integration for live prices
  • Indian Market Focus: Optimized for NSE, BSE, derivatives
  • INR Currency: All values in Indian Rupees (₹)
  • 30+ Holdings: Comprehensive tracking
  • Indian Formatting: Proper locale formatting

3. Best Practices for Agents

Order Validation

Before sending an order, verify:

  1. ✅ Symbol format is correct (NSE: or BSE: prefix)
  2. ✅ Quantity is valid (> 0)
  3. ✅ Segment matches symbol type (EQ/FUT/OPT)
  4. ✅ Required fields for order type are present
  5. ✅ Limit/stop prices are valid for order type

Error Handling

```python try: response = requests.post(webhook_url, json=order, timeout=10) if response.status_code == 200: print("Order sent successfully") else: print(f"Error: {response.status_code} - {response.text}") except requests.RequestException as e: print(f"Request failed: {e}") ```

Rate Limiting

  • Webhook: Respect any rate limits returned by the API
  • MCP: Tools are rate-limited per connection

Symbol Mapping

If your system uses internal symbols (e.g., "NIFTY-I"), map them to Alphabots format:

```json { "NIFTY-I": "NSE:NIFTY25APRFUT", "BANKNIFTY-I": "NSE:BANKNIFTY25APRFUT", "SBIN": "NSE:SBIN-EQ" } ```

Testing

Always test with paper trading or small quantities first:

```json { "order": [{ "type": "ENTRY", "symbol": "NSE:NIFTY25APRFUT", "quantity": 1, "side": "B", "ordertype": "MARKET", "segment": "FUT", "product": "I" }] } ```


4. Support & Resources


Quick Start Checklist

For agents new to Alphabots:

  • Get webhook UUID from Alphabots portal
  • Get MCP token (if using MCP)
  • Configure MCP in your IDE (optional)
  • Test with a sample order
  • Integrate webhook calls into your agent logic
  • Set up error handling and logging
  • Test with small quantities first

Last updated: February 2026