clodds 1.2.9 → 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 (263) hide show
  1. package/dist/skills/bundled/acp/SKILL.md +188 -0
  2. package/dist/skills/bundled/acp/index.d.ts +0 -3
  3. package/dist/skills/bundled/acp/index.js +1 -1
  4. package/dist/skills/bundled/acp/index.js.map +1 -1
  5. package/dist/skills/bundled/agentbets/SKILL.md +19 -0
  6. package/dist/skills/bundled/agentbets/index.js +1 -1
  7. package/dist/skills/bundled/agentbets/index.js.map +1 -1
  8. package/dist/skills/bundled/ai-strategy/SKILL.md +111 -0
  9. package/dist/skills/bundled/ai-strategy/index.js +1 -1
  10. package/dist/skills/bundled/ai-strategy/index.js.map +1 -1
  11. package/dist/skills/bundled/alerts/SKILL.md +87 -0
  12. package/dist/skills/bundled/analytics/SKILL.md +252 -0
  13. package/dist/skills/bundled/analytics/index.js +2 -2
  14. package/dist/skills/bundled/analytics/index.js.map +1 -1
  15. package/dist/skills/bundled/arbitrage/SKILL.md +287 -0
  16. package/dist/skills/bundled/arbitrage/index.js +6 -1
  17. package/dist/skills/bundled/arbitrage/index.js.map +1 -1
  18. package/dist/skills/bundled/auto-reply/SKILL.md +285 -0
  19. package/dist/skills/bundled/auto-reply/index.js +2 -2
  20. package/dist/skills/bundled/auto-reply/index.js.map +1 -1
  21. package/dist/skills/bundled/automation/SKILL.md +242 -0
  22. package/dist/skills/bundled/automation/index.js +2 -2
  23. package/dist/skills/bundled/automation/index.js.map +1 -1
  24. package/dist/skills/bundled/backtest/SKILL.md +225 -0
  25. package/dist/skills/bundled/bags/SKILL.md +131 -0
  26. package/dist/skills/bundled/bankr/SKILL.md +114 -0
  27. package/dist/skills/bundled/betfair/SKILL.md +113 -0
  28. package/dist/skills/bundled/binance-futures/SKILL.md +84 -0
  29. package/dist/skills/bundled/binance-futures/index.d.ts +0 -3
  30. package/dist/skills/bundled/binance-futures/index.js +1 -2
  31. package/dist/skills/bundled/binance-futures/index.js.map +1 -1
  32. package/dist/skills/bundled/botchan/SKILL.md +66 -0
  33. package/dist/skills/bundled/botchan/index.d.ts +0 -3
  34. package/dist/skills/bundled/botchan/index.js +0 -1
  35. package/dist/skills/bundled/botchan/index.js.map +1 -1
  36. package/dist/skills/bundled/bridge/SKILL.md +215 -0
  37. package/dist/skills/bundled/bridge/index.js +6 -0
  38. package/dist/skills/bundled/bridge/index.js.map +1 -1
  39. package/dist/skills/bundled/bybit-futures/SKILL.md +84 -0
  40. package/dist/skills/bundled/bybit-futures/index.d.ts +0 -3
  41. package/dist/skills/bundled/bybit-futures/index.js +0 -1
  42. package/dist/skills/bundled/bybit-futures/index.js.map +1 -1
  43. package/dist/skills/bundled/clanker/SKILL.md +125 -0
  44. package/dist/skills/bundled/clanker/index.d.ts +0 -3
  45. package/dist/skills/bundled/clanker/index.js +0 -1
  46. package/dist/skills/bundled/clanker/index.js.map +1 -1
  47. package/dist/skills/bundled/copy-trading/SKILL.md +285 -0
  48. package/dist/skills/bundled/copy-trading/index.js +15 -8
  49. package/dist/skills/bundled/copy-trading/index.js.map +1 -1
  50. package/dist/skills/bundled/copy-trading-solana/SKILL.md +66 -0
  51. package/dist/skills/bundled/credentials/SKILL.md +261 -0
  52. package/dist/skills/bundled/credentials/index.js +4 -0
  53. package/dist/skills/bundled/credentials/index.js.map +1 -1
  54. package/dist/skills/bundled/crypto-hft/SKILL.md +121 -0
  55. package/dist/skills/bundled/crypto-hft/index.js +18 -3
  56. package/dist/skills/bundled/crypto-hft/index.js.map +1 -1
  57. package/dist/skills/bundled/dca/SKILL.md +27 -0
  58. package/dist/skills/bundled/dex/SKILL.md +92 -0
  59. package/dist/skills/bundled/dex/index.js +77 -29
  60. package/dist/skills/bundled/dex/index.js.map +1 -1
  61. package/dist/skills/bundled/divergence/SKILL.md +83 -0
  62. package/dist/skills/bundled/doctor/SKILL.md +267 -0
  63. package/dist/skills/bundled/doctor/index.js +2 -8
  64. package/dist/skills/bundled/doctor/index.js.map +1 -1
  65. package/dist/skills/bundled/drift/SKILL.md +53 -0
  66. package/dist/skills/bundled/drift-sdk/SKILL.md +103 -0
  67. package/dist/skills/bundled/drift-sdk/index.d.ts +0 -3
  68. package/dist/skills/bundled/drift-sdk/index.js +0 -1
  69. package/dist/skills/bundled/drift-sdk/index.js.map +1 -1
  70. package/dist/skills/bundled/edge/SKILL.md +84 -0
  71. package/dist/skills/bundled/embeddings/SKILL.md +244 -0
  72. package/dist/skills/bundled/endaoment/SKILL.md +65 -0
  73. package/dist/skills/bundled/endaoment/index.d.ts +0 -3
  74. package/dist/skills/bundled/endaoment/index.js +0 -1
  75. package/dist/skills/bundled/endaoment/index.js.map +1 -1
  76. package/dist/skills/bundled/ens/SKILL.md +63 -0
  77. package/dist/skills/bundled/ens/index.d.ts +0 -3
  78. package/dist/skills/bundled/ens/index.js +0 -1
  79. package/dist/skills/bundled/ens/index.js.map +1 -1
  80. package/dist/skills/bundled/erc8004/SKILL.md +79 -0
  81. package/dist/skills/bundled/erc8004/index.d.ts +0 -3
  82. package/dist/skills/bundled/erc8004/index.js +0 -1
  83. package/dist/skills/bundled/erc8004/index.js.map +1 -1
  84. package/dist/skills/bundled/execution/SKILL.md +278 -0
  85. package/dist/skills/bundled/farcaster/SKILL.md +80 -0
  86. package/dist/skills/bundled/farcaster/index.js +12 -0
  87. package/dist/skills/bundled/farcaster/index.js.map +1 -1
  88. package/dist/skills/bundled/features/SKILL.md +20 -0
  89. package/dist/skills/bundled/feeds/SKILL.md +288 -0
  90. package/dist/skills/bundled/harden/SKILL.md +74 -0
  91. package/dist/skills/bundled/history/SKILL.md +257 -0
  92. package/dist/skills/bundled/hyperliquid/SKILL.md +200 -0
  93. package/dist/skills/bundled/hyperliquid/index.d.ts +0 -3
  94. package/dist/skills/bundled/hyperliquid/index.js +0 -1
  95. package/dist/skills/bundled/hyperliquid/index.js.map +1 -1
  96. package/dist/skills/bundled/identity/SKILL.md +228 -0
  97. package/dist/skills/bundled/identity/index.js +2 -2
  98. package/dist/skills/bundled/identity/index.js.map +1 -1
  99. package/dist/skills/bundled/integrations/SKILL.md +321 -0
  100. package/dist/skills/bundled/integrations/index.js +2 -2
  101. package/dist/skills/bundled/integrations/index.js.map +1 -1
  102. package/dist/skills/bundled/jupiter/SKILL.md +163 -0
  103. package/dist/skills/bundled/jupiter/index.js +2 -2
  104. package/dist/skills/bundled/kamino/SKILL.md +69 -0
  105. package/dist/skills/bundled/ledger/SKILL.md +20 -0
  106. package/dist/skills/bundled/lighter/SKILL.md +83 -0
  107. package/dist/skills/bundled/lighter/index.d.ts +0 -3
  108. package/dist/skills/bundled/lighter/index.js +0 -1
  109. package/dist/skills/bundled/lighter/index.js.map +1 -1
  110. package/dist/skills/bundled/marginfi/SKILL.md +62 -0
  111. package/dist/skills/bundled/market-index/SKILL.md +242 -0
  112. package/dist/skills/bundled/market-index/index.js +1 -3
  113. package/dist/skills/bundled/market-index/index.js.map +1 -1
  114. package/dist/skills/bundled/markets/SKILL.md +49 -0
  115. package/dist/skills/bundled/mcp/SKILL.md +235 -0
  116. package/dist/skills/bundled/mcp/index.js +1 -3
  117. package/dist/skills/bundled/mcp/index.js.map +1 -1
  118. package/dist/skills/bundled/memory/SKILL.md +209 -0
  119. package/dist/skills/bundled/metaculus/SKILL.md +62 -0
  120. package/dist/skills/bundled/metaculus/index.js +4 -1
  121. package/dist/skills/bundled/metaculus/index.js.map +1 -1
  122. package/dist/skills/bundled/meteora/SKILL.md +28 -0
  123. package/dist/skills/bundled/meteora-dbc/SKILL.md +25 -0
  124. package/dist/skills/bundled/metrics/SKILL.md +338 -0
  125. package/dist/skills/bundled/mev/SKILL.md +239 -0
  126. package/dist/skills/bundled/mev/index.js +2 -2
  127. package/dist/skills/bundled/mev/index.js.map +1 -1
  128. package/dist/skills/bundled/mexc-futures/SKILL.md +86 -0
  129. package/dist/skills/bundled/mexc-futures/index.d.ts +0 -3
  130. package/dist/skills/bundled/mexc-futures/index.js +0 -1
  131. package/dist/skills/bundled/mexc-futures/index.js.map +1 -1
  132. package/dist/skills/bundled/mm/SKILL.md +142 -0
  133. package/dist/skills/bundled/mm/index.js +28 -27
  134. package/dist/skills/bundled/mm/index.js.map +1 -1
  135. package/dist/skills/bundled/monitoring/SKILL.md +249 -0
  136. package/dist/skills/bundled/news/SKILL.md +95 -0
  137. package/dist/skills/bundled/news/index.js +1 -2
  138. package/dist/skills/bundled/news/index.js.map +1 -1
  139. package/dist/skills/bundled/onchainkit/SKILL.md +83 -0
  140. package/dist/skills/bundled/opinion/SKILL.md +87 -0
  141. package/dist/skills/bundled/opportunity/SKILL.md +308 -0
  142. package/dist/skills/bundled/orca/SKILL.md +28 -0
  143. package/dist/skills/bundled/orca/index.js +11 -7
  144. package/dist/skills/bundled/orca/index.js.map +1 -1
  145. package/dist/skills/bundled/pairing/SKILL.md +275 -0
  146. package/dist/skills/bundled/pancakeswap/SKILL.md +93 -0
  147. package/dist/skills/bundled/pancakeswap/index.d.ts +0 -3
  148. package/dist/skills/bundled/pancakeswap/index.js +0 -1
  149. package/dist/skills/bundled/pancakeswap/index.js.map +1 -1
  150. package/dist/skills/bundled/percolator/SKILL.md +22 -0
  151. package/dist/skills/bundled/permissions/SKILL.md +269 -0
  152. package/dist/skills/bundled/permissions/index.js +2 -2
  153. package/dist/skills/bundled/permissions/index.js.map +1 -1
  154. package/dist/skills/bundled/plugins/SKILL.md +263 -0
  155. package/dist/skills/bundled/plugins/index.js +2 -2
  156. package/dist/skills/bundled/plugins/index.js.map +1 -1
  157. package/dist/skills/bundled/portfolio/SKILL.md +161 -0
  158. package/dist/skills/bundled/portfolio/index.js +1 -1
  159. package/dist/skills/bundled/portfolio/index.js.map +1 -1
  160. package/dist/skills/bundled/portfolio-sync/SKILL.md +466 -0
  161. package/dist/skills/bundled/positions/SKILL.md +262 -0
  162. package/dist/skills/bundled/predictfun/SKILL.md +109 -0
  163. package/dist/skills/bundled/predictfun/index.js +1 -1
  164. package/dist/skills/bundled/predictfun/index.js.map +1 -1
  165. package/dist/skills/bundled/predictit/SKILL.md +66 -0
  166. package/dist/skills/bundled/predictit/index.js +4 -1
  167. package/dist/skills/bundled/predictit/index.js.map +1 -1
  168. package/dist/skills/bundled/presence/SKILL.md +217 -0
  169. package/dist/skills/bundled/presence/index.js +2 -2
  170. package/dist/skills/bundled/presence/index.js.map +1 -1
  171. package/dist/skills/bundled/processes/SKILL.md +254 -0
  172. package/dist/skills/bundled/pump-swarm/SKILL.md +309 -0
  173. package/dist/skills/bundled/pumpfun/SKILL.md +145 -0
  174. package/dist/skills/bundled/pumpfun/index.js +82 -8
  175. package/dist/skills/bundled/pumpfun/index.js.map +1 -1
  176. package/dist/skills/bundled/qmd/SKILL.md +129 -0
  177. package/dist/skills/bundled/qrcoin/SKILL.md +60 -0
  178. package/dist/skills/bundled/qrcoin/index.d.ts +0 -3
  179. package/dist/skills/bundled/qrcoin/index.js +0 -1
  180. package/dist/skills/bundled/qrcoin/index.js.map +1 -1
  181. package/dist/skills/bundled/raydium/SKILL.md +198 -0
  182. package/dist/skills/bundled/remote/SKILL.md +201 -0
  183. package/dist/skills/bundled/research/SKILL.md +83 -0
  184. package/dist/skills/bundled/research/index.js +2 -2
  185. package/dist/skills/bundled/research/index.js.map +1 -1
  186. package/dist/skills/bundled/risk/SKILL.md +323 -0
  187. package/dist/skills/bundled/router/SKILL.md +233 -0
  188. package/dist/skills/bundled/routing/SKILL.md +258 -0
  189. package/dist/skills/bundled/sandbox/SKILL.md +257 -0
  190. package/dist/skills/bundled/search-config/SKILL.md +257 -0
  191. package/dist/skills/bundled/search-config/index.js +2 -2
  192. package/dist/skills/bundled/search-config/index.js.map +1 -1
  193. package/dist/skills/bundled/sessions/SKILL.md +251 -0
  194. package/dist/skills/bundled/sessions/index.js +1 -1
  195. package/dist/skills/bundled/sessions/index.js.map +1 -1
  196. package/dist/skills/bundled/setup/SKILL.md +53 -0
  197. package/dist/skills/bundled/shield/SKILL.md +21 -0
  198. package/dist/skills/bundled/signals/SKILL.md +106 -0
  199. package/dist/skills/bundled/signals/index.d.ts +0 -3
  200. package/dist/skills/bundled/signals/index.js +3 -4
  201. package/dist/skills/bundled/signals/index.js.map +1 -1
  202. package/dist/skills/bundled/sizing/SKILL.md +238 -0
  203. package/dist/skills/bundled/slippage/SKILL.md +306 -0
  204. package/dist/skills/bundled/smarkets/SKILL.md +107 -0
  205. package/dist/skills/bundled/smarkets/index.js +3 -3
  206. package/dist/skills/bundled/smarkets/index.js.map +1 -1
  207. package/dist/skills/bundled/solend/SKILL.md +63 -0
  208. package/dist/skills/bundled/strategy/SKILL.md +266 -0
  209. package/dist/skills/bundled/streaming/SKILL.md +150 -0
  210. package/dist/skills/bundled/streaming/index.js +2 -2
  211. package/dist/skills/bundled/streaming/index.js.map +1 -1
  212. package/dist/skills/bundled/tailscale/SKILL.md +249 -0
  213. package/dist/skills/bundled/tailscale/index.js +2 -2
  214. package/dist/skills/bundled/tailscale/index.js.map +1 -1
  215. package/dist/skills/bundled/ticks/SKILL.md +61 -0
  216. package/dist/skills/bundled/token-security/SKILL.md +18 -0
  217. package/dist/skills/bundled/trading-evm/SKILL.md +329 -0
  218. package/dist/skills/bundled/trading-futures/SKILL.md +865 -0
  219. package/dist/skills/bundled/trading-kalshi/SKILL.md +629 -0
  220. package/dist/skills/bundled/trading-kalshi/index.js +2 -0
  221. package/dist/skills/bundled/trading-kalshi/index.js.map +1 -1
  222. package/dist/skills/bundled/trading-manifold/SKILL.md +387 -0
  223. package/dist/skills/bundled/trading-polymarket/SKILL.md +1080 -0
  224. package/dist/skills/bundled/trading-polymarket/index.js +28 -19
  225. package/dist/skills/bundled/trading-polymarket/index.js.map +1 -1
  226. package/dist/skills/bundled/trading-solana/SKILL.md +418 -0
  227. package/dist/skills/bundled/trading-solana/index.js +1 -1
  228. package/dist/skills/bundled/trading-solana/index.js.map +1 -1
  229. package/dist/skills/bundled/trading-system/SKILL.md +290 -0
  230. package/dist/skills/bundled/triggers/SKILL.md +433 -0
  231. package/dist/skills/bundled/tts/SKILL.md +220 -0
  232. package/dist/skills/bundled/tweet-ideas/SKILL.md +77 -0
  233. package/dist/skills/bundled/usage/SKILL.md +239 -0
  234. package/dist/skills/bundled/usage/index.js +2 -2
  235. package/dist/skills/bundled/usage/index.js.map +1 -1
  236. package/dist/skills/bundled/veil/SKILL.md +76 -0
  237. package/dist/skills/bundled/veil/index.d.ts +0 -3
  238. package/dist/skills/bundled/veil/index.js +0 -1
  239. package/dist/skills/bundled/veil/index.js.map +1 -1
  240. package/dist/skills/bundled/verify/SKILL.md +199 -0
  241. package/dist/skills/bundled/verify/index.d.ts +0 -3
  242. package/dist/skills/bundled/verify/index.js +0 -1
  243. package/dist/skills/bundled/verify/index.js.map +1 -1
  244. package/dist/skills/bundled/virtuals/SKILL.md +82 -0
  245. package/dist/skills/bundled/voice/SKILL.md +217 -0
  246. package/dist/skills/bundled/voice/index.js +2 -2
  247. package/dist/skills/bundled/voice/index.js.map +1 -1
  248. package/dist/skills/bundled/weather/SKILL.md +80 -0
  249. package/dist/skills/bundled/weather/index.js +3 -0
  250. package/dist/skills/bundled/weather/index.js.map +1 -1
  251. package/dist/skills/bundled/webhooks/SKILL.md +297 -0
  252. package/dist/skills/bundled/webhooks/index.js +2 -2
  253. package/dist/skills/bundled/webhooks/index.js.map +1 -1
  254. package/dist/skills/bundled/whale-tracking/SKILL.md +287 -0
  255. package/dist/skills/bundled/whale-tracking/index.js +2 -2
  256. package/dist/skills/bundled/whale-tracking/index.js.map +1 -1
  257. package/dist/skills/bundled/yoink/SKILL.md +54 -0
  258. package/dist/skills/bundled/yoink/index.d.ts +0 -3
  259. package/dist/skills/bundled/yoink/index.js +0 -1
  260. package/dist/skills/bundled/yoink/index.js.map +1 -1
  261. package/dist/skills/executor.js +5 -3
  262. package/dist/skills/executor.js.map +1 -1
  263. package/package.json +2 -2
@@ -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
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: harden
3
+ description: VPS security auditing and hardening
4
+ emoji: "🔒"
5
+ commands:
6
+ - /harden
7
+ ---
8
+
9
+ # VPS Hardening
10
+
11
+ Security auditing and automated hardening for remote servers.
12
+
13
+ ## Commands
14
+
15
+ ### `/harden audit <host>`
16
+ Run security audit against a server. Checks:
17
+ - System updates
18
+ - Auto-updates configuration
19
+ - SSH root login status
20
+ - Password authentication
21
+ - Firewall status
22
+ - Fail2ban status
23
+ - System uptime
24
+ - Listening services
25
+ - Sudo user configuration
26
+
27
+ ### `/harden fix <host>`
28
+ Apply safe fixes that won't lock you out:
29
+ - Install system updates
30
+ - Enable unattended-upgrades
31
+ - Configure UFW firewall
32
+ - Install and enable fail2ban
33
+ - Set SSH MaxAuthTries
34
+
35
+ ### `/harden emergency <host>`
36
+ Quick 10-minute hardening for new servers:
37
+ - Full system update
38
+ - Firewall setup
39
+ - Fail2ban installation
40
+ - Root password lock
41
+
42
+ ### `/harden report <host>`
43
+ Generate markdown security report.
44
+
45
+ ## Options
46
+
47
+ | Option | Description |
48
+ |--------|-------------|
49
+ | `--user=NAME` | SSH user (default: root) |
50
+ | `--dry-run` | Preview changes without applying |
51
+
52
+ ## Examples
53
+
54
+ ```
55
+ /harden audit 192.168.1.100
56
+ /harden fix myserver.com --user=admin
57
+ /harden emergency vps.example.com --dry-run
58
+ /harden report server.io > security-report.md
59
+ ```
60
+
61
+ ## Security Checks
62
+
63
+ | Check | Pass Criteria |
64
+ |-------|---------------|
65
+ | System Updates | 0 pending updates |
66
+ | Auto Updates | unattended-upgrades installed |
67
+ | Root Login | PermitRootLogin no |
68
+ | Password Auth | PasswordAuthentication no |
69
+ | Firewall | UFW active or iptables configured |
70
+ | Fail2ban | Service running |
71
+ | Uptime | < 90 days |
72
+ | Services | < 10 listening ports |
73
+ | Sudo Users | At least one non-root sudo user |
74
+ | MaxAuthTries | Set to 3 or less |
@@ -0,0 +1,257 @@
1
+ ---
2
+ name: history
3
+ description: "Trade history tracking, sync, and performance analytics"
4
+ emoji: "📊"
5
+ gates:
6
+ envs:
7
+ anyOf:
8
+ - POLY_API_KEY
9
+ - KALSHI_API_KEY
10
+ ---
11
+
12
+ # Trade History - Complete API Reference
13
+
14
+ Fetch, sync, and analyze trade history from Polymarket and Kalshi with detailed performance metrics.
15
+
16
+ ---
17
+
18
+ ## Chat Commands
19
+
20
+ ### Fetch & Sync
21
+
22
+ ```
23
+ /history fetch # Fetch all trades from APIs
24
+ /history fetch poly # Fetch Polymarket only
25
+ /history fetch --from 2024-01-01 # From specific date
26
+ /history sync # Sync to local database
27
+ ```
28
+
29
+ ### View History
30
+
31
+ ```
32
+ /history list # Recent trades
33
+ /history list --limit 50 # Last 50 trades
34
+ /history list --platform poly # Polymarket only
35
+ /history list --market <id> # Specific market
36
+ ```
37
+
38
+ ### Statistics
39
+
40
+ ```
41
+ /history stats # Overall statistics
42
+ /history stats --period 30d # Last 30 days
43
+ /history stats --platform kalshi # Platform-specific
44
+ ```
45
+
46
+ ### P&L Analysis
47
+
48
+ ```
49
+ /history daily-pnl # Daily P&L
50
+ /history weekly-pnl # Weekly P&L
51
+ /history monthly-pnl # Monthly P&L
52
+ /history by-market # P&L by market category
53
+ ```
54
+
55
+ ### Export
56
+
57
+ ```
58
+ /history export # Export to CSV
59
+ /history export --format json # Export as JSON
60
+ /history export --from 2024-01-01 # Date range
61
+ ```
62
+
63
+ ### Filtering
64
+
65
+ ```
66
+ /history filter --side buy # Only buys
67
+ /history filter --pnl positive # Only winners
68
+ /history filter --pnl negative # Only losers
69
+ /history filter --min-size 100 # Min $100 trades
70
+ ```
71
+
72
+ ---
73
+
74
+ ## TypeScript API Reference
75
+
76
+ ### Create History Service
77
+
78
+ ```typescript
79
+ import { createTradeHistoryService } from 'clodds/history';
80
+
81
+ const history = createTradeHistoryService({
82
+ polymarket: {
83
+ apiKey: process.env.POLY_API_KEY,
84
+ address: process.env.POLY_ADDRESS,
85
+ },
86
+ kalshi: {
87
+ apiKey: process.env.KALSHI_API_KEY,
88
+ },
89
+
90
+ // Local storage
91
+ dbPath: './trade-history.db',
92
+ });
93
+ ```
94
+
95
+ ### Fetch Trades from APIs
96
+
97
+ ```typescript
98
+ // Fetch all trades from exchange APIs
99
+ const trades = await history.fetchTrades({
100
+ platforms: ['polymarket', 'kalshi'],
101
+ from: '2024-01-01',
102
+ });
103
+
104
+ console.log(`Fetched ${trades.length} trades`);
105
+
106
+ // Fetch from specific platform
107
+ const polyTrades = await history.fetchTrades({
108
+ platforms: ['polymarket'],
109
+ limit: 100,
110
+ });
111
+ ```
112
+
113
+ ### Sync to Database
114
+
115
+ ```typescript
116
+ // Sync fetched trades to local database
117
+ await history.syncToDatabase();
118
+
119
+ console.log('Trades synced to database');
120
+ ```
121
+
122
+ ### Get Trades
123
+
124
+ ```typescript
125
+ // Get trades from local storage
126
+ const trades = await history.getTrades({
127
+ platform: 'polymarket',
128
+ from: '2024-01-01',
129
+ to: '2024-12-31',
130
+ limit: 100,
131
+ });
132
+
133
+ for (const trade of trades) {
134
+ console.log(`${trade.timestamp}: ${trade.side} ${trade.market}`);
135
+ console.log(` Size: $${trade.size}`);
136
+ console.log(` Price: ${trade.price}`);
137
+ console.log(` P&L: $${trade.pnl?.toFixed(2) || 'open'}`);
138
+ }
139
+ ```
140
+
141
+ ### Statistics
142
+
143
+ ```typescript
144
+ // Get comprehensive statistics
145
+ const stats = await history.getStats({
146
+ period: '30d',
147
+ platform: 'polymarket',
148
+ });
149
+
150
+ console.log(`=== Trading Statistics (30d) ===`);
151
+ console.log(`Total trades: ${stats.totalTrades}`);
152
+ console.log(`Winning trades: ${stats.winningTrades}`);
153
+ console.log(`Losing trades: ${stats.losingTrades}`);
154
+ console.log(`Win rate: ${(stats.winRate * 100).toFixed(1)}%`);
155
+ console.log(`\nP&L:`);
156
+ console.log(` Total: $${stats.totalPnl.toLocaleString()}`);
157
+ console.log(` Gross profit: $${stats.grossProfit.toLocaleString()}`);
158
+ console.log(` Gross loss: $${stats.grossLoss.toLocaleString()}`);
159
+ console.log(` Profit factor: ${stats.profitFactor.toFixed(2)}`);
160
+ console.log(`\nTrade sizes:`);
161
+ console.log(` Average: $${stats.avgTradeSize.toFixed(2)}`);
162
+ console.log(` Largest win: $${stats.largestWin.toFixed(2)}`);
163
+ console.log(` Largest loss: $${stats.largestLoss.toFixed(2)}`);
164
+ console.log(`\nRisk metrics:`);
165
+ console.log(` Sharpe ratio: ${stats.sharpeRatio.toFixed(2)}`);
166
+ console.log(` Max drawdown: ${(stats.maxDrawdown * 100).toFixed(1)}%`);
167
+ ```
168
+
169
+ ### Daily P&L
170
+
171
+ ```typescript
172
+ // Get daily P&L breakdown
173
+ const dailyPnl = await history.getDailyPnL({
174
+ days: 30,
175
+ platform: 'polymarket',
176
+ });
177
+
178
+ console.log('=== Daily P&L ===');
179
+ for (const day of dailyPnl) {
180
+ const sign = day.pnl >= 0 ? '+' : '';
181
+ const bar = day.pnl >= 0
182
+ ? '█'.repeat(Math.min(Math.floor(day.pnl / 10), 20))
183
+ : '▓'.repeat(Math.min(Math.floor(Math.abs(day.pnl) / 10), 20));
184
+
185
+ console.log(`${day.date} | ${sign}$${day.pnl.toFixed(2).padStart(8)} | ${bar}`);
186
+ }
187
+ ```
188
+
189
+ ### Performance by Market
190
+
191
+ ```typescript
192
+ // Get performance breakdown by market category
193
+ const byMarket = await history.getPerformanceByMarket({
194
+ period: '30d',
195
+ });
196
+
197
+ console.log('=== Performance by Market Category ===');
198
+ for (const [category, data] of Object.entries(byMarket)) {
199
+ console.log(`\n${category}:`);
200
+ console.log(` Trades: ${data.trades}`);
201
+ console.log(` Win rate: ${(data.winRate * 100).toFixed(1)}%`);
202
+ console.log(` P&L: $${data.pnl.toLocaleString()}`);
203
+ console.log(` Avg trade: $${data.avgTrade.toFixed(2)}`);
204
+ }
205
+ ```
206
+
207
+ ### Export
208
+
209
+ ```typescript
210
+ // Export to CSV
211
+ await history.exportCsv({
212
+ path: './trades.csv',
213
+ from: '2024-01-01',
214
+ to: '2024-12-31',
215
+ columns: ['timestamp', 'platform', 'market', 'side', 'size', 'price', 'pnl'],
216
+ });
217
+
218
+ // Export to JSON
219
+ const json = await history.exportJson({
220
+ from: '2024-01-01',
221
+ });
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Database Schema
227
+
228
+ ```sql
229
+ CREATE TABLE trades (
230
+ id TEXT PRIMARY KEY,
231
+ platform TEXT NOT NULL,
232
+ market_id TEXT NOT NULL,
233
+ market_question TEXT,
234
+ side TEXT NOT NULL, -- 'buy' or 'sell'
235
+ outcome TEXT, -- 'YES' or 'NO'
236
+ size REAL NOT NULL,
237
+ price REAL NOT NULL,
238
+ fee REAL DEFAULT 0,
239
+ pnl REAL,
240
+ timestamp INTEGER NOT NULL,
241
+ created_at INTEGER DEFAULT (strftime('%s', 'now'))
242
+ );
243
+
244
+ CREATE INDEX idx_trades_platform ON trades(platform);
245
+ CREATE INDEX idx_trades_timestamp ON trades(timestamp);
246
+ CREATE INDEX idx_trades_market ON trades(market_id);
247
+ ```
248
+
249
+ ---
250
+
251
+ ## Best Practices
252
+
253
+ 1. **Sync regularly** - Keep local database up to date
254
+ 2. **Export backups** - Periodically export to CSV
255
+ 3. **Review weekly** - Analyze performance patterns
256
+ 4. **Track by category** - Identify strong/weak areas
257
+ 5. **Monitor drawdown** - Set alerts for max drawdown