Advanced10 min read
Custom Strategies
Building custom execution strategies with NEXO
Strategy Builder
Create custom execution strategies tailored to your specific needs.
Strategy Components
- •Triggers - When to execute (price, time, condition)
- •Actions - What to do (swap, transfer, stake)
- •Guards - Safety conditions (slippage, gas limits)
Example: DCA Strategy
typescript
const dcaStrategy = client.createStrategy({
name: 'Weekly SOL DCA',
trigger: {
type: 'schedule',
cron: '0 9 * * 1' // Every Monday at 9am
},
action: {
type: 'swap',
inputMint: 'USDC',
outputMint: 'SOL',
amount: 100_000_000 // 100 USDC
},
guards: {
maxSlippage: 1,
priceRange: { min: 20, max: 200 }
}
});
await client.deployStrategy(dcaStrategy);Example: Stop-Loss
typescript
const stopLoss = client.createStrategy({
name: 'SOL Stop-Loss',
trigger: {
type: 'price',
token: 'SOL',
condition: 'below',
value: 50
},
action: {
type: 'swap',
inputMint: 'SOL',
outputMint: 'USDC',
amount: 'all'
}
});