@quantish/agent 0.1.13 → 0.1.14
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/index.js +40 -44
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2661,83 +2661,79 @@ function extractTokenInfo(token) {
|
|
|
2661
2661
|
price: token.price ?? token.probability
|
|
2662
2662
|
};
|
|
2663
2663
|
}
|
|
2664
|
-
var DEFAULT_SYSTEM_PROMPT = `You are Quantish, an AI coding and trading agent.
|
|
2664
|
+
var DEFAULT_SYSTEM_PROMPT = `You are Quantish, an AI coding and trading agent. Be concise.
|
|
2665
2665
|
|
|
2666
|
-
|
|
2667
|
-
- Be concise. No emojis. No verbose explanations. Just code and brief descriptions.
|
|
2668
|
-
- When debugging, check logs FIRST before restarting servers.
|
|
2669
|
-
- If API returns found > 0, there ARE results. Read and use them.
|
|
2666
|
+
## APIs
|
|
2670
2667
|
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
TRADING API (requires QUANTISH_API_KEY):
|
|
2668
|
+
TRADING (requires QUANTISH_API_KEY):
|
|
2674
2669
|
- URL: https://quantish-sdk-production.up.railway.app/mcp/execute
|
|
2675
|
-
- Format: JSON-RPC 2.0
|
|
2670
|
+
- Format: JSON-RPC 2.0 { jsonrpc: '2.0', method: 'tools/call', params: { name, arguments }, id }
|
|
2676
2671
|
- Tools: get_balances, get_positions, place_order, cancel_order, get_orders, get_orderbook, get_price
|
|
2677
2672
|
|
|
2678
|
-
DISCOVERY
|
|
2673
|
+
DISCOVERY (free):
|
|
2679
2674
|
- URL: https://quantish.live/mcp/execute
|
|
2680
|
-
- Format:
|
|
2675
|
+
- Format: { name, arguments }
|
|
2681
2676
|
- Key: qm_ueQeqrmvZyHtR1zuVbLYkhx0fKyVAuV8
|
|
2682
2677
|
- Tools: search_markets, get_market_details, get_trending_markets
|
|
2683
2678
|
|
|
2684
|
-
##
|
|
2679
|
+
## Response Structures (IMPORTANT - use these field paths)
|
|
2680
|
+
|
|
2681
|
+
search_markets / get_trending_markets returns:
|
|
2682
|
+
{
|
|
2683
|
+
"found": N,
|
|
2684
|
+
"markets": [{ "platform", "id", "title", "markets": [{ "marketId", "question", "outcomes": [{ "name", "price" }], "clobTokenIds": "[json_array]", "conditionId" }] }]
|
|
2685
|
+
}
|
|
2685
2686
|
|
|
2686
|
-
|
|
2687
|
+
get_market_details returns:
|
|
2687
2688
|
{
|
|
2688
|
-
"
|
|
2689
|
+
"platform": "polymarket",
|
|
2690
|
+
"id": "12345",
|
|
2691
|
+
"conditionId": "0x...",
|
|
2692
|
+
"title": "Market Title",
|
|
2693
|
+
"clobTokenIds": "["TOKEN_YES","TOKEN_NO"]",
|
|
2689
2694
|
"markets": [{
|
|
2690
|
-
"
|
|
2691
|
-
"
|
|
2692
|
-
"
|
|
2693
|
-
"
|
|
2694
|
-
"marketId": "67890",
|
|
2695
|
-
"question": "Bitcoin Up or Down?",
|
|
2696
|
-
"outcomes": [
|
|
2697
|
-
{ "name": "Up", "price": 0.52 },
|
|
2698
|
-
{ "name": "Down", "price": 0.48 }
|
|
2699
|
-
],
|
|
2700
|
-
"clobTokenIds": "["TOKEN_ID_YES", "TOKEN_ID_NO"]",
|
|
2701
|
-
"conditionId": "0xabc..."
|
|
2702
|
-
}]
|
|
2695
|
+
"marketId": "67890",
|
|
2696
|
+
"question": "Question?",
|
|
2697
|
+
"outcomes": [{ "name": "Yes", "price": 0.55 }, { "name": "No", "price": 0.45 }],
|
|
2698
|
+
"clobTokenIds": "["TOKEN_YES","TOKEN_NO"]"
|
|
2703
2699
|
}]
|
|
2704
2700
|
}
|
|
2705
2701
|
|
|
2706
|
-
|
|
2707
|
-
|
|
2702
|
+
KEY FIELDS:
|
|
2703
|
+
- market.id = top-level ID for get_market_details
|
|
2704
|
+
- market.markets[0].marketId = sub-market ID
|
|
2705
|
+
- market.markets[0].outcomes[].name = "Yes"/"No" or outcome name
|
|
2706
|
+
- market.markets[0].outcomes[].price = decimal 0-1
|
|
2707
|
+
- JSON.parse(market.clobTokenIds || market.markets[0].clobTokenIds) = token IDs array
|
|
2708
|
+
- market.conditionId = condition ID for trading
|
|
2708
2709
|
|
|
2709
|
-
##
|
|
2710
|
+
## Standalone App Code
|
|
2710
2711
|
|
|
2711
|
-
Trading:
|
|
2712
|
+
Trading helper:
|
|
2712
2713
|
async function callTradingTool(name, args = {}) {
|
|
2713
2714
|
const res = await fetch('https://quantish-sdk-production.up.railway.app/mcp/execute', {
|
|
2714
2715
|
method: 'POST',
|
|
2715
2716
|
headers: { 'Content-Type': 'application/json', 'x-api-key': process.env.QUANTISH_API_KEY },
|
|
2716
2717
|
body: JSON.stringify({ jsonrpc: '2.0', method: 'tools/call', params: { name, arguments: args }, id: Date.now() })
|
|
2717
2718
|
});
|
|
2718
|
-
|
|
2719
|
-
return JSON.parse(data.result.content[0].text);
|
|
2719
|
+
return JSON.parse((await res.json()).result.content[0].text);
|
|
2720
2720
|
}
|
|
2721
2721
|
|
|
2722
|
-
Discovery:
|
|
2722
|
+
Discovery helper:
|
|
2723
2723
|
async function callDiscoveryTool(name, args = {}) {
|
|
2724
2724
|
const res = await fetch('https://quantish.live/mcp/execute', {
|
|
2725
2725
|
method: 'POST',
|
|
2726
2726
|
headers: { 'Content-Type': 'application/json', 'X-API-Key': 'qm_ueQeqrmvZyHtR1zuVbLYkhx0fKyVAuV8' },
|
|
2727
2727
|
body: JSON.stringify({ name, arguments: args })
|
|
2728
2728
|
});
|
|
2729
|
-
|
|
2730
|
-
return JSON.parse(data.result.content[0].text);
|
|
2729
|
+
return JSON.parse((await res.json()).result.content[0].text);
|
|
2731
2730
|
}
|
|
2732
2731
|
|
|
2733
2732
|
## Rules
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
4. Never hardcode prices or mock data
|
|
2739
|
-
5. If found > 0, markets exist - use them
|
|
2740
|
-
6. Debug by reading logs, not by restarting servers repeatedly`;
|
|
2733
|
+
1. Never use @modelcontextprotocol/sdk - use fetch()
|
|
2734
|
+
2. Always create .env.example and use dotenv
|
|
2735
|
+
3. Never hardcode/mock data - always fetch real data
|
|
2736
|
+
4. Check logs before restarting servers`;
|
|
2741
2737
|
var Agent = class {
|
|
2742
2738
|
anthropic;
|
|
2743
2739
|
mcpClient;
|
|
@@ -2838,7 +2834,7 @@ var Agent = class {
|
|
|
2838
2834
|
* @param options - Optional configuration including abort signal
|
|
2839
2835
|
*/
|
|
2840
2836
|
async run(userMessage, options) {
|
|
2841
|
-
const maxIterations = this.config.maxIterations ??
|
|
2837
|
+
const maxIterations = this.config.maxIterations ?? 200;
|
|
2842
2838
|
const model = this.config.model ?? "claude-sonnet-4-5-20250929";
|
|
2843
2839
|
const maxTokens = this.config.maxTokens ?? 8192;
|
|
2844
2840
|
const systemPrompt = this.config.systemPrompt ?? DEFAULT_SYSTEM_PROMPT;
|