@guiie/buda-mcp 1.2.2 → 1.4.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/PUBLISH_CHECKLIST.md +71 -63
  3. package/README.md +4 -4
  4. package/dist/http.js +39 -0
  5. package/dist/index.js +29 -0
  6. package/dist/tools/arbitrage.d.ts +35 -0
  7. package/dist/tools/arbitrage.d.ts.map +1 -0
  8. package/dist/tools/arbitrage.js +142 -0
  9. package/dist/tools/balances.d.ts.map +1 -1
  10. package/dist/tools/balances.js +24 -4
  11. package/dist/tools/calculate_position_size.d.ts +48 -0
  12. package/dist/tools/calculate_position_size.d.ts.map +1 -0
  13. package/dist/tools/calculate_position_size.js +111 -0
  14. package/dist/tools/compare_markets.d.ts.map +1 -1
  15. package/dist/tools/compare_markets.js +11 -10
  16. package/dist/tools/dead_mans_switch.d.ts +84 -0
  17. package/dist/tools/dead_mans_switch.d.ts.map +1 -0
  18. package/dist/tools/dead_mans_switch.js +236 -0
  19. package/dist/tools/market_sentiment.d.ts +30 -0
  20. package/dist/tools/market_sentiment.d.ts.map +1 -0
  21. package/dist/tools/market_sentiment.js +104 -0
  22. package/dist/tools/market_summary.d.ts +43 -0
  23. package/dist/tools/market_summary.d.ts.map +1 -0
  24. package/dist/tools/market_summary.js +81 -0
  25. package/dist/tools/markets.d.ts.map +1 -1
  26. package/dist/tools/markets.js +4 -2
  27. package/dist/tools/orderbook.d.ts.map +1 -1
  28. package/dist/tools/orderbook.js +14 -4
  29. package/dist/tools/orders.d.ts.map +1 -1
  30. package/dist/tools/orders.js +41 -3
  31. package/dist/tools/price_history.d.ts.map +1 -1
  32. package/dist/tools/price_history.js +5 -43
  33. package/dist/tools/simulate_order.d.ts +45 -0
  34. package/dist/tools/simulate_order.d.ts.map +1 -0
  35. package/dist/tools/simulate_order.js +139 -0
  36. package/dist/tools/spread.d.ts.map +1 -1
  37. package/dist/tools/spread.js +10 -8
  38. package/dist/tools/technical_indicators.d.ts +39 -0
  39. package/dist/tools/technical_indicators.d.ts.map +1 -0
  40. package/dist/tools/technical_indicators.js +223 -0
  41. package/dist/tools/ticker.d.ts.map +1 -1
  42. package/dist/tools/ticker.js +24 -3
  43. package/dist/tools/trades.d.ts.map +1 -1
  44. package/dist/tools/trades.js +17 -3
  45. package/dist/tools/volume.d.ts.map +1 -1
  46. package/dist/tools/volume.js +21 -3
  47. package/dist/types.d.ts +9 -0
  48. package/dist/types.d.ts.map +1 -1
  49. package/dist/utils.d.ts +23 -0
  50. package/dist/utils.d.ts.map +1 -0
  51. package/dist/utils.js +68 -0
  52. package/marketplace/README.md +1 -1
  53. package/marketplace/claude-listing.md +60 -14
  54. package/marketplace/gemini-tools.json +183 -9
  55. package/marketplace/openapi.yaml +335 -119
  56. package/package.json +1 -1
  57. package/server.json +2 -2
  58. package/src/http.ts +44 -0
  59. package/src/index.ts +34 -0
  60. package/src/tools/arbitrage.ts +202 -0
  61. package/src/tools/balances.ts +27 -4
  62. package/src/tools/calculate_position_size.ts +141 -0
  63. package/src/tools/compare_markets.ts +11 -10
  64. package/src/tools/dead_mans_switch.ts +314 -0
  65. package/src/tools/market_sentiment.ts +141 -0
  66. package/src/tools/market_summary.ts +124 -0
  67. package/src/tools/markets.ts +4 -2
  68. package/src/tools/orderbook.ts +15 -4
  69. package/src/tools/orders.ts +45 -4
  70. package/src/tools/price_history.ts +5 -57
  71. package/src/tools/simulate_order.ts +182 -0
  72. package/src/tools/spread.ts +10 -8
  73. package/src/tools/technical_indicators.ts +282 -0
  74. package/src/tools/ticker.ts +27 -3
  75. package/src/tools/trades.ts +18 -3
  76. package/src/tools/volume.ts +24 -3
  77. package/src/types.ts +12 -0
  78. package/src/utils.ts +73 -0
  79. package/test/unit.ts +758 -0
@@ -12,7 +12,9 @@
12
12
 
13
13
  Real-time market data from [Buda.com](https://www.buda.com/), the leading cryptocurrency exchange operating in Chile, Colombia, and Peru. All public data is sourced from Buda's public REST API v2 — no API key required.
14
14
 
15
- Use this server to query live prices, spreads, order books, OHLCV candles, trade history, and volume for all BTC, ETH, and altcoin markets quoted in CLP, COP, PEN, and USDC. Optional API credentials unlock account tools for balances and order management.
15
+ Use this server to query live prices, spreads, order books, OHLCV candles, trade history, volume, and cross-market arbitrage opportunities for all BTC, ETH, and altcoin markets quoted in CLP, COP, PEN, and USDC. Optional API credentials unlock account tools for balances and order management.
16
+
17
+ **v1.4.0** adds 5 new tools: `simulate_order`, `calculate_position_size`, `get_market_sentiment`, `get_technical_indicators`, and a dead man's switch (`schedule_cancel_all` + `renew_cancel_timer` + `disarm_cancel_timer`). All response schemas are flat and fully typed.
16
18
 
17
19
  ---
18
20
 
@@ -20,48 +22,71 @@ Use this server to query live prices, spreads, order books, OHLCV candles, trade
20
22
 
21
23
  ### Public tools (no credentials required)
22
24
 
25
+ ### `get_market_summary` ⭐ Start here
26
+ One-call summary of everything relevant about a market: last price, bid/ask, spread %, 24h volume, price change, and `liquidity_rating` ("high" / "medium" / "low"). Best first tool to call when a user asks about any specific market.
27
+ **Parameters:** `market_id` *(required)* — e.g. `BTC-CLP`.
28
+
23
29
  ### `get_markets`
24
- List all available trading pairs on Buda.com, or retrieve details for a specific market.
25
- Returns: base/quote currencies, trading fees, minimum order amounts, fee discount tiers.
30
+ Lists all available trading pairs on Buda.com, or returns details for a specific market (fees, minimum order size, discount tiers).
26
31
  **Parameters:** `market_id` *(optional)* — e.g. `BTC-CLP`. Omit to list all 26 markets.
27
32
 
28
33
  ### `get_ticker`
29
- Current market snapshot: last traded price, best bid and ask, 24h volume, and price change over 24h and 7d.
34
+ Current market snapshot: last traded price, best bid and ask, 24h volume, and price change over 24h and 7d. All values are floats in the quote currency.
30
35
  **Parameters:** `market_id` *(required)* — e.g. `BTC-CLP`, `ETH-COP`, `ETH-BTC`.
31
36
 
32
37
  ### `get_orderbook`
33
- Full order book for a market: sorted bids and asks as `[price, amount]` pairs.
38
+ Full order book for a market: bids and asks as `{price, amount}` objects (floats). Bids sorted highest-first, asks lowest-first.
34
39
  **Parameters:** `market_id` *(required)*, `limit` *(optional)* — cap levels returned per side.
35
40
 
36
41
  ### `get_trades`
37
- Recent trade history. Each entry: `[timestamp_ms, amount, price, direction]`.
42
+ Recent trade history as typed objects: `{timestamp_ms, amount, price, direction}` with all numeric fields as floats.
38
43
  **Parameters:** `market_id` *(required)*, `limit` *(optional, max 100)*, `timestamp` *(optional, for pagination)*.
39
44
 
40
45
  ### `get_market_volume`
41
- 24h and 7-day transacted volume broken down by buy (bid) and sell (ask) side.
46
+ 24h and 7-day transacted volume as floats broken down by buy (bid) and sell (ask) side.
42
47
  **Parameters:** `market_id` *(required)*.
43
48
 
44
49
  ### `get_spread`
45
- Bid/ask spread for a market: absolute spread and spread as a percentage of the ask price.
50
+ Bid/ask spread for a market: `best_bid`, `best_ask`, `spread_absolute`, and `spread_percentage` as floats. `spread_percentage` is in percent (e.g. 0.15 = 0.15%).
46
51
  **Parameters:** `market_id` *(required)*.
47
52
 
48
53
  ### `compare_markets`
49
- Side-by-side ticker data for all trading pairs of a given base currency across all supported quote currencies.
54
+ Side-by-side ticker data for all trading pairs of a given base currency across all supported quote currencies. `price_change_*` fields are floats in percent.
50
55
  **Parameters:** `base_currency` *(required)* — e.g. `BTC`, `ETH`, `XRP`.
51
56
 
52
57
  ### `get_price_history`
53
- OHLCV (open/high/low/close/volume) candles derived from recent trade history (Buda has no native candlestick endpoint). Supports `1h`, `4h`, and `1d` periods. Candle timestamps are UTC bucket boundaries.
54
- **Parameters:** `market_id` *(required)*, `period` *(optional: `1h`/`4h`/`1d`, default `1h`)*, `limit` *(optional, default 100, max 1000 trades — more = deeper history)*.
58
+ OHLCV (open/high/low/close/volume) candles derived from recent trade history (Buda has no native candlestick endpoint). All candle values are floats. Supports `1h`, `4h`, and `1d` periods.
59
+ **Parameters:** `market_id` *(required)*, `period` *(optional: `1h`/`4h`/`1d`, default `1h`)*, `limit` *(optional, default 100, max 1000 trades)*.
60
+
61
+ ### `get_arbitrage_opportunities`
62
+ Detects cross-country price discrepancies for a given asset across Buda's CLP, COP, and PEN markets, normalized to USDC. Returns pairwise discrepancies above `threshold_pct` sorted by size. Includes a `fees_note` reminding that Buda's 0.8% taker fee per leg (~1.6% round-trip) must be deducted.
63
+ **Parameters:** `base_currency` *(required)* — e.g. `BTC`, `threshold_pct` *(optional, default 0.5)*.
64
+
65
+ ### `simulate_order`
66
+ Simulates a buy or sell order using live ticker data — no order is ever placed. Returns `estimated_fill_price`, `fee_amount`, `fee_currency`, `total_cost`, and `slippage_vs_mid_pct`. All outputs include `simulation: true`. Uses actual taker fee from market data (0.8% crypto / 0.5% stablecoin).
67
+ **Parameters:** `market_id` *(required)*, `side` (`buy`|`sell`) *(required)*, `amount` *(required)*, `price` *(optional — omit for market order simulation)*.
68
+
69
+ ### `calculate_position_size`
70
+ Calculates how many units to buy or sell so a stop-loss hit costs exactly `risk_pct`% of `capital`. Fully client-side — no API call. Returns `units`, `capital_at_risk`, `position_value`, `fee_impact`, and a plain-text `risk_reward_note`.
71
+ **Parameters:** `market_id`, `capital`, `risk_pct` (0.1–10), `entry_price`, `stop_loss_price` *(all required)*.
72
+
73
+ ### `get_market_sentiment`
74
+ Composite sentiment score (−100 to +100) from three components: 24h price variation (40%), volume vs 7-day daily average (35%), spread vs market-type baseline (25%). Returns `score`, `label` (`bearish`/`neutral`/`bullish`), `component_breakdown`, and a `disclaimer`.
75
+ **Parameters:** `market_id` *(required)*.
76
+
77
+ ### `get_technical_indicators`
78
+ RSI (14), MACD (12/26/9), Bollinger Bands (20, 2σ), SMA 20, and SMA 50 — computed server-side from Buda trade history (no external libraries). Returns latest values + signal interpretations. Returns a structured warning if fewer than 50 candles are available after aggregation. Includes `disclaimer`.
79
+ **Parameters:** `market_id` *(required)*, `period` (`1h`/`4h`/`1d`, default `1h`), `limit` *(optional, 500–1000)*.
55
80
 
56
81
  ### Authenticated tools (require `BUDA_API_KEY` + `BUDA_API_SECRET`)
57
82
 
58
83
  > **Important:** Authenticated instances must run locally only — never expose a server with API credentials publicly.
59
84
 
60
85
  ### `get_balances`
61
- All currency balances: total, available, frozen, and pending withdrawal amounts.
86
+ All currency balances as flat typed objects: total, available, frozen, and pending withdrawal amounts as floats with `_currency` suffix fields.
62
87
 
63
88
  ### `get_orders`
64
- Orders for a given market, filterable by state (`pending`, `active`, `traded`, `canceled`).
89
+ Orders for a given market as flat typed objects. All monetary amounts are floats with `_currency` fields. Filterable by state (`pending`, `active`, `traded`, `canceled`).
65
90
  **Parameters:** `market_id` *(required)*, `state` *(optional)*, `per` *(optional)*, `page` *(optional)*.
66
91
 
67
92
  ### `place_order`
@@ -72,6 +97,19 @@ Place a limit or market order. Requires `confirmation_token="CONFIRM"` to preven
72
97
  Cancel an open order by ID. Requires `confirmation_token="CONFIRM"`.
73
98
  **Parameters:** `order_id`, `confirmation_token`.
74
99
 
100
+ ### `schedule_cancel_all`
101
+ **WARNING: timer state is lost on server restart. Use only on locally-run instances.**
102
+ Arms an in-memory dead man's switch: if not renewed within `ttl_seconds`, all open orders for the market are automatically cancelled. Requires `confirmation_token="CONFIRM"`.
103
+ **Parameters:** `market_id`, `ttl_seconds` (10–300), `confirmation_token`.
104
+
105
+ ### `renew_cancel_timer`
106
+ Resets the dead man's switch TTL for a market. No confirmation required. Must have an active timer.
107
+ **Parameters:** `market_id`.
108
+
109
+ ### `disarm_cancel_timer`
110
+ Disarms the dead man's switch without cancelling any orders. Safe to call even with no active timer.
111
+ **Parameters:** `market_id`.
112
+
75
113
  ---
76
114
 
77
115
  ## MCP Resources
@@ -79,13 +117,16 @@ Cancel an open order by ID. Requires `confirmation_token="CONFIRM"`.
79
117
  | URI | Description |
80
118
  |-----|-------------|
81
119
  | `buda://markets` | JSON list of all Buda.com markets |
82
- | `buda://ticker/{market}` | JSON ticker for a specific market |
120
+ | `buda://ticker/{market}` | Raw ticker for a specific market |
121
+ | `buda://summary/{market}` | Full market summary with liquidity rating |
83
122
 
84
123
  ---
85
124
 
86
125
  ## Example prompts
87
126
 
127
+ - *"Give me a complete overview of the BTC-CLP market."*
88
128
  - *"What is the current Bitcoin price in Chilean pesos?"*
129
+ - *"Is there an arbitrage opportunity for BTC between Chile and Peru?"*
89
130
  - *"Show me the BTC-CLP order book — top 10 bids and asks."*
90
131
  - *"How much ETH was traded on Buda in the last 7 days?"*
91
132
  - *"List all markets available on Buda.com."*
@@ -94,6 +135,11 @@ Cancel an open order by ID. Requires `confirmation_token="CONFIRM"`.
94
135
  - *"Show me hourly BTC-CLP candles."*
95
136
  - *"What's my available BTC balance?"* *(authenticated)*
96
137
  - *"Show my open orders on BTC-CLP."* *(authenticated)*
138
+ - *"How much would it cost to buy 0.1 ETH on ETH-CLP right now?"*
139
+ - *"How many BTC can I buy with 1M CLP if I risk 2% with a stop at 78M?"*
140
+ - *"Is the BTC-CLP market bullish or bearish right now?"*
141
+ - *"Is BTC-CLP RSI overbought on the 4-hour chart?"*
142
+ - *"Arm a 60-second dead man's switch for my BTC-CLP orders."* *(authenticated)*
97
143
 
98
144
  ---
99
145
 
@@ -1,9 +1,9 @@
1
1
  {
2
- "_comment": "Gemini function declarations for buda-mcp v1.2.0. Pass this array as the `tools[0].functionDeclarations` field when calling the Gemini API. See: https://ai.google.dev/gemini-api/docs/function-calling",
2
+ "_comment": "Gemini function declarations for buda-mcp v1.4.0. Pass this array as the `tools[0].functionDeclarations` field when calling the Gemini API. See: https://ai.google.dev/gemini-api/docs/function-calling",
3
3
  "functionDeclarations": [
4
4
  {
5
5
  "name": "get_markets",
6
- "description": "List all available cryptocurrency trading pairs on Buda.com (Chile, Colombia, Peru), or get details for a specific market. Returns base/quote currencies, maker/taker fees, and minimum order sizes.",
6
+ "description": "Lists all available trading pairs on Buda.com, or returns details for a specific market (base/quote currencies, taker/maker fees as decimals, minimum order size in base currency, and fee discount tiers). Omit market_id to get all ~26 markets at once. Example: 'What is the taker fee and minimum order size for BTC-CLP?'",
7
7
  "parameters": {
8
8
  "type": "OBJECT",
9
9
  "properties": {
@@ -17,7 +17,7 @@
17
17
  },
18
18
  {
19
19
  "name": "get_ticker",
20
- "description": "Get the current market ticker for a Buda.com trading pair. Returns the last traded price, best bid (max_bid), best ask (min_ask), 24-hour volume, and price change percentage over 24 hours and 7 days.",
20
+ "description": "Returns the current market snapshot for a Buda.com market: last traded price, best bid, best ask, 24h volume, and price change over 24h and 7d. All prices are floats in the quote currency (e.g. CLP for BTC-CLP). price_variation_24h is a decimal fraction (0.012 = +1.2%). Example: 'What is the current Bitcoin price in Chilean pesos?'",
21
21
  "parameters": {
22
22
  "type": "OBJECT",
23
23
  "properties": {
@@ -31,7 +31,7 @@
31
31
  },
32
32
  {
33
33
  "name": "get_orderbook",
34
- "description": "Get the current limit order book for a Buda.com market. Returns sorted arrays of bids (buy orders) and asks (sell orders). Each entry is a [price, amount] pair. Useful for analyzing market depth and calculating slippage.",
34
+ "description": "Returns the current order book for a Buda.com market as typed objects with float price and amount fields. Bids are sorted highest-price first; asks lowest-price first. Prices are in the quote currency; amounts are in the base currency. Example: 'What are the top 5 buy and sell orders for BTC-CLP right now?'",
35
35
  "parameters": {
36
36
  "type": "OBJECT",
37
37
  "properties": {
@@ -49,7 +49,7 @@
49
49
  },
50
50
  {
51
51
  "name": "get_trades",
52
- "description": "Get recent trade history for a Buda.com market. Each trade entry contains [timestamp_ms, amount, price, direction] where direction is 'buy' or 'sell'. Supports pagination via the timestamp parameter.",
52
+ "description": "Returns recent trade history for a Buda.com market as typed objects. Each entry has timestamp_ms (integer), amount (float, base currency), price (float, quote currency), and direction ('buy' or 'sell'). Example: 'What was the last executed price for BTC-CLP and was it a buy or sell?'",
53
53
  "parameters": {
54
54
  "type": "OBJECT",
55
55
  "properties": {
@@ -71,7 +71,7 @@
71
71
  },
72
72
  {
73
73
  "name": "get_market_volume",
74
- "description": "Get 24-hour and 7-day transacted volume for a Buda.com market, broken down by side: ask_volume (sell orders) and bid_volume (buy orders). Amounts are in the market's base currency.",
74
+ "description": "Returns 24h and 7-day transacted volume for a Buda.com market, split by buy (bid) and sell (ask) side. All volume values are floats in the base currency (e.g. BTC for BTC-CLP). Example: 'How much Bitcoin was sold on BTC-CLP in the last 24 hours?'",
75
75
  "parameters": {
76
76
  "type": "OBJECT",
77
77
  "properties": {
@@ -85,7 +85,7 @@
85
85
  },
86
86
  {
87
87
  "name": "get_spread",
88
- "description": "Calculate the bid/ask spread for a Buda.com market. Returns the best bid price, best ask price, absolute spread, and spread as a percentage of the ask price. Useful for assessing market liquidity.",
88
+ "description": "Returns the best bid, best ask, absolute spread, and spread percentage for a Buda.com market. All prices are floats in the quote currency (e.g. CLP). spread_percentage is a float in percent (e.g. 0.15 means 0.15%). Use this to evaluate liquidity before placing a large order. Example: 'Is BTC-CLP liquid enough to buy 10M CLP without significant slippage?'",
89
89
  "parameters": {
90
90
  "type": "OBJECT",
91
91
  "properties": {
@@ -99,7 +99,7 @@
99
99
  },
100
100
  {
101
101
  "name": "compare_markets",
102
- "description": "Compare ticker data side-by-side for all trading pairs of a given base currency across Buda.com's supported quote currencies (CLP, COP, PEN, USDC, BTC, ETH). For example, 'BTC' returns data for BTC-CLP, BTC-COP, BTC-PEN, and BTC-USDC.",
102
+ "description": "Returns side-by-side ticker data for all trading pairs of a given base currency across Buda.com's supported quote currencies (CLP, COP, PEN, BTC, USDC, ETH). All prices are floats; price_change_24h and price_change_7d are floats in percent (e.g. 1.23 means +1.23%). Example: 'In which country is Bitcoin currently most expensive on Buda?'",
103
103
  "parameters": {
104
104
  "type": "OBJECT",
105
105
  "properties": {
@@ -113,7 +113,7 @@
113
113
  },
114
114
  {
115
115
  "name": "get_price_history",
116
- "description": "IMPORTANT: Candles are aggregated client-side from raw trades (Buda has no native candlestick endpoint) — increase 'limit' for deeper history. Returns OHLCV (open/high/low/close/volume) price history for a Buda.com market. Candle timestamps are UTC bucket boundaries. Supports 1h, 4h, and 1d candle periods.",
116
+ "description": "IMPORTANT: Candles are aggregated client-side from raw trades (Buda has no native candlestick endpoint) — fetching more trades via the 'limit' parameter gives deeper history but slower responses. Returns OHLCV candles (open/high/low/close as floats in quote currency; volume as float in base currency) for periods 1h, 4h, or 1d. Candle timestamps are UTC bucket boundaries. Example: 'Show me the hourly BTC-CLP price chart for the past 24 hours.'",
117
117
  "parameters": {
118
118
  "type": "OBJECT",
119
119
  "properties": {
@@ -132,6 +132,180 @@
132
132
  },
133
133
  "required": ["market_id"]
134
134
  }
135
+ },
136
+ {
137
+ "name": "get_market_summary",
138
+ "description": "One-call summary of everything relevant about a market: last price, best bid/ask, spread %, 24h volume, 24h and 7d price change, and a liquidity_rating ('high' / 'medium' / 'low' based on spread thresholds: < 0.3% = high, 0.3–1% = medium, > 1% = low). All prices and volumes are floats. Best first tool to call when a user asks about any specific market. Example: 'Give me a complete overview of the BTC-CLP market right now.'",
139
+ "parameters": {
140
+ "type": "OBJECT",
141
+ "properties": {
142
+ "market_id": {
143
+ "type": "STRING",
144
+ "description": "Market identifier such as 'BTC-CLP', 'ETH-COP', or 'BTC-PEN'. Case-insensitive."
145
+ }
146
+ },
147
+ "required": ["market_id"]
148
+ }
149
+ },
150
+ {
151
+ "name": "get_arbitrage_opportunities",
152
+ "description": "Detects cross-country price discrepancies for a given asset across Buda's CLP, COP, and PEN markets, normalized to USDC. Fetches all relevant tickers, converts each local price to USDC using the current USDC-CLP / USDC-COP / USDC-PEN rates, then computes pairwise discrepancy percentages. Results above threshold_pct are returned sorted by opportunity size. Note: Buda taker fee is 0.8% per leg (~1.6% round-trip) — always deduct fees before acting on any discrepancy. Example: 'Is there an arbitrage opportunity for BTC between Chile and Peru right now?'",
153
+ "parameters": {
154
+ "type": "OBJECT",
155
+ "properties": {
156
+ "base_currency": {
157
+ "type": "STRING",
158
+ "description": "Base asset to scan. Examples: 'BTC', 'ETH', 'XRP'. Case-insensitive."
159
+ },
160
+ "threshold_pct": {
161
+ "type": "NUMBER",
162
+ "description": "Minimum price discrepancy percentage to include in results (default: 0.5). Buda taker fee is 0.8% per leg, so a round-trip requires > 1.6% to be profitable."
163
+ }
164
+ },
165
+ "required": ["base_currency"]
166
+ }
167
+ },
168
+ {
169
+ "name": "simulate_order",
170
+ "description": "Simulates a buy or sell order on Buda.com using live ticker data — no order is placed. Returns estimated fill price, fee, total cost, and slippage vs mid-price. Omit 'price' for a market order simulation; supply 'price' for a limit order simulation. All outputs are labelled simulation: true. Example: 'How much would it cost to buy 0.01 BTC on BTC-CLP right now?'",
171
+ "parameters": {
172
+ "type": "OBJECT",
173
+ "properties": {
174
+ "market_id": {
175
+ "type": "STRING",
176
+ "description": "Market identifier such as 'BTC-CLP' or 'ETH-BTC'. Case-insensitive."
177
+ },
178
+ "side": {
179
+ "type": "STRING",
180
+ "description": "'buy' or 'sell'."
181
+ },
182
+ "amount": {
183
+ "type": "NUMBER",
184
+ "description": "Order size in base currency (e.g. BTC for BTC-CLP)."
185
+ },
186
+ "price": {
187
+ "type": "NUMBER",
188
+ "description": "Limit price in quote currency. Omit for a market order simulation."
189
+ }
190
+ },
191
+ "required": ["market_id", "side", "amount"]
192
+ }
193
+ },
194
+ {
195
+ "name": "calculate_position_size",
196
+ "description": "Calculates position size based on capital, risk tolerance, entry price, and stop-loss. Determines units so that a stop-loss hit costs exactly risk_pct% of capital. Fully client-side — no API call. Example: 'How many BTC can I buy with 1M CLP at 2% risk, entry 80M, stop 78M?'",
197
+ "parameters": {
198
+ "type": "OBJECT",
199
+ "properties": {
200
+ "market_id": {
201
+ "type": "STRING",
202
+ "description": "Market identifier (e.g. 'BTC-CLP'). Used to derive the quote currency."
203
+ },
204
+ "capital": {
205
+ "type": "NUMBER",
206
+ "description": "Total available capital in the quote currency."
207
+ },
208
+ "risk_pct": {
209
+ "type": "NUMBER",
210
+ "description": "Percentage of capital to risk on this trade (0.1–10)."
211
+ },
212
+ "entry_price": {
213
+ "type": "NUMBER",
214
+ "description": "Planned entry price in quote currency."
215
+ },
216
+ "stop_loss_price": {
217
+ "type": "NUMBER",
218
+ "description": "Stop-loss price in quote currency. Must be below entry for buys, above for sells."
219
+ }
220
+ },
221
+ "required": ["market_id", "capital", "risk_pct", "entry_price", "stop_loss_price"]
222
+ }
223
+ },
224
+ {
225
+ "name": "get_market_sentiment",
226
+ "description": "Computes a composite sentiment score (−100 to +100) for a Buda.com market based on 24h price variation (40%), volume vs 7-day average (35%), and bid/ask spread vs baseline (25%). Returns score, label (bearish/neutral/bullish), and full component breakdown. Example: 'Is the BTC-CLP market currently bullish or bearish?'",
227
+ "parameters": {
228
+ "type": "OBJECT",
229
+ "properties": {
230
+ "market_id": {
231
+ "type": "STRING",
232
+ "description": "Market identifier such as 'BTC-CLP', 'ETH-BTC', or 'BTC-USDT'. Case-insensitive."
233
+ }
234
+ },
235
+ "required": ["market_id"]
236
+ }
237
+ },
238
+ {
239
+ "name": "get_technical_indicators",
240
+ "description": "Computes RSI (14), MACD (12/26/9), Bollinger Bands (20, 2σ), SMA 20, and SMA 50 from Buda trade history. No external libraries. Returns latest indicator values and signal interpretations. Returns a structured warning if fewer than 50 candles are available. Example: 'Is BTC-CLP RSI overbought on the 4-hour chart?'",
241
+ "parameters": {
242
+ "type": "OBJECT",
243
+ "properties": {
244
+ "market_id": {
245
+ "type": "STRING",
246
+ "description": "Market identifier such as 'BTC-CLP' or 'ETH-BTC'. Case-insensitive."
247
+ },
248
+ "period": {
249
+ "type": "STRING",
250
+ "description": "Candle period: '1h', '4h', or '1d'. Default is '1h'."
251
+ },
252
+ "limit": {
253
+ "type": "INTEGER",
254
+ "description": "Number of raw trades to fetch (500–1000). Default is 500."
255
+ }
256
+ },
257
+ "required": ["market_id"]
258
+ }
259
+ },
260
+ {
261
+ "name": "schedule_cancel_all",
262
+ "description": "WARNING: timer state is lost on server restart. Use only on locally-run instances. Arms an in-memory dead man's switch: if not renewed within ttl_seconds, all open orders for the market are automatically cancelled. Requires confirmation_token='CONFIRM'. Auth-gated.",
263
+ "parameters": {
264
+ "type": "OBJECT",
265
+ "properties": {
266
+ "market_id": {
267
+ "type": "STRING",
268
+ "description": "Market ID to protect (e.g. 'BTC-CLP')."
269
+ },
270
+ "ttl_seconds": {
271
+ "type": "INTEGER",
272
+ "description": "Seconds before all orders are cancelled if not renewed (10–300)."
273
+ },
274
+ "confirmation_token": {
275
+ "type": "STRING",
276
+ "description": "Must equal exactly 'CONFIRM' (case-sensitive) to arm the switch."
277
+ }
278
+ },
279
+ "required": ["market_id", "ttl_seconds", "confirmation_token"]
280
+ }
281
+ },
282
+ {
283
+ "name": "renew_cancel_timer",
284
+ "description": "Resets the dead man's switch TTL for a market, preventing automatic order cancellation. No confirmation required. Requires an active timer set by schedule_cancel_all. Auth-gated.",
285
+ "parameters": {
286
+ "type": "OBJECT",
287
+ "properties": {
288
+ "market_id": {
289
+ "type": "STRING",
290
+ "description": "Market ID whose timer should be renewed (e.g. 'BTC-CLP')."
291
+ }
292
+ },
293
+ "required": ["market_id"]
294
+ }
295
+ },
296
+ {
297
+ "name": "disarm_cancel_timer",
298
+ "description": "Disarms the dead man's switch for a market without cancelling any orders. No confirmation required. Safe to call even if no timer is active. Auth-gated.",
299
+ "parameters": {
300
+ "type": "OBJECT",
301
+ "properties": {
302
+ "market_id": {
303
+ "type": "STRING",
304
+ "description": "Market ID whose timer should be disarmed (e.g. 'BTC-CLP')."
305
+ }
306
+ },
307
+ "required": ["market_id"]
308
+ }
135
309
  }
136
310
  ]
137
311
  }