Building Applications
The real power of Quantish Agent is combining coding tools with trading tools to build any application that interacts with prediction markets. Trading bots, web dashboards, mobile backends, notification services, analytics tools, Discord bots, and more.
What You Can Build
🤖 Trading Bots
Automated trading based on price thresholds, trends, or external signals.
📊 Web Dashboards
React/Next.js apps displaying market data, portfolio, and analytics.
🔔 Alert Systems
Notifications via email, SMS, Discord, Telegram when prices move.
📱 Mobile Backends
API servers that power iOS/Android prediction market apps.
📈 Analytics Tools
Scripts that analyze historical prices, trends, and patterns.
💹 Arbitrage Scanners
Tools that find price discrepancies across platforms.
The MCP API
All applications use the Quantish MCP API. There are two endpoints:
POST https://quantish-sdk-production.up.railway.app/mcp/execute
Header: x-api-key: YOUR_QUANTISH_API_KEY
Used for: balances, positions, orders, trading
POST https://quantish.live/mcp/execute
Header: X-API-Key: qm_ueQeqrmvZyHtR1zuVbLYkhx0fKyVAuV8
Used for: searching markets, trending data, arbitrage scanning
Universal Code Template
Every application you build should start with this template:
#!/usr/bin/env node
require('dotenv').config();
// ============================================
// MCP Configuration
// ============================================
const TRADING_MCP_URL = 'https://quantish-sdk-production.up.railway.app/mcp/execute';
const DISCOVERY_MCP_URL = 'https://quantish.live/mcp/execute';
const DISCOVERY_API_KEY = 'qm_ueQeqrmvZyHtR1zuVbLYkhx0fKyVAuV8';
// Validate API key
if (!process.env.QUANTISH_API_KEY) {
console.error('ERROR: QUANTISH_API_KEY required');
console.error('Get your key at: https://quantish.live');
process.exit(1);
}
// ============================================
// MCP Helper Functions
// ============================================
async function callTradingTool(name, args = {}) {
const response = await fetch(TRADING_MCP_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.QUANTISH_API_KEY
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'tools/call',
params: { name, arguments: args },
id: Date.now()
})
});
const data = await response.json();
if (data.error) throw new Error(data.error.message);
try {
return JSON.parse(data.result.content[0].text);
} catch {
return data.result.content[0].text;
}
}
async function callDiscoveryTool(name, args = {}) {
// Discovery MCP uses simpler format (not JSON-RPC)
const response = await fetch(DISCOVERY_MCP_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': DISCOVERY_API_KEY
},
body: JSON.stringify({ name, arguments: args })
});
const data = await response.json();
if (data.error) throw new Error(data.error.message);
try {
return JSON.parse(data.result.content[0].text);
} catch {
return data.result.content[0].text;
}
}
// ============================================
// Your Application Code
// ============================================
async function main() {
// Your code here...
}
main().catch(console.error);
Example: Ask the Agent
Example: Web Dashboard
Example: Trading Bot
Automated trading carries risk. Test with small amounts first. The agent helps you build the code - you're responsible for the trading decisions.
Available Tools
Trading Tools (require API key)
get_balances- Wallet balances (USDC, MATIC)get_positions- Current share holdingsplace_order- Place buy/sell orderscancel_order- Cancel open ordersget_orders- List orders by statusget_orderbook- Bids and asksget_price- Midpoint price for a tokentransfer_usdc- Send USDC to another address
Discovery Tools (free)
search_markets- Find markets by keywordget_market_details- Full market infoget_trending_markets- Popular marketsfind_arbitrage- Price discrepancies
Best Practices
🔐 Environment Variables
Never hardcode API keys. Always use process.env and .env files.
📁 .env.example
Always create a template so others know what variables are needed.
🔒 Error Handling
Wrap all API calls in try/catch. Network errors happen.
⏱️ Rate Limiting
Don't poll too frequently. 30-60 second intervals are sufficient.