| name | triggers |
| description | Conditional orders that auto-execute when price thresholds are met |
| emoji | ⚡ |
Triggers - Complete API Reference
Set up conditional orders that automatically execute trades when price conditions are met. Works across prediction markets, futures, and crypto spot.
Chat Commands
Create Trigger Orders
/trigger buy poly "Trump 2028" YES below 0.40 size 100
/trigger buy poly "Fed rate" NO above 0.60 size 50
/trigger sell poly "Trump 2028" YES above 0.55 size all
Futures Triggers
/trigger long binance BTCUSDT below 95000 size 0.1 leverage 10x
/trigger short binance ETHUSDT above 4000 size 1 leverage 20x
/trigger close binance BTCUSDT above 105000
Crypto Spot Triggers
/trigger buy sol SOL below 180 size 100usdc
/trigger sell eth ETH above 4000 size 0.5
/trigger swap arb USDC to ARB below 1.50 size 500
Manage Triggers
/triggers List all active triggers
/triggers pending Show pending only
/triggers history Triggered order history
/trigger cancel <id> Cancel trigger
/trigger cancel all Cancel all triggers
Stop-Loss & Take-Profit
/sl poly "Trump" at 0.35 Stop-loss on position
/tp poly "Trump" at 0.65 Take-profit on position
/trailing-stop poly "Trump" 10% Trailing stop (% from high)
TypeScript API Reference
Create Trigger Service
import { createTriggerService } from 'clodds/triggers';
const triggers = createTriggerService({
checkIntervalMs: 5000,
maxSlippagePercent: 2,
retryAttempts: 3,
storage: 'sqlite',
dbPath: './triggers.db',
});
await triggers.start();
Create Prediction Market Trigger
const trigger = await triggers.create({
type: 'entry',
platform: 'polymarket',
market: 'will-trump-win-2028',
side: 'YES',
direction: 'below',
triggerPrice: 0.40,
size: 100,
orderType: 'limit',
limitPrice: 0.41,
});
console.log(`Trigger ID: ${trigger.id}`);
console.log(`Status: ${trigger.status}`);
await triggers.create({
type: 'exit',
platform: 'polymarket',
market: 'will-trump-win-2028',
side: 'YES',
direction: 'above',
triggerPrice: 0.55,
size: 'all',
});
Create Futures Trigger
await triggers.create({
type: 'entry',
platform: 'binance',
symbol: 'BTCUSDT',
side: 'long',
direction: 'below',
triggerPrice: 95000,
size: 0.1,
leverage: 10,
stopLoss: 93000,
takeProfit: 105000,
});
await triggers.create({
type: 'entry',
platform: 'bybit',
symbol: 'ETHUSDT',
side: 'short',
direction: 'above',
triggerPrice: 4000,
size: 1,
leverage: 20,
});
await triggers.create({
type: 'exit',
platform: 'binance',
symbol: 'BTCUSDT',
direction: 'above',
triggerPrice: 105000,
size: 'all',
});
Create Crypto Spot Trigger
await triggers.create({
type: 'entry',
platform: 'jupiter',
tokenIn: 'USDC',
tokenOut: 'SOL',
direction: 'below',
triggerPrice: 180,
size: 100,
slippagePercent: 1,
});
await triggers.create({
type: 'exit',
platform: 'uniswap',
chain: 'ethereum',
tokenIn: 'ETH',
tokenOut: 'USDC',
direction: 'above',
triggerPrice: 4000,
size: 0.5,
});
Stop-Loss & Take-Profit
await triggers.setStopLoss({
platform: 'polymarket',
market: 'will-trump-win-2028',
side: 'YES',
triggerPrice: 0.35,
size: 'all',
});
await triggers.setTakeProfit({
platform: 'polymarket',
market: 'will-trump-win-2028',
side: 'YES',
triggerPrice: 0.65,
size: 'all',
});
await triggers.setTrailingStop({
platform: 'polymarket',
market: 'will-trump-win-2028',
side: 'YES',
trailPercent: 10,
size: 'all',
});
Multi-Condition Triggers
await triggers.create({
type: 'entry',
platform: 'polymarket',
market: 'will-trump-win-2028',
side: 'YES',
conditions: [
{ type: 'price', direction: 'below', value: 0.40 },
{ type: 'volume24h', direction: 'above', value: 100000 },
{ type: 'spread', direction: 'below', value: 0.02 },
],
conditionLogic: 'AND',
size: 100,
});
One-Cancels-Other (OCO)
const oco = await triggers.createOCO({
platform: 'binance',
symbol: 'BTCUSDT',
stopLoss: {
direction: 'below',
triggerPrice: 93000,
size: 'all',
},
takeProfit: {
direction: 'above',
triggerPrice: 105000,
size: 'all',
},
});
List & Manage Triggers
const all = await triggers.list();
for (const t of all) {
console.log(`${t.id}: ${t.platform} ${t.market || t.symbol}`);
console.log(` ${t.direction} ${t.triggerPrice}`);
console.log(` Status: ${t.status}`);
console.log(` Created: ${t.createdAt}`);
}
const pending = await triggers.list({ status: 'pending' });
const history = await triggers.list({ status: 'triggered' });
await triggers.cancel(triggerId);
await triggers.cancelAll();
Event Handlers
triggers.on('triggered', async (trigger, result) => {
console.log(`Trigger ${trigger.id} activated!`);
console.log(`Order: ${result.orderId}`);
console.log(`Fill price: ${result.fillPrice}`);
console.log(`Size: ${result.filledSize}`);
});
triggers.on('failed', (trigger, error) => {
console.error(`Trigger ${trigger.id} failed: ${error.message}`);
});
triggers.on('approaching', (trigger, currentPrice) => {
console.log(`Price ${currentPrice} approaching trigger at ${trigger.triggerPrice}`);
});
Supported Platforms
Prediction Markets
| Platform | Entry Triggers | Exit Triggers | SL/TP |
|---|
| Polymarket | ✓ | ✓ | ✓ |
| Kalshi | ✓ | ✓ | ✓ |
| Manifold | ✓ | ✓ | ✓ |
Futures
| Platform | Entry Triggers | Native Triggers | SL/TP |
|---|
| Binance | ✓ | ✓ | ✓ |
| Bybit | ✓ | ✓ | ✓ |
| MEXC | ✓ | ✓ Native | ✓ |
| Hyperliquid | ✓ | ✓ | ✓ |
Crypto Spot
| Platform | Entry Triggers | Exit Triggers |
|---|
| Jupiter (Solana) | ✓ | ✓ |
| Raydium | ✓ | ✓ |
| Uniswap (EVM) | ✓ | ✓ |
| 1inch (EVM) | ✓ | ✓ |
Trigger Types
| Type | Description |
|---|
| entry | Open new position when triggered |
| exit | Close position when triggered |
| stop-loss | Exit to limit losses |
| take-profit | Exit to lock in gains |
| trailing-stop | Dynamic stop that follows price |
| oco | One-cancels-other (SL + TP pair) |
Price Sources
| Platform | Price Source |
|---|
| Polymarket | WebSocket mid price |
| Kalshi | REST API best bid/ask |
| Binance | WebSocket mark price |
| Bybit | WebSocket last price |
| Jupiter | On-chain oracle |
Examples
Prediction Market Strategy
await triggers.create({
platform: 'polymarket',
market: 'trump-2028',
side: 'YES',
direction: 'below',
triggerPrice: 0.40,
size: 200,
});
await triggers.create({
platform: 'polymarket',
market: 'trump-2028',
side: 'YES',
direction: 'above',
triggerPrice: 0.55,
size: 'all',
});
Futures Breakout Strategy
await triggers.create({
platform: 'binance',
symbol: 'BTCUSDT',
side: 'long',
direction: 'above',
triggerPrice: 100000,
size: 0.5,
leverage: 10,
stopLoss: 98000,
takeProfit: 110000,
});
DCA on Dips
const levels = [180, 170, 160, 150];
for (const price of levels) {
await triggers.create({
platform: 'jupiter',
tokenOut: 'SOL',
tokenIn: 'USDC',
direction: 'below',
triggerPrice: price,
size: 50,
});
}
Best Practices
- Use limit orders — Avoid slippage on triggers
- Set expiration — Don't leave triggers forever
- Monitor execution — Check fill prices
- Use OCO for exits — SL + TP together
- Test with small size — Verify triggers work
- Account for fees — Include in trigger price