@ethosagent/tools-india-broker-zerodha 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,116 @@
1
+ {
2
+ "name": "@ethosagent/tools-india-broker-zerodha",
3
+ "version": "0.1.0",
4
+ "description": "Zerodha Kite Connect broker tools for Ethos AI agents — holdings, positions, orders, dry-run order placement",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ },
13
+ "./panel": {
14
+ "import": "./dist/panel.js"
15
+ }
16
+ },
17
+ "bin": {
18
+ "zerodha-broker": "./dist/cli.js"
19
+ },
20
+ "engines": {
21
+ "node": ">=24"
22
+ },
23
+ "packageManager": "npm@10.8.1",
24
+ "scripts": {
25
+ "build": "tsup",
26
+ "dev": "tsup --watch",
27
+ "dev:panel": "tsup --watch --entry.panel src/panel.tsx",
28
+ "test": "vitest run",
29
+ "test:watch": "vitest",
30
+ "typecheck": "tsc --noEmit",
31
+ "lint": "biome check .",
32
+ "lint:fix": "biome check --write .",
33
+ "check": "npm run typecheck && npm run lint && npm run test",
34
+ "prepublishOnly": "npm run check && npm run build",
35
+ "postinstall": "npm rebuild better-sqlite3"
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "skills",
40
+ "README.md",
41
+ "CHANGELOG.md",
42
+ "LICENSE"
43
+ ],
44
+ "peerDependencies": {
45
+ "@ethosagent/plugin-sdk": ">=0.4.3",
46
+ "@ethosagent/ui-components": ">=0.x"
47
+ },
48
+ "peerDependenciesMeta": {
49
+ "@ethosagent/plugin-sdk": {
50
+ "optional": true
51
+ },
52
+ "@ethosagent/ui-components": {
53
+ "optional": true
54
+ }
55
+ },
56
+ "dependencies": {
57
+ "better-sqlite3": "12.10.0",
58
+ "zod": "4.4.3"
59
+ },
60
+ "devDependencies": {
61
+ "@biomejs/biome": "2.4.15",
62
+ "@types/react": "^18.3.0",
63
+ "@ethosagent/plugin-sdk": "^0.4.3",
64
+ "@types/better-sqlite3": "7.6.13",
65
+ "@types/node": "22.19.19",
66
+ "tsup": "8.5.1",
67
+ "typescript": "6.0.3",
68
+ "vitest": "4.1.7"
69
+ },
70
+ "keywords": [
71
+ "ethos",
72
+ "india",
73
+ "zerodha",
74
+ "kite",
75
+ "broker",
76
+ "nse",
77
+ "bse",
78
+ "ai-agent"
79
+ ],
80
+ "license": "MIT",
81
+ "author": "Mitesh Sharma",
82
+ "repository": {
83
+ "type": "git",
84
+ "url": "https://github.com/MiteshSharma/tools-india-broker-zerodha"
85
+ },
86
+ "ethos": {
87
+ "type": "plugin",
88
+ "id": "tools-india-broker-zerodha",
89
+ "pluginContractMajor": 2,
90
+ "hasHomePanel": true,
91
+ "skills_dir": "skills",
92
+ "priority": 0,
93
+ "dependencies": [],
94
+ "credentials": [
95
+ {
96
+ "ref": "brokers/zerodha/apiKey",
97
+ "label": "API Key",
98
+ "kind": "secret",
99
+ "description": "Zerodha API key"
100
+ },
101
+ {
102
+ "ref": "brokers/zerodha/apiSecret",
103
+ "label": "API Secret",
104
+ "kind": "secret",
105
+ "description": "Zerodha API secret"
106
+ },
107
+ {
108
+ "ref": "brokers/zerodha/accessToken",
109
+ "label": "Access Token",
110
+ "kind": "oauth",
111
+ "oauthRef": "zerodha",
112
+ "description": "Zerodha access token (renewed daily)"
113
+ }
114
+ ]
115
+ }
116
+ }
@@ -0,0 +1,30 @@
1
+ # Skill: Portfolio Review
2
+
3
+ ## Purpose
4
+ Comprehensive review of the user's Zerodha equity portfolio.
5
+
6
+ ## Data Context
7
+ `{{holdings}}` — output of zerodha_holdings tool
8
+ `{{account}}` — output of zerodha_account tool
9
+ `{{market_brief}}` — output of nse_market_brief (if available)
10
+
11
+ ## Instructions
12
+
13
+ 1. **Summary**: Total invested, current value, overall P&L (INR + %)
14
+ 2. **Top performers**: Top 3 holdings by unrealised P&L %
15
+ 3. **Laggards**: Bottom 3 holdings by unrealised P&L % — any position review warranted?
16
+ 4. **Concentration risk**: Any single position > 20% of portfolio? Any sector concentration?
17
+ 5. **Cash position**: Available cash vs total portfolio value — over-invested?
18
+ 6. **Day context**: Which holdings had notable day moves (>2%) today?
19
+ 7. **Action items**: Any holdings with upcoming results, corporate actions (from memory)?
20
+
21
+ ## Output Schema
22
+ {
23
+ "summary": { "total_invested": 0, "current_value": 0, "pnl_inr": 0, "pnl_pct": 0 },
24
+ "top_performers": [{ "symbol": "", "pnl_pct": 0 }],
25
+ "laggards": [{ "symbol": "", "pnl_pct": 0, "note": "" }],
26
+ "concentration_alerts": ["string"],
27
+ "cash_available_inr": 0,
28
+ "action_items": ["string"],
29
+ "overall_posture": "fully_invested" | "balanced" | "heavy_cash"
30
+ }
@@ -0,0 +1,4 @@
1
+ # Skill: Position Sizing
2
+
3
+ ## Purpose
4
+ Calculate appropriate position size for a proposed trade based on portfolio context and risk parameters.
@@ -0,0 +1,36 @@
1
+ # Skill: Pre-Trade Checklist
2
+
3
+ ## Purpose
4
+ Structured checklist to evaluate before placing a real order.
5
+
6
+ ## Data Context
7
+ `{{proposed_order}}` — the order parameters under consideration
8
+ `{{holdings}}` — current portfolio
9
+ `{{account}}` — available funds
10
+ `{{symbol_brief}}` — recent data for the symbol (price, indicators from NSE tool)
11
+
12
+ ## Instructions
13
+
14
+ Run through this checklist in order. If any item fails, flag it.
15
+
16
+ 1. **Funds check**: Will available cash cover the order? (quantity x price <= net_available)
17
+ 2. **Sizing check**: Will this position be > 20% of total portfolio value?
18
+ 3. **Duplicate check**: Do we already hold this symbol? If yes, state new total quantity post-buy
19
+ 4. **Market hours**: Is it currently market hours (09:15-15:30 IST)?
20
+ 5. **Price sanity**: For LIMIT orders — is the limit price within 2% of LTP?
21
+ 6. **Dry run confirmation**: Was dry_run already executed for this order?
22
+
23
+ ## Output Schema
24
+ {
25
+ "all_clear": true | false,
26
+ "checks": {
27
+ "funds": { "pass": true, "detail": "INR 29800 required, INR 150000 available" },
28
+ "sizing": { "pass": true, "detail": "3.2% of portfolio" },
29
+ "duplicate": { "pass": true, "detail": "No existing position" },
30
+ "market_hours": { "pass": true, "detail": "09:18 IST" },
31
+ "price_sanity": { "pass": true, "detail": "Limit 2980, LTP 2975 (0.17% away)" },
32
+ "dry_run_done": { "pass": true, "detail": "Dry run executed at 09:15 IST" }
33
+ },
34
+ "recommendation": "Proceed" | "Review required",
35
+ "flags": ["string"]
36
+ }