clodds 1.2.9 → 1.3.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/dist/skills/bundled/acp/SKILL.md +188 -0
- package/dist/skills/bundled/acp/index.d.ts +0 -3
- package/dist/skills/bundled/acp/index.js +1 -1
- package/dist/skills/bundled/acp/index.js.map +1 -1
- package/dist/skills/bundled/agentbets/SKILL.md +19 -0
- package/dist/skills/bundled/ai-strategy/SKILL.md +111 -0
- package/dist/skills/bundled/ai-strategy/index.js +1 -1
- package/dist/skills/bundled/ai-strategy/index.js.map +1 -1
- package/dist/skills/bundled/alerts/SKILL.md +87 -0
- package/dist/skills/bundled/analytics/SKILL.md +252 -0
- package/dist/skills/bundled/analytics/index.js +2 -2
- package/dist/skills/bundled/analytics/index.js.map +1 -1
- package/dist/skills/bundled/arbitrage/SKILL.md +287 -0
- package/dist/skills/bundled/auto-reply/SKILL.md +285 -0
- package/dist/skills/bundled/auto-reply/index.js +2 -2
- package/dist/skills/bundled/auto-reply/index.js.map +1 -1
- package/dist/skills/bundled/automation/SKILL.md +242 -0
- package/dist/skills/bundled/automation/index.js +2 -2
- package/dist/skills/bundled/automation/index.js.map +1 -1
- package/dist/skills/bundled/backtest/SKILL.md +225 -0
- package/dist/skills/bundled/bags/SKILL.md +131 -0
- package/dist/skills/bundled/bankr/SKILL.md +114 -0
- package/dist/skills/bundled/betfair/SKILL.md +113 -0
- package/dist/skills/bundled/binance-futures/SKILL.md +84 -0
- package/dist/skills/bundled/binance-futures/index.d.ts +0 -3
- package/dist/skills/bundled/binance-futures/index.js +1 -2
- package/dist/skills/bundled/binance-futures/index.js.map +1 -1
- package/dist/skills/bundled/botchan/SKILL.md +66 -0
- package/dist/skills/bundled/botchan/index.d.ts +0 -3
- package/dist/skills/bundled/botchan/index.js +0 -1
- package/dist/skills/bundled/botchan/index.js.map +1 -1
- package/dist/skills/bundled/bridge/SKILL.md +215 -0
- package/dist/skills/bundled/bybit-futures/SKILL.md +84 -0
- package/dist/skills/bundled/bybit-futures/index.d.ts +0 -3
- package/dist/skills/bundled/bybit-futures/index.js +0 -1
- package/dist/skills/bundled/bybit-futures/index.js.map +1 -1
- package/dist/skills/bundled/clanker/SKILL.md +125 -0
- package/dist/skills/bundled/clanker/index.d.ts +0 -3
- package/dist/skills/bundled/clanker/index.js +0 -1
- package/dist/skills/bundled/clanker/index.js.map +1 -1
- package/dist/skills/bundled/copy-trading/SKILL.md +285 -0
- package/dist/skills/bundled/copy-trading/index.js +2 -2
- package/dist/skills/bundled/copy-trading/index.js.map +1 -1
- package/dist/skills/bundled/copy-trading-solana/SKILL.md +66 -0
- package/dist/skills/bundled/credentials/SKILL.md +261 -0
- package/dist/skills/bundled/crypto-hft/SKILL.md +121 -0
- package/dist/skills/bundled/dca/SKILL.md +27 -0
- package/dist/skills/bundled/dex/SKILL.md +87 -0
- package/dist/skills/bundled/divergence/SKILL.md +83 -0
- package/dist/skills/bundled/doctor/SKILL.md +267 -0
- package/dist/skills/bundled/doctor/index.js +2 -8
- package/dist/skills/bundled/doctor/index.js.map +1 -1
- package/dist/skills/bundled/drift/SKILL.md +53 -0
- package/dist/skills/bundled/drift-sdk/SKILL.md +103 -0
- package/dist/skills/bundled/drift-sdk/index.d.ts +0 -3
- package/dist/skills/bundled/drift-sdk/index.js +0 -1
- package/dist/skills/bundled/drift-sdk/index.js.map +1 -1
- package/dist/skills/bundled/edge/SKILL.md +84 -0
- package/dist/skills/bundled/embeddings/SKILL.md +244 -0
- package/dist/skills/bundled/endaoment/SKILL.md +65 -0
- package/dist/skills/bundled/endaoment/index.d.ts +0 -3
- package/dist/skills/bundled/endaoment/index.js +0 -1
- package/dist/skills/bundled/endaoment/index.js.map +1 -1
- package/dist/skills/bundled/ens/SKILL.md +63 -0
- package/dist/skills/bundled/ens/index.d.ts +0 -3
- package/dist/skills/bundled/ens/index.js +0 -1
- package/dist/skills/bundled/ens/index.js.map +1 -1
- package/dist/skills/bundled/erc8004/SKILL.md +79 -0
- package/dist/skills/bundled/erc8004/index.d.ts +0 -3
- package/dist/skills/bundled/erc8004/index.js +0 -1
- package/dist/skills/bundled/erc8004/index.js.map +1 -1
- package/dist/skills/bundled/execution/SKILL.md +278 -0
- package/dist/skills/bundled/farcaster/SKILL.md +80 -0
- package/dist/skills/bundled/features/SKILL.md +20 -0
- package/dist/skills/bundled/feeds/SKILL.md +288 -0
- package/dist/skills/bundled/harden/SKILL.md +74 -0
- package/dist/skills/bundled/history/SKILL.md +257 -0
- package/dist/skills/bundled/hyperliquid/SKILL.md +200 -0
- package/dist/skills/bundled/hyperliquid/index.d.ts +0 -3
- package/dist/skills/bundled/hyperliquid/index.js +0 -1
- package/dist/skills/bundled/hyperliquid/index.js.map +1 -1
- package/dist/skills/bundled/identity/SKILL.md +228 -0
- package/dist/skills/bundled/identity/index.js +2 -2
- package/dist/skills/bundled/identity/index.js.map +1 -1
- package/dist/skills/bundled/integrations/SKILL.md +321 -0
- package/dist/skills/bundled/integrations/index.js +2 -2
- package/dist/skills/bundled/integrations/index.js.map +1 -1
- package/dist/skills/bundled/jupiter/SKILL.md +163 -0
- package/dist/skills/bundled/kamino/SKILL.md +69 -0
- package/dist/skills/bundled/ledger/SKILL.md +20 -0
- package/dist/skills/bundled/lighter/SKILL.md +83 -0
- package/dist/skills/bundled/lighter/index.d.ts +0 -3
- package/dist/skills/bundled/lighter/index.js +0 -1
- package/dist/skills/bundled/lighter/index.js.map +1 -1
- package/dist/skills/bundled/marginfi/SKILL.md +62 -0
- package/dist/skills/bundled/market-index/SKILL.md +242 -0
- package/dist/skills/bundled/market-index/index.js +1 -3
- package/dist/skills/bundled/market-index/index.js.map +1 -1
- package/dist/skills/bundled/markets/SKILL.md +49 -0
- package/dist/skills/bundled/mcp/SKILL.md +235 -0
- package/dist/skills/bundled/mcp/index.js +1 -3
- package/dist/skills/bundled/mcp/index.js.map +1 -1
- package/dist/skills/bundled/memory/SKILL.md +209 -0
- package/dist/skills/bundled/metaculus/SKILL.md +62 -0
- package/dist/skills/bundled/meteora/SKILL.md +28 -0
- package/dist/skills/bundled/meteora-dbc/SKILL.md +25 -0
- package/dist/skills/bundled/metrics/SKILL.md +338 -0
- package/dist/skills/bundled/mev/SKILL.md +239 -0
- package/dist/skills/bundled/mev/index.js +2 -2
- package/dist/skills/bundled/mev/index.js.map +1 -1
- package/dist/skills/bundled/mexc-futures/SKILL.md +86 -0
- package/dist/skills/bundled/mexc-futures/index.d.ts +0 -3
- package/dist/skills/bundled/mexc-futures/index.js +0 -1
- package/dist/skills/bundled/mexc-futures/index.js.map +1 -1
- package/dist/skills/bundled/mm/SKILL.md +142 -0
- package/dist/skills/bundled/monitoring/SKILL.md +249 -0
- package/dist/skills/bundled/news/SKILL.md +95 -0
- package/dist/skills/bundled/onchainkit/SKILL.md +83 -0
- package/dist/skills/bundled/opinion/SKILL.md +87 -0
- package/dist/skills/bundled/opportunity/SKILL.md +308 -0
- package/dist/skills/bundled/orca/SKILL.md +28 -0
- package/dist/skills/bundled/pairing/SKILL.md +275 -0
- package/dist/skills/bundled/pancakeswap/SKILL.md +93 -0
- package/dist/skills/bundled/pancakeswap/index.d.ts +0 -3
- package/dist/skills/bundled/pancakeswap/index.js +0 -1
- package/dist/skills/bundled/pancakeswap/index.js.map +1 -1
- package/dist/skills/bundled/percolator/SKILL.md +22 -0
- package/dist/skills/bundled/permissions/SKILL.md +269 -0
- package/dist/skills/bundled/permissions/index.js +2 -2
- package/dist/skills/bundled/permissions/index.js.map +1 -1
- package/dist/skills/bundled/plugins/SKILL.md +263 -0
- package/dist/skills/bundled/plugins/index.js +2 -2
- package/dist/skills/bundled/plugins/index.js.map +1 -1
- package/dist/skills/bundled/portfolio/SKILL.md +161 -0
- package/dist/skills/bundled/portfolio/index.js +1 -1
- package/dist/skills/bundled/portfolio/index.js.map +1 -1
- package/dist/skills/bundled/portfolio-sync/SKILL.md +466 -0
- package/dist/skills/bundled/positions/SKILL.md +262 -0
- package/dist/skills/bundled/predictfun/SKILL.md +109 -0
- package/dist/skills/bundled/predictfun/index.js +1 -1
- package/dist/skills/bundled/predictfun/index.js.map +1 -1
- package/dist/skills/bundled/predictit/SKILL.md +66 -0
- package/dist/skills/bundled/presence/SKILL.md +217 -0
- package/dist/skills/bundled/presence/index.js +2 -2
- package/dist/skills/bundled/presence/index.js.map +1 -1
- package/dist/skills/bundled/processes/SKILL.md +254 -0
- package/dist/skills/bundled/pump-swarm/SKILL.md +309 -0
- package/dist/skills/bundled/pumpfun/SKILL.md +145 -0
- package/dist/skills/bundled/qmd/SKILL.md +129 -0
- package/dist/skills/bundled/qrcoin/SKILL.md +60 -0
- package/dist/skills/bundled/qrcoin/index.d.ts +0 -3
- package/dist/skills/bundled/qrcoin/index.js +0 -1
- package/dist/skills/bundled/qrcoin/index.js.map +1 -1
- package/dist/skills/bundled/raydium/SKILL.md +198 -0
- package/dist/skills/bundled/remote/SKILL.md +201 -0
- package/dist/skills/bundled/research/SKILL.md +83 -0
- package/dist/skills/bundled/research/index.js +2 -2
- package/dist/skills/bundled/research/index.js.map +1 -1
- package/dist/skills/bundled/risk/SKILL.md +323 -0
- package/dist/skills/bundled/router/SKILL.md +233 -0
- package/dist/skills/bundled/routing/SKILL.md +258 -0
- package/dist/skills/bundled/sandbox/SKILL.md +257 -0
- package/dist/skills/bundled/search-config/SKILL.md +257 -0
- package/dist/skills/bundled/search-config/index.js +2 -2
- package/dist/skills/bundled/search-config/index.js.map +1 -1
- package/dist/skills/bundled/sessions/SKILL.md +251 -0
- package/dist/skills/bundled/sessions/index.js +1 -1
- package/dist/skills/bundled/sessions/index.js.map +1 -1
- package/dist/skills/bundled/setup/SKILL.md +53 -0
- package/dist/skills/bundled/shield/SKILL.md +21 -0
- package/dist/skills/bundled/signals/SKILL.md +106 -0
- package/dist/skills/bundled/signals/index.d.ts +0 -3
- package/dist/skills/bundled/signals/index.js +3 -4
- package/dist/skills/bundled/signals/index.js.map +1 -1
- package/dist/skills/bundled/sizing/SKILL.md +238 -0
- package/dist/skills/bundled/slippage/SKILL.md +306 -0
- package/dist/skills/bundled/smarkets/SKILL.md +107 -0
- package/dist/skills/bundled/solend/SKILL.md +63 -0
- package/dist/skills/bundled/strategy/SKILL.md +266 -0
- package/dist/skills/bundled/streaming/SKILL.md +150 -0
- package/dist/skills/bundled/streaming/index.js +2 -2
- package/dist/skills/bundled/streaming/index.js.map +1 -1
- package/dist/skills/bundled/tailscale/SKILL.md +249 -0
- package/dist/skills/bundled/tailscale/index.js +2 -2
- package/dist/skills/bundled/tailscale/index.js.map +1 -1
- package/dist/skills/bundled/ticks/SKILL.md +61 -0
- package/dist/skills/bundled/token-security/SKILL.md +18 -0
- package/dist/skills/bundled/trading-evm/SKILL.md +329 -0
- package/dist/skills/bundled/trading-futures/SKILL.md +865 -0
- package/dist/skills/bundled/trading-kalshi/SKILL.md +629 -0
- package/dist/skills/bundled/trading-manifold/SKILL.md +387 -0
- package/dist/skills/bundled/trading-polymarket/SKILL.md +1080 -0
- package/dist/skills/bundled/trading-solana/SKILL.md +418 -0
- package/dist/skills/bundled/trading-system/SKILL.md +290 -0
- package/dist/skills/bundled/triggers/SKILL.md +433 -0
- package/dist/skills/bundled/tts/SKILL.md +220 -0
- package/dist/skills/bundled/tweet-ideas/SKILL.md +77 -0
- package/dist/skills/bundled/usage/SKILL.md +239 -0
- package/dist/skills/bundled/usage/index.js +2 -2
- package/dist/skills/bundled/usage/index.js.map +1 -1
- package/dist/skills/bundled/veil/SKILL.md +76 -0
- package/dist/skills/bundled/veil/index.d.ts +0 -3
- package/dist/skills/bundled/veil/index.js +0 -1
- package/dist/skills/bundled/veil/index.js.map +1 -1
- package/dist/skills/bundled/verify/SKILL.md +199 -0
- package/dist/skills/bundled/verify/index.d.ts +0 -3
- package/dist/skills/bundled/verify/index.js +0 -1
- package/dist/skills/bundled/verify/index.js.map +1 -1
- package/dist/skills/bundled/virtuals/SKILL.md +82 -0
- package/dist/skills/bundled/voice/SKILL.md +217 -0
- package/dist/skills/bundled/voice/index.js +2 -2
- package/dist/skills/bundled/voice/index.js.map +1 -1
- package/dist/skills/bundled/weather/SKILL.md +80 -0
- package/dist/skills/bundled/webhooks/SKILL.md +297 -0
- package/dist/skills/bundled/webhooks/index.js +2 -2
- package/dist/skills/bundled/webhooks/index.js.map +1 -1
- package/dist/skills/bundled/whale-tracking/SKILL.md +287 -0
- package/dist/skills/bundled/whale-tracking/index.js +2 -2
- package/dist/skills/bundled/whale-tracking/index.js.map +1 -1
- package/dist/skills/bundled/yoink/SKILL.md +54 -0
- package/dist/skills/bundled/yoink/index.d.ts +0 -3
- package/dist/skills/bundled/yoink/index.js +0 -1
- package/dist/skills/bundled/yoink/index.js.map +1 -1
- package/dist/skills/executor.js +5 -3
- package/dist/skills/executor.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: execution
|
|
3
|
+
description: "Execute trades on prediction markets with slippage protection and order management"
|
|
4
|
+
emoji: "⚡"
|
|
5
|
+
gates:
|
|
6
|
+
envs:
|
|
7
|
+
anyOf:
|
|
8
|
+
- POLY_API_KEY
|
|
9
|
+
- KALSHI_API_KEY
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Execution Service - Complete API Reference
|
|
13
|
+
|
|
14
|
+
Execute trades on Polymarket and Kalshi with slippage protection, maker orders, and order management.
|
|
15
|
+
|
|
16
|
+
## Supported Platforms
|
|
17
|
+
|
|
18
|
+
| Platform | Order Types | Features |
|
|
19
|
+
|----------|-------------|----------|
|
|
20
|
+
| Polymarket | Limit, Market, Maker | -0.5% maker rebate, GTC/FOK |
|
|
21
|
+
| Kalshi | Limit, Market | US regulated |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Chat Commands
|
|
26
|
+
|
|
27
|
+
### Place Orders
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
/execute buy poly <market> YES 100 @ 0.52 # Limit buy on Polymarket
|
|
31
|
+
/execute sell kalshi <market> NO 50 @ 0.48 # Limit sell on Kalshi
|
|
32
|
+
/execute market-buy poly <market> YES 100 # Market buy
|
|
33
|
+
/execute market-sell poly <market> NO 50 # Market sell
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Maker Orders (Rebates)
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
/execute maker-buy poly <market> YES 100 @ 0.52 # Post-only buy
|
|
40
|
+
/execute maker-sell poly <market> NO 50 @ 0.48 # Post-only sell
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Protected Orders (Slippage Protection)
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
/execute protected-buy poly <market> YES 100 --max-slippage 1%
|
|
47
|
+
/execute protected-sell poly <market> NO 50 --max-slippage 0.5%
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Order Management
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
/orders open # View open orders
|
|
54
|
+
/orders open poly # Open orders on Polymarket
|
|
55
|
+
/orders cancel <order-id> # Cancel specific order
|
|
56
|
+
/orders cancel-all # Cancel all open orders
|
|
57
|
+
/orders cancel-all poly # Cancel all on Polymarket
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Slippage Estimation
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
/estimate-slippage poly <market> buy 1000 # Estimate slippage for $1000 buy
|
|
64
|
+
/estimate-slippage kalshi <market> sell 500 # Estimate for $500 sell
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## TypeScript API Reference
|
|
70
|
+
|
|
71
|
+
### Create Execution Service
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { createExecutionService } from 'clodds/execution';
|
|
75
|
+
|
|
76
|
+
const executor = createExecutionService({
|
|
77
|
+
polymarket: {
|
|
78
|
+
apiKey: process.env.POLY_API_KEY,
|
|
79
|
+
apiSecret: process.env.POLY_API_SECRET,
|
|
80
|
+
passphrase: process.env.POLY_API_PASSPHRASE,
|
|
81
|
+
privateKey: process.env.PRIVATE_KEY,
|
|
82
|
+
},
|
|
83
|
+
kalshi: {
|
|
84
|
+
apiKey: process.env.KALSHI_API_KEY,
|
|
85
|
+
privateKey: process.env.KALSHI_PRIVATE_KEY,
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
// Defaults
|
|
89
|
+
defaultSlippageTolerance: 0.5, // 0.5%
|
|
90
|
+
autoLogTrades: true,
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Limit Orders
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// Buy limit order
|
|
98
|
+
const order = await executor.buyLimit({
|
|
99
|
+
platform: 'polymarket',
|
|
100
|
+
marketId: 'market-123',
|
|
101
|
+
side: 'YES',
|
|
102
|
+
size: 100, // $100
|
|
103
|
+
price: 0.52, // 52 cents
|
|
104
|
+
timeInForce: 'GTC', // Good-til-cancel
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
console.log(`Order placed: ${order.orderId}`);
|
|
108
|
+
console.log(`Status: ${order.status}`);
|
|
109
|
+
|
|
110
|
+
// Sell limit order
|
|
111
|
+
const sellOrder = await executor.sellLimit({
|
|
112
|
+
platform: 'polymarket',
|
|
113
|
+
marketId: 'market-123',
|
|
114
|
+
side: 'YES',
|
|
115
|
+
size: 100,
|
|
116
|
+
price: 0.55,
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Market Orders
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
// Market buy - executes immediately at best price
|
|
124
|
+
const order = await executor.marketBuy({
|
|
125
|
+
platform: 'polymarket',
|
|
126
|
+
marketId: 'market-123',
|
|
127
|
+
side: 'YES',
|
|
128
|
+
size: 100,
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
console.log(`Filled at: ${order.avgFillPrice}`);
|
|
132
|
+
console.log(`Filled size: ${order.filledSize}`);
|
|
133
|
+
|
|
134
|
+
// Market sell
|
|
135
|
+
const sellOrder = await executor.marketSell({
|
|
136
|
+
platform: 'kalshi',
|
|
137
|
+
marketId: 'TRUMP-WIN',
|
|
138
|
+
side: 'YES',
|
|
139
|
+
size: 50,
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Maker Orders (Post-Only)
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
// Maker buy - only executes as maker (gets rebate)
|
|
147
|
+
const order = await executor.makerBuy({
|
|
148
|
+
platform: 'polymarket',
|
|
149
|
+
marketId: 'market-123',
|
|
150
|
+
side: 'YES',
|
|
151
|
+
size: 100,
|
|
152
|
+
price: 0.52,
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// Will be rejected if it would execute immediately as taker
|
|
156
|
+
if (order.status === 'rejected') {
|
|
157
|
+
console.log('Price too aggressive - would be taker');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Maker sell
|
|
161
|
+
const sellOrder = await executor.makerSell({
|
|
162
|
+
platform: 'polymarket',
|
|
163
|
+
marketId: 'market-123',
|
|
164
|
+
side: 'NO',
|
|
165
|
+
size: 50,
|
|
166
|
+
price: 0.48,
|
|
167
|
+
});
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Protected Orders (Slippage Protection)
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
// Protected buy - checks slippage before executing
|
|
174
|
+
const order = await executor.protectedBuy({
|
|
175
|
+
platform: 'polymarket',
|
|
176
|
+
marketId: 'market-123',
|
|
177
|
+
side: 'YES',
|
|
178
|
+
size: 100,
|
|
179
|
+
maxSlippage: 0.5, // 0.5% max slippage
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
if (order.status === 'rejected') {
|
|
183
|
+
console.log(`Rejected: slippage would be ${order.estimatedSlippage}%`);
|
|
184
|
+
} else {
|
|
185
|
+
console.log(`Executed with ${order.actualSlippage}% slippage`);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Protected sell
|
|
189
|
+
const sellOrder = await executor.protectedSell({
|
|
190
|
+
platform: 'kalshi',
|
|
191
|
+
marketId: 'TRUMP-WIN',
|
|
192
|
+
side: 'YES',
|
|
193
|
+
size: 50,
|
|
194
|
+
maxSlippage: 1,
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Order Management
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
// Cancel specific order
|
|
202
|
+
await executor.cancelOrder('polymarket', orderId);
|
|
203
|
+
|
|
204
|
+
// Cancel all orders on platform
|
|
205
|
+
await executor.cancelAllOrders('polymarket');
|
|
206
|
+
|
|
207
|
+
// Cancel all orders for a market
|
|
208
|
+
await executor.cancelAllOrders('polymarket', { marketId: 'market-123' });
|
|
209
|
+
|
|
210
|
+
// Get open orders
|
|
211
|
+
const openOrders = await executor.getOpenOrders('polymarket');
|
|
212
|
+
|
|
213
|
+
for (const order of openOrders) {
|
|
214
|
+
console.log(`${order.orderId}: ${order.side} ${order.size} @ ${order.price}`);
|
|
215
|
+
console.log(` Status: ${order.status}`);
|
|
216
|
+
console.log(` Filled: ${order.filledSize}/${order.size}`);
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Slippage Estimation
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
// Estimate slippage before executing
|
|
224
|
+
const estimate = await executor.estimateSlippage({
|
|
225
|
+
platform: 'polymarket',
|
|
226
|
+
marketId: 'market-123',
|
|
227
|
+
side: 'buy',
|
|
228
|
+
size: 1000,
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
console.log(`For $1000 buy:`);
|
|
232
|
+
console.log(` Avg fill price: ${estimate.avgFillPrice}`);
|
|
233
|
+
console.log(` Expected slippage: ${estimate.slippagePct}%`);
|
|
234
|
+
console.log(` Total filled: ${estimate.totalFilled}`);
|
|
235
|
+
console.log(` Levels consumed: ${estimate.levelsConsumed}`);
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Order Types
|
|
241
|
+
|
|
242
|
+
| Type | Description | Best For |
|
|
243
|
+
|------|-------------|----------|
|
|
244
|
+
| **Limit** | Execute at specific price or better | Price-sensitive orders |
|
|
245
|
+
| **Market** | Execute immediately at best available | Urgent execution |
|
|
246
|
+
| **Maker** | Post-only, gets rebate | Collecting rebates |
|
|
247
|
+
| **Protected** | Checks slippage before executing | Large orders |
|
|
248
|
+
|
|
249
|
+
## Time In Force
|
|
250
|
+
|
|
251
|
+
| Value | Description |
|
|
252
|
+
|-------|-------------|
|
|
253
|
+
| **GTC** | Good-til-cancel (default) |
|
|
254
|
+
| **FOK** | Fill-or-kill - all or nothing |
|
|
255
|
+
| **IOC** | Immediate-or-cancel - fill what you can |
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Fee Structure
|
|
260
|
+
|
|
261
|
+
### Polymarket (Verified Jan 2026)
|
|
262
|
+
- **Most markets**: 0% maker, 0% taker (zero fees)
|
|
263
|
+
- **15-min crypto markets**: Dynamic taker fees up to ~3% at 50/50 odds; makers eligible for rebate program
|
|
264
|
+
|
|
265
|
+
### Kalshi
|
|
266
|
+
- **Taker**: Formula-based ~1.2% average, capped at ~2%
|
|
267
|
+
- **Maker**: ~0.17% (formula-based)
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Best Practices
|
|
272
|
+
|
|
273
|
+
1. **Use maker orders** when possible - Pay no fees on Polymarket (most markets)
|
|
274
|
+
2. **Check slippage** before large orders
|
|
275
|
+
3. **Use protected orders** for size > $500
|
|
276
|
+
4. **Set appropriate timeInForce** - GTC for patient orders, FOK for all-or-nothing
|
|
277
|
+
5. **Monitor open orders** - Cancel stale orders
|
|
278
|
+
6. **Start small** - Test with small sizes first
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: farcaster
|
|
3
|
+
description: "Farcaster social protocol via Neynar API - read feeds, post casts, follow users"
|
|
4
|
+
command: fc
|
|
5
|
+
emoji: "🟪"
|
|
6
|
+
gates:
|
|
7
|
+
envs:
|
|
8
|
+
- NEYNAR_API_KEY
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Farcaster
|
|
12
|
+
|
|
13
|
+
Interact with the Farcaster decentralized social protocol via Neynar API.
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
Get your API key from [dev.neynar.com](https://dev.neynar.com):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
export NEYNAR_API_KEY=xxx
|
|
21
|
+
|
|
22
|
+
# Optional: For posting (requires signer)
|
|
23
|
+
export NEYNAR_SIGNER_UUID=xxx
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Commands
|
|
27
|
+
|
|
28
|
+
### Users
|
|
29
|
+
```
|
|
30
|
+
/fc user <username> Look up user profile
|
|
31
|
+
/fc search-users <query> Search for users
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Feeds
|
|
35
|
+
```
|
|
36
|
+
/fc feed [--channel X] Get feed (optionally from channel)
|
|
37
|
+
/fc trending Trending casts
|
|
38
|
+
/fc channel <id> Get channel info
|
|
39
|
+
/fc channels <query> Search channels
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Search
|
|
43
|
+
```
|
|
44
|
+
/fc search <query> Search casts
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Write Operations (require signer)
|
|
48
|
+
```
|
|
49
|
+
/fc post <text> Post a cast
|
|
50
|
+
/fc reply <hash> <text> Reply to a cast
|
|
51
|
+
/fc like <hash> Like a cast
|
|
52
|
+
/fc recast <hash> Recast
|
|
53
|
+
/fc follow <username> Follow user
|
|
54
|
+
/fc unfollow <username> Unfollow user
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Examples
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
/fc user vitalik.eth
|
|
61
|
+
/fc trending
|
|
62
|
+
/fc channel base
|
|
63
|
+
/fc search "ethereum"
|
|
64
|
+
/fc post "Hello Farcaster!"
|
|
65
|
+
/fc follow dwr.eth
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Rate Limits
|
|
69
|
+
|
|
70
|
+
- Free tier: 300 requests/minute
|
|
71
|
+
- Standard: 1,000 requests/minute
|
|
72
|
+
- Premium: Higher limits
|
|
73
|
+
|
|
74
|
+
## Features
|
|
75
|
+
|
|
76
|
+
- User profiles with verified addresses
|
|
77
|
+
- Cast search and feeds
|
|
78
|
+
- Channel discovery
|
|
79
|
+
- Trending content
|
|
80
|
+
- Full write operations (with signer)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: features
|
|
3
|
+
description: "Real-time market features and trading signals"
|
|
4
|
+
command: features
|
|
5
|
+
emoji: "📈"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Features
|
|
9
|
+
|
|
10
|
+
View real-time market features and trading signals computed from tick and orderbook data.
|
|
11
|
+
|
|
12
|
+
## Commands
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
/features get <platform> <marketId> Get features for a specific market
|
|
16
|
+
/features all List all tracked markets
|
|
17
|
+
/features signals <platform> <marketId> Get trading signals and recommendations
|
|
18
|
+
/features stats Show feature engine statistics
|
|
19
|
+
/features help Show help
|
|
20
|
+
```
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: feeds
|
|
3
|
+
description: "Real-time market data feeds from 8 prediction market platforms"
|
|
4
|
+
emoji: "📡"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Market Feeds - Complete API Reference
|
|
8
|
+
|
|
9
|
+
Real-time and historical market data from Polymarket, Kalshi, Manifold, Metaculus, PredictIt, Drift, Betfair, and Smarkets.
|
|
10
|
+
|
|
11
|
+
## Supported Platforms
|
|
12
|
+
|
|
13
|
+
| Platform | Feed Type | Trading | Data |
|
|
14
|
+
|----------|-----------|---------|------|
|
|
15
|
+
| Polymarket | WebSocket + RTDS | Yes | Prices, orderbook, trades |
|
|
16
|
+
| Kalshi | WebSocket | Yes | Prices, orderbook |
|
|
17
|
+
| Betfair | WebSocket | Yes | Odds, volume |
|
|
18
|
+
| Smarkets | WebSocket | Yes | Odds, volume |
|
|
19
|
+
| Drift | REST | Yes | Prices, funding |
|
|
20
|
+
| Manifold | WebSocket | Read-only | Prices, comments |
|
|
21
|
+
| Metaculus | REST | Read-only | Forecasts |
|
|
22
|
+
| PredictIt | REST | Read-only | Prices |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Chat Commands
|
|
27
|
+
|
|
28
|
+
### Search Markets
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
/feed search "trump" # Search all platforms
|
|
32
|
+
/feed search "election" --platform poly # Search specific platform
|
|
33
|
+
/feed search "fed rate" --limit 20 # Limit results
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Get Prices
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
/feed price poly <market-id> # Get current price
|
|
40
|
+
/feed price kalshi TRUMP-WIN # Kalshi market
|
|
41
|
+
/feed prices "trump" # Prices for all matching markets
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Orderbook
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
/feed orderbook poly <market-id> # Get orderbook
|
|
48
|
+
/feed orderbook poly <market-id> --depth 10 # Limit depth
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Subscribe (Real-time)
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
/feed subscribe poly <market-id> # Subscribe to price updates
|
|
55
|
+
/feed unsubscribe poly <market-id> # Unsubscribe
|
|
56
|
+
/feed subscriptions # List active subscriptions
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### News
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
/feed news "trump" # Get news for topic
|
|
63
|
+
/feed news <market-id> # News for specific market
|
|
64
|
+
/feed news --recent 10 # Last 10 news items
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Edge Analysis
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
/feed edge poly <market-id> # Analyze edge vs models
|
|
71
|
+
/feed kelly poly <market-id> --prob 0.55 # Calculate Kelly fraction
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## TypeScript API Reference
|
|
77
|
+
|
|
78
|
+
### Create Feed Manager
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import { createFeedManager } from 'clodds/feeds';
|
|
82
|
+
|
|
83
|
+
const feeds = createFeedManager({
|
|
84
|
+
platforms: ['polymarket', 'kalshi', 'manifold', 'betfair'],
|
|
85
|
+
|
|
86
|
+
// Enable real-time
|
|
87
|
+
enableRealtime: true,
|
|
88
|
+
|
|
89
|
+
// Platform credentials (optional for read-only)
|
|
90
|
+
polymarket: { apiKey },
|
|
91
|
+
kalshi: { apiKey },
|
|
92
|
+
betfair: { appKey, sessionToken },
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Search Markets
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
// Search across all platforms
|
|
100
|
+
const results = await feeds.searchMarkets('trump election', {
|
|
101
|
+
platforms: ['polymarket', 'kalshi'],
|
|
102
|
+
limit: 20,
|
|
103
|
+
sortBy: 'volume',
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
for (const market of results) {
|
|
107
|
+
console.log(`[${market.platform}] ${market.question}`);
|
|
108
|
+
console.log(` Price: ${market.price}`);
|
|
109
|
+
console.log(` Volume: $${market.volume.toLocaleString()}`);
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Get Single Market
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
// Get specific market
|
|
117
|
+
const market = await feeds.getMarket('polymarket', 'market-123');
|
|
118
|
+
|
|
119
|
+
console.log(`Question: ${market.question}`);
|
|
120
|
+
console.log(`YES: ${market.yesPrice} / NO: ${market.noPrice}`);
|
|
121
|
+
console.log(`Volume: $${market.volume.toLocaleString()}`);
|
|
122
|
+
console.log(`End date: ${market.endDate}`);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Get Price
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
// Get current price
|
|
129
|
+
const price = await feeds.getPrice('polymarket', 'market-123');
|
|
130
|
+
|
|
131
|
+
console.log(`YES: ${price.yes}`);
|
|
132
|
+
console.log(`NO: ${price.no}`);
|
|
133
|
+
console.log(`Spread: ${price.spread}`);
|
|
134
|
+
console.log(`Updated: ${price.timestamp}`);
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Get Orderbook
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
// Get orderbook
|
|
141
|
+
const orderbook = await feeds.getOrderbook('polymarket', 'market-123', {
|
|
142
|
+
depth: 10,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
console.log('Bids (YES):');
|
|
146
|
+
for (const bid of orderbook.bids) {
|
|
147
|
+
console.log(` ${bid.price}: $${bid.size}`);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
console.log('Asks (YES):');
|
|
151
|
+
for (const ask of orderbook.asks) {
|
|
152
|
+
console.log(` ${ask.price}: $${ask.size}`);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Subscribe to Real-time Updates
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
// Subscribe to price updates
|
|
160
|
+
const subscription = await feeds.subscribePrice('polymarket', 'market-123');
|
|
161
|
+
|
|
162
|
+
subscription.on('price', (update) => {
|
|
163
|
+
console.log(`Price update: YES=${update.yes}, NO=${update.no}`);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
subscription.on('trade', (trade) => {
|
|
167
|
+
console.log(`Trade: ${trade.side} ${trade.size} @ ${trade.price}`);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// Unsubscribe
|
|
171
|
+
await subscription.unsubscribe();
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### News
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
// Get recent news
|
|
178
|
+
const news = await feeds.getRecentNews('trump', { limit: 10 });
|
|
179
|
+
|
|
180
|
+
for (const article of news) {
|
|
181
|
+
console.log(`[${article.source}] ${article.title}`);
|
|
182
|
+
console.log(` ${article.summary}`);
|
|
183
|
+
console.log(` ${article.url}`);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Search news
|
|
187
|
+
const searchResults = await feeds.searchNews('federal reserve', {
|
|
188
|
+
from: '2024-01-01',
|
|
189
|
+
sources: ['reuters', 'bloomberg'],
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Edge Analysis
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
// Analyze edge vs external models
|
|
197
|
+
const edge = await feeds.analyzeEdge('polymarket', 'market-123');
|
|
198
|
+
|
|
199
|
+
console.log(`Market price: ${edge.marketPrice}`);
|
|
200
|
+
console.log(`Model estimates:`);
|
|
201
|
+
for (const model of edge.models) {
|
|
202
|
+
console.log(` ${model.name}: ${model.estimate}`);
|
|
203
|
+
console.log(` Edge: ${model.edge > 0 ? '+' : ''}${model.edge.toFixed(1)}%`);
|
|
204
|
+
}
|
|
205
|
+
console.log(`Consensus edge: ${edge.consensusEdge.toFixed(1)}%`);
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Kelly Criterion
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
// Calculate optimal position size
|
|
212
|
+
const kelly = await feeds.calculateKelly({
|
|
213
|
+
platform: 'polymarket',
|
|
214
|
+
marketId: 'market-123',
|
|
215
|
+
estimatedProbability: 0.55, // Your estimate
|
|
216
|
+
bankroll: 10000, // Your bankroll
|
|
217
|
+
kellyFraction: 0.5, // Half-Kelly for safety
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
console.log(`Market price: ${kelly.marketPrice}`);
|
|
221
|
+
console.log(`Your estimate: ${kelly.estimatedProb}`);
|
|
222
|
+
console.log(`Edge: ${kelly.edge.toFixed(1)}%`);
|
|
223
|
+
console.log(`Full Kelly: ${kelly.fullKelly.toFixed(1)}%`);
|
|
224
|
+
console.log(`Recommended size: $${kelly.recommendedSize}`);
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Platform-Specific Features
|
|
230
|
+
|
|
231
|
+
### Polymarket RTDS (Real-time Data Service)
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
// Connect to RTDS for ultra-low-latency updates
|
|
235
|
+
const rtds = await feeds.connectRTDS('polymarket');
|
|
236
|
+
|
|
237
|
+
rtds.on('tick', (tick) => {
|
|
238
|
+
console.log(`${tick.market}: ${tick.price} (${tick.side})`);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
rtds.subscribe(['market-123', 'market-456']);
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Betfair Odds
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
// Get Betfair odds
|
|
248
|
+
const odds = await feeds.getBetfairOdds('event-123');
|
|
249
|
+
|
|
250
|
+
for (const runner of odds.runners) {
|
|
251
|
+
console.log(`${runner.name}: ${runner.backOdds} / ${runner.layOdds}`);
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Metaculus Forecasts
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
// Get Metaculus community forecast
|
|
259
|
+
const forecast = await feeds.getMetaculusForecast('question-123');
|
|
260
|
+
|
|
261
|
+
console.log(`Community median: ${forecast.median}`);
|
|
262
|
+
console.log(`25th percentile: ${forecast.q25}`);
|
|
263
|
+
console.log(`75th percentile: ${forecast.q75}`);
|
|
264
|
+
console.log(`Forecasters: ${forecast.forecasterCount}`);
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Data Refresh Rates
|
|
270
|
+
|
|
271
|
+
| Platform | REST | WebSocket |
|
|
272
|
+
|----------|------|-----------|
|
|
273
|
+
| Polymarket | 5s | Real-time |
|
|
274
|
+
| Kalshi | 10s | Real-time |
|
|
275
|
+
| Betfair | 1s | Real-time |
|
|
276
|
+
| Manifold | 30s | Real-time |
|
|
277
|
+
| Metaculus | 60s | N/A |
|
|
278
|
+
| PredictIt | 30s | N/A |
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Best Practices
|
|
283
|
+
|
|
284
|
+
1. **Use WebSocket** for real-time trading decisions
|
|
285
|
+
2. **Cache responses** for non-time-sensitive queries
|
|
286
|
+
3. **Respect rate limits** - batch requests when possible
|
|
287
|
+
4. **Subscribe selectively** - only to markets you need
|
|
288
|
+
5. **Handle reconnections** - WebSocket connections can drop
|