Strategy Simulation
Use Case: Test trading strategies or cross-chain logic in a safe, isolated environment with real data before deploying them live. How Treza Helps: Run deterministic simulations in enclave containers with access to historical data and mock signer keys — no risk to real funds.
Examples:
Backtest arbitrage strategies with different parameters
Simulate trade execution latency across chains
Benchmark PnL of AI-generated logic
import { TrezaClient } from '@treza/sdk'
const client = new TrezaClient({
apiKey: process.env.TREZA_API_KEY,
})
// Backtest a simple moving average strategy on historical SOL/USDC data
const task = {
taskName: '0xbacktest_sma_01', // strategy logic for simulation
inputs: {
pair: 'SOL/USDC',
fromDate: '2024-05-01',
toDate: '2024-06-01',
params: {
shortWindow: 10,
longWindow: 30,
},
simulate: true, // flag Treza to run in backtest mode
},
mode: 'simulate',
}
async function runBacktest() {
const result = await client.submitTask(task)
console.log('Backtest Results:', result.performanceMetrics)
}
runBacktest()
🧪 Use
mode: 'simulate'
to backtest your agent logic in a secure enclave with historical data. No real capital is touched.
Last updated