clodds 1.2.8 → 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.
Files changed (232) 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/ai-strategy/SKILL.md +111 -0
  7. package/dist/skills/bundled/ai-strategy/index.js +1 -1
  8. package/dist/skills/bundled/ai-strategy/index.js.map +1 -1
  9. package/dist/skills/bundled/alerts/SKILL.md +87 -0
  10. package/dist/skills/bundled/analytics/SKILL.md +252 -0
  11. package/dist/skills/bundled/analytics/index.js +2 -2
  12. package/dist/skills/bundled/analytics/index.js.map +1 -1
  13. package/dist/skills/bundled/arbitrage/SKILL.md +287 -0
  14. package/dist/skills/bundled/auto-reply/SKILL.md +285 -0
  15. package/dist/skills/bundled/auto-reply/index.js +2 -2
  16. package/dist/skills/bundled/auto-reply/index.js.map +1 -1
  17. package/dist/skills/bundled/automation/SKILL.md +242 -0
  18. package/dist/skills/bundled/automation/index.js +2 -2
  19. package/dist/skills/bundled/automation/index.js.map +1 -1
  20. package/dist/skills/bundled/backtest/SKILL.md +225 -0
  21. package/dist/skills/bundled/bags/SKILL.md +131 -0
  22. package/dist/skills/bundled/bankr/SKILL.md +114 -0
  23. package/dist/skills/bundled/betfair/SKILL.md +113 -0
  24. package/dist/skills/bundled/binance-futures/SKILL.md +84 -0
  25. package/dist/skills/bundled/binance-futures/index.d.ts +0 -3
  26. package/dist/skills/bundled/binance-futures/index.js +1 -2
  27. package/dist/skills/bundled/binance-futures/index.js.map +1 -1
  28. package/dist/skills/bundled/botchan/SKILL.md +66 -0
  29. package/dist/skills/bundled/botchan/index.d.ts +0 -3
  30. package/dist/skills/bundled/botchan/index.js +0 -1
  31. package/dist/skills/bundled/botchan/index.js.map +1 -1
  32. package/dist/skills/bundled/bridge/SKILL.md +215 -0
  33. package/dist/skills/bundled/bybit-futures/SKILL.md +84 -0
  34. package/dist/skills/bundled/bybit-futures/index.d.ts +0 -3
  35. package/dist/skills/bundled/bybit-futures/index.js +0 -1
  36. package/dist/skills/bundled/bybit-futures/index.js.map +1 -1
  37. package/dist/skills/bundled/clanker/SKILL.md +125 -0
  38. package/dist/skills/bundled/clanker/index.d.ts +0 -3
  39. package/dist/skills/bundled/clanker/index.js +0 -1
  40. package/dist/skills/bundled/clanker/index.js.map +1 -1
  41. package/dist/skills/bundled/copy-trading/SKILL.md +285 -0
  42. package/dist/skills/bundled/copy-trading/index.js +2 -2
  43. package/dist/skills/bundled/copy-trading/index.js.map +1 -1
  44. package/dist/skills/bundled/copy-trading-solana/SKILL.md +66 -0
  45. package/dist/skills/bundled/credentials/SKILL.md +261 -0
  46. package/dist/skills/bundled/crypto-hft/SKILL.md +121 -0
  47. package/dist/skills/bundled/dca/SKILL.md +27 -0
  48. package/dist/skills/bundled/dex/SKILL.md +87 -0
  49. package/dist/skills/bundled/dex/index.d.ts +36 -0
  50. package/dist/skills/bundled/dex/index.js +537 -0
  51. package/dist/skills/bundled/dex/index.js.map +1 -0
  52. package/dist/skills/bundled/divergence/SKILL.md +83 -0
  53. package/dist/skills/bundled/doctor/SKILL.md +267 -0
  54. package/dist/skills/bundled/doctor/index.js +2 -8
  55. package/dist/skills/bundled/doctor/index.js.map +1 -1
  56. package/dist/skills/bundled/drift/SKILL.md +53 -0
  57. package/dist/skills/bundled/drift-sdk/SKILL.md +103 -0
  58. package/dist/skills/bundled/drift-sdk/index.d.ts +0 -3
  59. package/dist/skills/bundled/drift-sdk/index.js +0 -1
  60. package/dist/skills/bundled/drift-sdk/index.js.map +1 -1
  61. package/dist/skills/bundled/edge/SKILL.md +84 -0
  62. package/dist/skills/bundled/embeddings/SKILL.md +244 -0
  63. package/dist/skills/bundled/endaoment/SKILL.md +65 -0
  64. package/dist/skills/bundled/endaoment/index.d.ts +0 -3
  65. package/dist/skills/bundled/endaoment/index.js +0 -1
  66. package/dist/skills/bundled/endaoment/index.js.map +1 -1
  67. package/dist/skills/bundled/ens/SKILL.md +63 -0
  68. package/dist/skills/bundled/ens/index.d.ts +0 -3
  69. package/dist/skills/bundled/ens/index.js +0 -1
  70. package/dist/skills/bundled/ens/index.js.map +1 -1
  71. package/dist/skills/bundled/erc8004/SKILL.md +79 -0
  72. package/dist/skills/bundled/erc8004/index.d.ts +0 -3
  73. package/dist/skills/bundled/erc8004/index.js +0 -1
  74. package/dist/skills/bundled/erc8004/index.js.map +1 -1
  75. package/dist/skills/bundled/execution/SKILL.md +278 -0
  76. package/dist/skills/bundled/farcaster/SKILL.md +80 -0
  77. package/dist/skills/bundled/features/SKILL.md +20 -0
  78. package/dist/skills/bundled/feeds/SKILL.md +288 -0
  79. package/dist/skills/bundled/harden/SKILL.md +74 -0
  80. package/dist/skills/bundled/history/SKILL.md +257 -0
  81. package/dist/skills/bundled/hyperliquid/SKILL.md +200 -0
  82. package/dist/skills/bundled/hyperliquid/index.d.ts +0 -3
  83. package/dist/skills/bundled/hyperliquid/index.js +0 -1
  84. package/dist/skills/bundled/hyperliquid/index.js.map +1 -1
  85. package/dist/skills/bundled/identity/SKILL.md +228 -0
  86. package/dist/skills/bundled/identity/index.js +2 -2
  87. package/dist/skills/bundled/identity/index.js.map +1 -1
  88. package/dist/skills/bundled/integrations/SKILL.md +321 -0
  89. package/dist/skills/bundled/integrations/index.js +2 -2
  90. package/dist/skills/bundled/integrations/index.js.map +1 -1
  91. package/dist/skills/bundled/jupiter/SKILL.md +163 -0
  92. package/dist/skills/bundled/kamino/SKILL.md +69 -0
  93. package/dist/skills/bundled/ledger/SKILL.md +20 -0
  94. package/dist/skills/bundled/lighter/SKILL.md +83 -0
  95. package/dist/skills/bundled/lighter/index.d.ts +0 -3
  96. package/dist/skills/bundled/lighter/index.js +0 -1
  97. package/dist/skills/bundled/lighter/index.js.map +1 -1
  98. package/dist/skills/bundled/marginfi/SKILL.md +62 -0
  99. package/dist/skills/bundled/market-index/SKILL.md +242 -0
  100. package/dist/skills/bundled/market-index/index.js +1 -3
  101. package/dist/skills/bundled/market-index/index.js.map +1 -1
  102. package/dist/skills/bundled/markets/SKILL.md +49 -0
  103. package/dist/skills/bundled/mcp/SKILL.md +235 -0
  104. package/dist/skills/bundled/mcp/index.js +1 -3
  105. package/dist/skills/bundled/mcp/index.js.map +1 -1
  106. package/dist/skills/bundled/memory/SKILL.md +209 -0
  107. package/dist/skills/bundled/metaculus/SKILL.md +62 -0
  108. package/dist/skills/bundled/meteora/SKILL.md +28 -0
  109. package/dist/skills/bundled/meteora-dbc/SKILL.md +25 -0
  110. package/dist/skills/bundled/metrics/SKILL.md +338 -0
  111. package/dist/skills/bundled/mev/SKILL.md +239 -0
  112. package/dist/skills/bundled/mev/index.js +2 -2
  113. package/dist/skills/bundled/mev/index.js.map +1 -1
  114. package/dist/skills/bundled/mexc-futures/SKILL.md +86 -0
  115. package/dist/skills/bundled/mexc-futures/index.d.ts +0 -3
  116. package/dist/skills/bundled/mexc-futures/index.js +0 -1
  117. package/dist/skills/bundled/mexc-futures/index.js.map +1 -1
  118. package/dist/skills/bundled/mm/SKILL.md +142 -0
  119. package/dist/skills/bundled/monitoring/SKILL.md +249 -0
  120. package/dist/skills/bundled/news/SKILL.md +95 -0
  121. package/dist/skills/bundled/onchainkit/SKILL.md +83 -0
  122. package/dist/skills/bundled/opinion/SKILL.md +87 -0
  123. package/dist/skills/bundled/opportunity/SKILL.md +308 -0
  124. package/dist/skills/bundled/orca/SKILL.md +28 -0
  125. package/dist/skills/bundled/pairing/SKILL.md +275 -0
  126. package/dist/skills/bundled/pancakeswap/SKILL.md +93 -0
  127. package/dist/skills/bundled/pancakeswap/index.d.ts +0 -3
  128. package/dist/skills/bundled/pancakeswap/index.js +0 -1
  129. package/dist/skills/bundled/pancakeswap/index.js.map +1 -1
  130. package/dist/skills/bundled/percolator/SKILL.md +22 -0
  131. package/dist/skills/bundled/permissions/SKILL.md +269 -0
  132. package/dist/skills/bundled/permissions/index.js +2 -2
  133. package/dist/skills/bundled/permissions/index.js.map +1 -1
  134. package/dist/skills/bundled/plugins/SKILL.md +263 -0
  135. package/dist/skills/bundled/plugins/index.js +2 -2
  136. package/dist/skills/bundled/plugins/index.js.map +1 -1
  137. package/dist/skills/bundled/portfolio/SKILL.md +161 -0
  138. package/dist/skills/bundled/portfolio/index.js +1 -1
  139. package/dist/skills/bundled/portfolio/index.js.map +1 -1
  140. package/dist/skills/bundled/portfolio-sync/SKILL.md +466 -0
  141. package/dist/skills/bundled/positions/SKILL.md +262 -0
  142. package/dist/skills/bundled/predictfun/SKILL.md +109 -0
  143. package/dist/skills/bundled/predictfun/index.js +1 -1
  144. package/dist/skills/bundled/predictfun/index.js.map +1 -1
  145. package/dist/skills/bundled/predictit/SKILL.md +66 -0
  146. package/dist/skills/bundled/presence/SKILL.md +217 -0
  147. package/dist/skills/bundled/presence/index.js +2 -2
  148. package/dist/skills/bundled/presence/index.js.map +1 -1
  149. package/dist/skills/bundled/processes/SKILL.md +254 -0
  150. package/dist/skills/bundled/pump-swarm/SKILL.md +309 -0
  151. package/dist/skills/bundled/pumpfun/SKILL.md +145 -0
  152. package/dist/skills/bundled/pumpfun/index.d.ts +8 -1
  153. package/dist/skills/bundled/pumpfun/index.js +221 -11
  154. package/dist/skills/bundled/pumpfun/index.js.map +1 -1
  155. package/dist/skills/bundled/qmd/SKILL.md +129 -0
  156. package/dist/skills/bundled/qrcoin/SKILL.md +60 -0
  157. package/dist/skills/bundled/qrcoin/index.d.ts +0 -3
  158. package/dist/skills/bundled/qrcoin/index.js +0 -1
  159. package/dist/skills/bundled/qrcoin/index.js.map +1 -1
  160. package/dist/skills/bundled/raydium/SKILL.md +198 -0
  161. package/dist/skills/bundled/remote/SKILL.md +201 -0
  162. package/dist/skills/bundled/research/SKILL.md +83 -0
  163. package/dist/skills/bundled/research/index.js +2 -2
  164. package/dist/skills/bundled/research/index.js.map +1 -1
  165. package/dist/skills/bundled/risk/SKILL.md +323 -0
  166. package/dist/skills/bundled/router/SKILL.md +233 -0
  167. package/dist/skills/bundled/routing/SKILL.md +258 -0
  168. package/dist/skills/bundled/sandbox/SKILL.md +257 -0
  169. package/dist/skills/bundled/search-config/SKILL.md +257 -0
  170. package/dist/skills/bundled/search-config/index.js +2 -2
  171. package/dist/skills/bundled/search-config/index.js.map +1 -1
  172. package/dist/skills/bundled/sessions/SKILL.md +251 -0
  173. package/dist/skills/bundled/sessions/index.js +1 -1
  174. package/dist/skills/bundled/sessions/index.js.map +1 -1
  175. package/dist/skills/bundled/setup/SKILL.md +53 -0
  176. package/dist/skills/bundled/shield/SKILL.md +21 -0
  177. package/dist/skills/bundled/signals/SKILL.md +106 -0
  178. package/dist/skills/bundled/signals/index.d.ts +0 -3
  179. package/dist/skills/bundled/signals/index.js +3 -4
  180. package/dist/skills/bundled/signals/index.js.map +1 -1
  181. package/dist/skills/bundled/sizing/SKILL.md +238 -0
  182. package/dist/skills/bundled/slippage/SKILL.md +306 -0
  183. package/dist/skills/bundled/smarkets/SKILL.md +107 -0
  184. package/dist/skills/bundled/solend/SKILL.md +63 -0
  185. package/dist/skills/bundled/strategy/SKILL.md +266 -0
  186. package/dist/skills/bundled/streaming/SKILL.md +150 -0
  187. package/dist/skills/bundled/streaming/index.js +2 -2
  188. package/dist/skills/bundled/streaming/index.js.map +1 -1
  189. package/dist/skills/bundled/tailscale/SKILL.md +249 -0
  190. package/dist/skills/bundled/tailscale/index.js +2 -2
  191. package/dist/skills/bundled/tailscale/index.js.map +1 -1
  192. package/dist/skills/bundled/ticks/SKILL.md +61 -0
  193. package/dist/skills/bundled/token-security/SKILL.md +18 -0
  194. package/dist/skills/bundled/trading-evm/SKILL.md +329 -0
  195. package/dist/skills/bundled/trading-futures/SKILL.md +865 -0
  196. package/dist/skills/bundled/trading-kalshi/SKILL.md +629 -0
  197. package/dist/skills/bundled/trading-manifold/SKILL.md +387 -0
  198. package/dist/skills/bundled/trading-polymarket/SKILL.md +1080 -0
  199. package/dist/skills/bundled/trading-solana/SKILL.md +418 -0
  200. package/dist/skills/bundled/trading-system/SKILL.md +290 -0
  201. package/dist/skills/bundled/triggers/SKILL.md +433 -0
  202. package/dist/skills/bundled/tts/SKILL.md +220 -0
  203. package/dist/skills/bundled/tweet-ideas/SKILL.md +77 -0
  204. package/dist/skills/bundled/usage/SKILL.md +239 -0
  205. package/dist/skills/bundled/usage/index.js +2 -2
  206. package/dist/skills/bundled/usage/index.js.map +1 -1
  207. package/dist/skills/bundled/veil/SKILL.md +76 -0
  208. package/dist/skills/bundled/veil/index.d.ts +0 -3
  209. package/dist/skills/bundled/veil/index.js +0 -1
  210. package/dist/skills/bundled/veil/index.js.map +1 -1
  211. package/dist/skills/bundled/verify/SKILL.md +199 -0
  212. package/dist/skills/bundled/verify/index.d.ts +0 -3
  213. package/dist/skills/bundled/verify/index.js +0 -1
  214. package/dist/skills/bundled/verify/index.js.map +1 -1
  215. package/dist/skills/bundled/virtuals/SKILL.md +82 -0
  216. package/dist/skills/bundled/voice/SKILL.md +217 -0
  217. package/dist/skills/bundled/voice/index.js +2 -2
  218. package/dist/skills/bundled/voice/index.js.map +1 -1
  219. package/dist/skills/bundled/weather/SKILL.md +80 -0
  220. package/dist/skills/bundled/webhooks/SKILL.md +297 -0
  221. package/dist/skills/bundled/webhooks/index.js +2 -2
  222. package/dist/skills/bundled/webhooks/index.js.map +1 -1
  223. package/dist/skills/bundled/whale-tracking/SKILL.md +287 -0
  224. package/dist/skills/bundled/whale-tracking/index.js +2 -2
  225. package/dist/skills/bundled/whale-tracking/index.js.map +1 -1
  226. package/dist/skills/bundled/yoink/SKILL.md +54 -0
  227. package/dist/skills/bundled/yoink/index.d.ts +0 -3
  228. package/dist/skills/bundled/yoink/index.js +0 -1
  229. package/dist/skills/bundled/yoink/index.js.map +1 -1
  230. package/dist/skills/executor.js +5 -3
  231. package/dist/skills/executor.js.map +1 -1
  232. package/package.json +2 -2
@@ -0,0 +1,418 @@
1
+ ---
2
+ name: trading-solana
3
+ description: "Trade tokens on Solana DEXes - Jupiter, Raydium, Orca, Meteora, Pump.fun"
4
+ emoji: "☀️"
5
+ gates:
6
+ envs:
7
+ - SOLANA_PRIVATE_KEY
8
+ ---
9
+
10
+ # Solana DEX Trading - Complete API Reference
11
+
12
+ Trade any token on Solana using Jupiter aggregator, Raydium, Orca Whirlpools, Meteora DLMM, and Pump.fun.
13
+
14
+ ## Required Environment Variables
15
+
16
+ ```bash
17
+ SOLANA_PRIVATE_KEY=base58_or_json_array # Your Solana wallet private key
18
+ SOLANA_RPC_URL=https://api.mainnet-beta.solana.com # Optional: custom RPC
19
+ ```
20
+
21
+ ---
22
+
23
+ ## Chat Commands
24
+
25
+ ### Swaps
26
+
27
+ ```
28
+ /swap sol <amount> <from> to <to> # Swap tokens on Solana
29
+ /swap sol 1 SOL to USDC # Swap 1 SOL to USDC
30
+ /swap sol 100 USDC to JUP # Swap 100 USDC to JUP
31
+ /swap sol 0.5 SOL to BONK # Swap 0.5 SOL to BONK
32
+ ```
33
+
34
+ ### Quotes
35
+
36
+ ```
37
+ /quote sol <amount> <from> to <to> # Get swap quote without executing
38
+ /quote sol 1 SOL to USDC # Quote 1 SOL → USDC
39
+ ```
40
+
41
+ ### Pool Discovery
42
+
43
+ ```
44
+ /pools sol <token> # List liquidity pools for token
45
+ /pools sol SOL # All SOL pools
46
+ /pools sol BONK # All BONK pools
47
+ ```
48
+
49
+ ### Balances
50
+
51
+ ```
52
+ /balance sol # Check SOL and token balances
53
+ /balance sol <token> # Check specific token balance
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Supported DEXes
59
+
60
+ | DEX | Type | Features |
61
+ |-----|------|----------|
62
+ | Jupiter | Aggregator | Best route across all DEXes, limit orders, DCA |
63
+ | Raydium | AMM | Concentrated liquidity, high volume |
64
+ | Orca | Whirlpool | Concentrated liquidity pools, LP management |
65
+ | Meteora | DLMM | Dynamic liquidity market maker, LP management |
66
+ | Pump.fun | Launchpad | New token launches |
67
+
68
+ ---
69
+
70
+ ## TypeScript API Reference
71
+
72
+ ### Jupiter (Aggregator - Recommended)
73
+
74
+ ```typescript
75
+ import {
76
+ executeJupiterSwap,
77
+ getJupiterQuote,
78
+ createJupiterLimitOrder,
79
+ cancelJupiterLimitOrder,
80
+ listJupiterLimitOrders,
81
+ createJupiterDCA,
82
+ closeJupiterDCA,
83
+ listJupiterDCAs,
84
+ } from 'clodds/solana/jupiter';
85
+
86
+ // Execute swap via Jupiter (best route)
87
+ const result = await executeJupiterSwap(connection, keypair, {
88
+ inputMint: 'So11111111111111111111111111111111111111112', // SOL
89
+ outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
90
+ amount: '1000000000', // 1 SOL in lamports
91
+ slippageBps: 50, // 0.5% slippage
92
+ });
93
+
94
+ console.log(`Swapped: ${result.inAmount} → ${result.outAmount}`);
95
+ console.log(`TX: ${result.signature}`);
96
+ ```
97
+
98
+ #### Jupiter Limit Orders
99
+
100
+ ```typescript
101
+ // Create limit order - sell 1 SOL for minimum 250 USDC
102
+ const order = await createJupiterLimitOrder(connection, keypair, {
103
+ inputMint: 'So11111111111111111111111111111111111111112',
104
+ outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
105
+ inAmount: '1000000000', // 1 SOL
106
+ outAmount: '250000000', // 250 USDC
107
+ expiredAtMs: Date.now() + 7 * 24 * 60 * 60 * 1000, // 1 week expiry
108
+ });
109
+ console.log(`Order created: ${order.orderPubKey}`);
110
+
111
+ // List open orders
112
+ const orders = await listJupiterLimitOrders(connection, keypair.publicKey.toBase58());
113
+ console.log(`Open orders: ${orders.length}`);
114
+
115
+ // Cancel order
116
+ await cancelJupiterLimitOrder(connection, keypair, order.orderPubKey);
117
+ ```
118
+
119
+ #### Jupiter DCA (Dollar Cost Averaging)
120
+
121
+ ```typescript
122
+ // Create DCA - swap 100 USDC to JUP, 10 USDC every hour
123
+ const dca = await createJupiterDCA(connection, keypair, {
124
+ inputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
125
+ outputMint: 'JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN', // JUP
126
+ inAmount: '100000000', // Total 100 USDC
127
+ inAmountPerCycle: '10000000', // 10 USDC per swap
128
+ cycleSecondsApart: 3600, // Every hour (min 30 seconds)
129
+ });
130
+ console.log(`DCA created: ${dca.dcaPubKey}`);
131
+
132
+ // List active DCAs
133
+ const dcas = await listJupiterDCAs(connection, keypair.publicKey.toBase58());
134
+
135
+ // Close DCA and withdraw remaining funds
136
+ await closeJupiterDCA(connection, keypair, dca.dcaPubKey);
137
+ ```
138
+
139
+ ### Raydium
140
+
141
+ ```typescript
142
+ import {
143
+ executeRaydiumSwap,
144
+ getRaydiumQuote,
145
+ listRaydiumPools,
146
+ getClmmPositions,
147
+ createClmmPosition,
148
+ increaseClmmLiquidity,
149
+ decreaseClmmLiquidity,
150
+ closeClmmPosition,
151
+ harvestClmmRewards,
152
+ addAmmLiquidity,
153
+ removeAmmLiquidity,
154
+ } from 'clodds/solana/raydium';
155
+
156
+ // Get quote
157
+ const quote = await getRaydiumQuote({
158
+ inputMint: 'SOL',
159
+ outputMint: 'USDC',
160
+ amount: 1_000_000_000,
161
+ });
162
+ console.log(`Expected output: ${quote.outAmount}`);
163
+
164
+ // Execute swap
165
+ const result = await executeRaydiumSwap(connection, keypair, {
166
+ inputMint: 'So11111111111111111111111111111111111111112',
167
+ outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
168
+ amount: '1000000000',
169
+ slippageBps: 50,
170
+ });
171
+
172
+ // List pools
173
+ const pools = await listRaydiumPools({ tokenMints: ['So11111111111111111111111111111111111111112'] });
174
+
175
+ // CLMM: Open concentrated liquidity position
176
+ const position = await createClmmPosition(connection, keypair, {
177
+ poolId: 'POOL_ID_HERE',
178
+ priceLower: 100,
179
+ priceUpper: 200,
180
+ baseAmount: '1000000000',
181
+ });
182
+
183
+ // CLMM: List positions
184
+ const positions = await getClmmPositions(connection, keypair);
185
+
186
+ // CLMM: Harvest rewards
187
+ const rewards = await harvestClmmRewards(connection, keypair);
188
+
189
+ // AMM: Add liquidity
190
+ await addAmmLiquidity(connection, keypair, {
191
+ poolId: 'AMM_POOL_ID',
192
+ amountA: '1000000000',
193
+ fixedSide: 'a',
194
+ });
195
+ ```
196
+
197
+ ### Orca Whirlpools
198
+
199
+ ```typescript
200
+ import { executeOrcaWhirlpoolSwap, getOrcaWhirlpoolQuote, listOrcaWhirlpoolPools } from 'clodds/solana/orca';
201
+
202
+ // Get quote
203
+ const quote = await getOrcaWhirlpoolQuote({
204
+ inputMint: 'SOL',
205
+ outputMint: 'USDC',
206
+ amount: 1_000_000_000,
207
+ });
208
+
209
+ // Execute swap
210
+ const result = await executeOrcaWhirlpoolSwap({
211
+ inputMint: 'SOL',
212
+ outputMint: 'USDC',
213
+ amount: 1_000_000_000,
214
+ slippage: 0.5,
215
+ });
216
+
217
+ // List pools
218
+ const pools = await listOrcaWhirlpoolPools({ token: 'SOL' });
219
+ ```
220
+
221
+ ### Meteora DLMM
222
+
223
+ ```typescript
224
+ import { executeMeteoraDlmmSwap, getMeteoraDlmmQuote, listMeteoraDlmmPools } from 'clodds/solana/meteora';
225
+
226
+ // Get quote
227
+ const quote = await getMeteoraDlmmQuote({
228
+ inputMint: 'SOL',
229
+ outputMint: 'USDC',
230
+ amount: 1_000_000_000,
231
+ });
232
+
233
+ // Execute swap
234
+ const result = await executeMeteoraDlmmSwap({
235
+ inputMint: 'SOL',
236
+ outputMint: 'USDC',
237
+ amount: 1_000_000_000,
238
+ slippage: 0.5,
239
+ });
240
+
241
+ // List pools
242
+ const pools = await listMeteoraDlmmPools({ token: 'SOL' });
243
+ ```
244
+
245
+ ### Pump.fun
246
+
247
+ ```typescript
248
+ import {
249
+ executePumpFunTrade,
250
+ getBondingCurveState,
251
+ getTokenPriceInfo,
252
+ calculateBuyQuote,
253
+ calculateSellQuote,
254
+ isGraduated,
255
+ getTokenInfo,
256
+ getPumpPortalQuote,
257
+ } from 'clodds/solana/pumpapi';
258
+
259
+ // Buy token on Pump.fun
260
+ const result = await executePumpFunTrade(connection, keypair, {
261
+ mint: 'token_mint_address',
262
+ action: 'buy',
263
+ amount: 0.1, // SOL amount
264
+ denominatedInSol: true,
265
+ slippageBps: 500, // 5% slippage for volatile tokens
266
+ });
267
+
268
+ // Sell token
269
+ const result = await executePumpFunTrade(connection, keypair, {
270
+ mint: 'token_mint_address',
271
+ action: 'sell',
272
+ amount: 1000000, // Token amount
273
+ denominatedInSol: false,
274
+ slippageBps: 500,
275
+ });
276
+ ```
277
+
278
+ #### On-Chain Bonding Curve
279
+
280
+ ```typescript
281
+ import BN from 'bn.js';
282
+
283
+ // Get bonding curve state directly from chain
284
+ const state = await getBondingCurveState(connection, 'token_mint');
285
+ if (state) {
286
+ console.log(`Virtual SOL: ${state.virtualSolReserves.toString()}`);
287
+ console.log(`Virtual Tokens: ${state.virtualTokenReserves.toString()}`);
288
+ console.log(`Graduated: ${state.complete}`);
289
+ }
290
+
291
+ // Get comprehensive price info
292
+ const priceInfo = await getTokenPriceInfo(connection, 'token_mint', 200); // 200 = SOL price USD
293
+ console.log(`Price: ${priceInfo.priceInSol} SOL ($${priceInfo.priceInUsd})`);
294
+ console.log(`Market Cap: $${priceInfo.marketCapUsd}`);
295
+ console.log(`Bonding Progress: ${(priceInfo.bondingProgress * 100).toFixed(1)}%`);
296
+
297
+ // Calculate buy quote with price impact
298
+ const solAmount = new BN(0.5 * 1e9); // 0.5 SOL in lamports
299
+ const buyQuote = calculateBuyQuote(state, solAmount, 100); // 1% fee
300
+ console.log(`Tokens out: ${buyQuote.tokensOut.toNumber() / 1e6}`);
301
+ console.log(`Price impact: ${buyQuote.priceImpact.toFixed(2)}%`);
302
+
303
+ // Calculate sell quote
304
+ const tokenAmount = new BN(1000000 * 1e6); // 1M tokens
305
+ const sellQuote = calculateSellQuote(state, tokenAmount, 100);
306
+ console.log(`SOL out: ${sellQuote.solOut.toNumber() / 1e9}`);
307
+
308
+ // Check if token graduated to Raydium
309
+ const graduation = await isGraduated(connection, 'token_mint');
310
+ if (graduation.graduated) {
311
+ console.log(`Raydium pool: ${graduation.raydiumPool}`);
312
+ }
313
+ ```
314
+
315
+ #### PumpPortal Quote API
316
+
317
+ ```typescript
318
+ // Get quote from PumpPortal (supports pump and raydium pools)
319
+ const quote = await getPumpPortalQuote({
320
+ mint: 'token_mint',
321
+ action: 'buy',
322
+ amount: '0.5', // 0.5 SOL
323
+ pool: 'auto', // pump, raydium, or auto
324
+ });
325
+ console.log(`Input: ${quote.inputAmount}, Output: ${quote.outputAmount}`);
326
+ ```
327
+
328
+ ### Token Resolution
329
+
330
+ ```typescript
331
+ import { resolveTokenMints, getTokenList } from 'clodds/solana/tokenlist';
332
+
333
+ // Resolve token symbols to mint addresses
334
+ const mints = await resolveTokenMints(['SOL', 'USDC', 'JUP', 'BONK']);
335
+ // ['So111...', 'EPjF...', '...', '...']
336
+
337
+ // Get full token list
338
+ const tokens = await getTokenList();
339
+ ```
340
+
341
+ ### Pool Discovery
342
+
343
+ ```typescript
344
+ import { listAllPools, selectBestPool } from 'clodds/solana/pools';
345
+
346
+ // List all pools for a token pair
347
+ const pools = await listAllPools({
348
+ inputMint: 'SOL',
349
+ outputMint: 'USDC',
350
+ });
351
+
352
+ // Select best pool based on liquidity
353
+ const best = await selectBestPool({
354
+ inputMint: 'SOL',
355
+ outputMint: 'USDC',
356
+ amount: 1_000_000_000,
357
+ });
358
+ ```
359
+
360
+ ### Wallet Utilities
361
+
362
+ ```typescript
363
+ import { loadSolanaKeypair, getSolanaConnection, signAndSendTransaction } from 'clodds/solana/wallet';
364
+
365
+ // Load keypair from env
366
+ const keypair = loadSolanaKeypair();
367
+
368
+ // Get connection
369
+ const connection = getSolanaConnection();
370
+
371
+ // Sign and send transaction
372
+ const signature = await signAndSendTransaction(connection, transaction, keypair);
373
+ ```
374
+
375
+ ---
376
+
377
+ ## Token Symbols
378
+
379
+ Common token symbols that can be used:
380
+
381
+ | Symbol | Name | Mint Address |
382
+ |--------|------|--------------|
383
+ | SOL | Solana | So11111111111111111111111111111111111111112 |
384
+ | USDC | USD Coin | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
385
+ | USDT | Tether | Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB |
386
+ | JUP | Jupiter | JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN |
387
+ | BONK | Bonk | DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263 |
388
+ | WIF | dogwifhat | EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm |
389
+ | PYTH | Pyth | HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3 |
390
+
391
+ ---
392
+
393
+ ## Slippage Settings
394
+
395
+ | Token Type | Recommended Slippage |
396
+ |------------|---------------------|
397
+ | Major (SOL, USDC) | 0.5% |
398
+ | Mid-cap | 1-2% |
399
+ | Small-cap / Meme | 3-5% |
400
+ | New launches | 5-10% |
401
+
402
+ ---
403
+
404
+ ## Error Handling
405
+
406
+ ```typescript
407
+ import { SolanaSwapError, InsufficientBalanceError, SlippageExceededError } from 'clodds/solana';
408
+
409
+ try {
410
+ await executeJupiterSwap({ ... });
411
+ } catch (error) {
412
+ if (error instanceof InsufficientBalanceError) {
413
+ console.log('Not enough balance');
414
+ } else if (error instanceof SlippageExceededError) {
415
+ console.log('Price moved too much, increase slippage');
416
+ }
417
+ }
418
+ ```
@@ -0,0 +1,290 @@
1
+ ---
2
+ name: trading-system
3
+ description: "Unified trading system with auto-logging, bots, and performance analytics"
4
+ emoji: "🤖"
5
+ gates:
6
+ envs:
7
+ anyOf:
8
+ - POLY_API_KEY
9
+ - KALSHI_API_KEY
10
+ ---
11
+
12
+ # Trading System - Complete API Reference
13
+
14
+ Unified trading system with auto-logging to SQLite, bot management, and performance analytics.
15
+
16
+ ---
17
+
18
+ ## Chat Commands
19
+
20
+ ### Portfolio
21
+
22
+ ```
23
+ /trading portfolio # View all positions
24
+ /trading portfolio poly # Positions on Polymarket
25
+ /trading portfolio --value # Include current values
26
+ ```
27
+
28
+ ### Performance
29
+
30
+ ```
31
+ /trading stats # Overall statistics
32
+ /trading stats --period 30d # Last 30 days
33
+ /trading daily-pnl # Daily P&L breakdown
34
+ /trading weekly-pnl # Weekly P&L
35
+ /trading monthly-pnl # Monthly P&L
36
+ ```
37
+
38
+ ### Trade History
39
+
40
+ ```
41
+ /trading history # Recent trades
42
+ /trading history --limit 50 # Last 50 trades
43
+ /trading history --platform poly # Polymarket only
44
+ /trading export # Export to CSV
45
+ /trading export --format json # Export as JSON
46
+ ```
47
+
48
+ ### Bot Management
49
+
50
+ ```
51
+ /bot list # List all bots
52
+ /bot register <name> <strategy> # Register new bot
53
+ /bot start <name> # Start bot
54
+ /bot stop <name> # Stop bot
55
+ /bot status <name> # Bot status
56
+ /bot delete <name> # Delete bot
57
+ ```
58
+
59
+ ### Bot Strategies
60
+
61
+ ```
62
+ /bot strategies # List available strategies
63
+ /bot create mean-reversion --config {...} # Create with config
64
+ /bot create momentum --lookback 14 # Momentum strategy
65
+ /bot create arbitrage --min-spread 1 # Arbitrage strategy
66
+ ```
67
+
68
+ ---
69
+
70
+ ## TypeScript API Reference
71
+
72
+ ### Create Trading System
73
+
74
+ ```typescript
75
+ import { createTradingSystem } from 'clodds/trading';
76
+
77
+ const trading = createTradingSystem({
78
+ // Execution service
79
+ execution: executionService,
80
+
81
+ // Auto-logging
82
+ autoLog: true,
83
+ logPath: './trades.db',
84
+
85
+ // Bot configuration
86
+ bots: {
87
+ enabled: true,
88
+ maxConcurrent: 5,
89
+ },
90
+ });
91
+ ```
92
+
93
+ ### Portfolio
94
+
95
+ ```typescript
96
+ // Get portfolio
97
+ const portfolio = await trading.getPortfolio();
98
+
99
+ console.log(`Total value: $${portfolio.totalValue.toLocaleString()}`);
100
+ console.log(`Unrealized P&L: $${portfolio.unrealizedPnl.toLocaleString()}`);
101
+
102
+ for (const position of portfolio.positions) {
103
+ console.log(`[${position.platform}] ${position.market}`);
104
+ console.log(` Side: ${position.side}`);
105
+ console.log(` Size: ${position.size}`);
106
+ console.log(` Avg price: ${position.avgPrice}`);
107
+ console.log(` Current: ${position.currentPrice}`);
108
+ console.log(` P&L: $${position.unrealizedPnl.toFixed(2)}`);
109
+ }
110
+ ```
111
+
112
+ ### Statistics
113
+
114
+ ```typescript
115
+ // Get trading statistics
116
+ const stats = await trading.getStats({ period: '30d' });
117
+
118
+ console.log(`Total trades: ${stats.totalTrades}`);
119
+ console.log(`Win rate: ${(stats.winRate * 100).toFixed(1)}%`);
120
+ console.log(`Profit factor: ${stats.profitFactor.toFixed(2)}`);
121
+ console.log(`Total P&L: $${stats.totalPnl.toLocaleString()}`);
122
+ console.log(`Avg trade: $${stats.avgTrade.toFixed(2)}`);
123
+ console.log(`Largest win: $${stats.largestWin.toFixed(2)}`);
124
+ console.log(`Largest loss: $${stats.largestLoss.toFixed(2)}`);
125
+ console.log(`Sharpe ratio: ${stats.sharpeRatio.toFixed(2)}`);
126
+ console.log(`Max drawdown: ${(stats.maxDrawdown * 100).toFixed(1)}%`);
127
+ ```
128
+
129
+ ### Daily P&L
130
+
131
+ ```typescript
132
+ // Get daily P&L
133
+ const dailyPnl = await trading.getDailyPnL({ days: 30 });
134
+
135
+ for (const day of dailyPnl) {
136
+ const sign = day.pnl >= 0 ? '+' : '';
137
+ console.log(`${day.date}: ${sign}$${day.pnl.toFixed(2)} (${day.trades} trades)`);
138
+ }
139
+ ```
140
+
141
+ ### Export Trades
142
+
143
+ ```typescript
144
+ // Export to CSV
145
+ await trading.exportTrades({
146
+ format: 'csv',
147
+ path: './trades.csv',
148
+ from: '2024-01-01',
149
+ to: '2024-12-31',
150
+ });
151
+
152
+ // Export to JSON
153
+ const trades = await trading.exportTrades({
154
+ format: 'json',
155
+ from: '2024-01-01',
156
+ });
157
+ ```
158
+
159
+ ### Bot Management
160
+
161
+ ```typescript
162
+ // List bots
163
+ const bots = trading.bots.list();
164
+
165
+ // Register a bot
166
+ await trading.bots.register({
167
+ name: 'my-arb-bot',
168
+ strategy: 'arbitrage',
169
+ config: {
170
+ minSpread: 1,
171
+ maxPositionSize: 500,
172
+ platforms: ['polymarket', 'kalshi'],
173
+ },
174
+ });
175
+
176
+ // Start bot
177
+ await trading.bots.start('my-arb-bot');
178
+
179
+ // Get status
180
+ const status = trading.bots.getStatus('my-arb-bot');
181
+ console.log(`Running: ${status.isRunning}`);
182
+ console.log(`Trades today: ${status.tradesToday}`);
183
+ console.log(`P&L today: $${status.pnlToday}`);
184
+
185
+ // Stop bot
186
+ await trading.bots.stop('my-arb-bot');
187
+
188
+ // Delete bot
189
+ await trading.bots.delete('my-arb-bot');
190
+ ```
191
+
192
+ ### Built-in Strategies
193
+
194
+ ```typescript
195
+ // Mean Reversion
196
+ await trading.bots.register({
197
+ name: 'mean-rev',
198
+ strategy: 'mean-reversion',
199
+ config: {
200
+ lookbackPeriod: 20,
201
+ deviationThreshold: 2,
202
+ positionSize: 100,
203
+ },
204
+ });
205
+
206
+ // Momentum
207
+ await trading.bots.register({
208
+ name: 'momentum',
209
+ strategy: 'momentum',
210
+ config: {
211
+ lookbackPeriod: 14,
212
+ entryThreshold: 0.6,
213
+ exitThreshold: 0.4,
214
+ positionSize: 100,
215
+ },
216
+ });
217
+
218
+ // Arbitrage
219
+ await trading.bots.register({
220
+ name: 'arb',
221
+ strategy: 'arbitrage',
222
+ config: {
223
+ minSpread: 1,
224
+ minLiquidity: 500,
225
+ maxPositionSize: 1000,
226
+ },
227
+ });
228
+ ```
229
+
230
+ ### Custom Strategy
231
+
232
+ ```typescript
233
+ // Register custom strategy
234
+ trading.bots.registerStrategy('my-strategy', {
235
+ init: async (ctx) => {
236
+ // Initialize state
237
+ },
238
+
239
+ evaluate: async (ctx) => {
240
+ // Return signals
241
+ return [
242
+ {
243
+ platform: 'polymarket',
244
+ marketId: 'market-123',
245
+ action: 'buy',
246
+ side: 'YES',
247
+ size: 100,
248
+ reason: 'Signal triggered',
249
+ },
250
+ ];
251
+ },
252
+
253
+ onTrade: (trade) => {
254
+ console.log(`Trade executed: ${trade.orderId}`);
255
+ },
256
+
257
+ cleanup: async () => {
258
+ // Cleanup
259
+ },
260
+ });
261
+ ```
262
+
263
+ ---
264
+
265
+ ## Auto-Logging
266
+
267
+ All trades are automatically logged to SQLite:
268
+
269
+ ```sql
270
+ -- trades table
271
+ SELECT * FROM trades
272
+ WHERE platform = 'polymarket'
273
+ ORDER BY timestamp DESC
274
+ LIMIT 10;
275
+
276
+ -- Get win rate
277
+ SELECT
278
+ COUNT(CASE WHEN pnl > 0 THEN 1 END) * 100.0 / COUNT(*) as win_rate
279
+ FROM trades;
280
+ ```
281
+
282
+ ---
283
+
284
+ ## Best Practices
285
+
286
+ 1. **Start with paper trading** - Use dry-run mode first
287
+ 2. **Set position limits** - Prevent overexposure
288
+ 3. **Monitor bots regularly** - Don't set and forget
289
+ 4. **Review performance weekly** - Adjust strategies
290
+ 5. **Export data regularly** - Backup your trade history