Sandbox
Sandbox Environment
Test treasury strategies with live market data. Run simulations, compare leverage levels, and optimize — all via API. No authentication required.
Strategy Simulator API
LiveRun treasury simulations using real BTC/ETH historical returns from Binance and live Aave V3 borrow rates. No API key needed — agents and developers can start testing immediately.
POST /api/simulate
Run a simulation with custom parameters. Returns projected value, DCA comparison, rates used.
GET /api/market-data
Live rates: BTC/ETH returns by timeframe, Aave borrow APR (rolling avg + spot), prices.
GET /api/simulate
Machine-readable API spec with all parameters, response fields, and usage instructions.
Tag your agent, get your stats
Include a source field in every simulation (e.g. "source": "my-treasury-agent"). Every run is logged under your tag — we'll surface your simulation analytics so you can track which strategies your agent discovers.
Run a Simulation
Test a leveraged growth strategy with live market data. No API key needed.
// POST https://stackit.ai/api/simulate
const result = await fetch('https://stackit.ai/api/simulate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
monthlyDeposit: 1000,
ltvPercent: 40, // 40% LTV = conservative leverage
years: 3,
source: 'my-agent', // identify your agent
}),
}).then(r => r.json());
console.log(result.result.estimatedTreasuryValue); // e.g. 52340
console.log(result.result.plainDcaValue); // e.g. 45200
console.log(result.result.growthVsPlainDca); // e.g. 16 (%)
console.log(result.rates.borrowApr); // e.g. 0.0289
console.log(result.rates.isLive); // true
console.log(result.meta.dataSource); // "Binance, Aave V3"Compare Strategies
Run multiple simulations to find the optimal LTV level for a given timeframe.
// Test LTV levels: 0% (no leverage), 20%, 40%, 60%, 75%
const ltvLevels = [0, 20, 40, 60, 75];
const results = await Promise.all(
ltvLevels.map(ltv =>
fetch('https://stackit.ai/api/simulate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
monthlyDeposit: 1000,
ltvPercent: ltv,
years: 3,
source: 'my-agent',
}),
}).then(r => r.json())
)
);
// Compare results
for (const r of results) {
console.log(
`LTV ${r.input.ltvPercent}%: ` +
`Treasury ${r.result.estimatedTreasuryValueFormatted}, ` +
`vs DCA ${r.result.growthVsPlainDca}%, ` +
`Debt ${r.result.totalDebt}`
);
}Borrow-to-Spend Mode
Simulate depositing monthly while borrowing against your treasury for cash flow.
// Deposit $2,000/mo, borrow $2,000/mo for spending
const result = await fetch('https://stackit.ai/api/simulate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
monthlyDeposit: 2000,
monthlySpend: 2000, // borrow this much for cash flow
ltvPercent: 0, // no leverage in spend mode
years: 3,
source: 'my-agent',
}),
}).then(r => r.json());
console.log(result.result.totalBorrowedToSpend); // total cash extracted
console.log(result.result.estimatedTreasuryValue); // treasury still growing
console.log(result.result.spendCapped); // true if HF got too lowGet Live Market Data
Fetch current rates before running custom analysis — BTC/ETH returns, Aave borrow rate, spot prices.
// GET https://stackit.ai/api/market-data
const data = await fetch('https://stackit.ai/api/market-data')
.then(r => r.json());
console.log(data.btcReturns); // { 1: 0.45, 2: 0.35, 3: 0.30, 5: 0.28 }
console.log(data.ethReturns); // { 1: 0.38, 2: 0.30, 3: 0.25, 5: 0.22 }
console.log(data.borrowApr); // 0.0289 (rolling average)
console.log(data.borrowAprSpot); // 0.0312 (latest reading)
console.log(data.borrowAprSamples); // 156 (hourly samples in average)
console.log(data.btcPrice); // 87500
console.log(data.ethPrice); // 3200
console.log(data.source); // "Binance (prices), Aave V3 on-chain"Try It Interactively
Use the interactive sandbox to build a strategy visually — same simulation engine, same live data.
Open Interactive SandboxFuture: Full Treasury API Sandbox
Test Keys vs Live Keys
Test Keys
- Sandbox environment only
- Mock balances and responses
- No real transactions
- Same API structure as production
Live Keys
- Production environment
- Real treasury operations
- Real fees apply
- Issued during onboarding
Get Sandbox Access
Sandbox test keys will be available for self-service sign-up. In the meantime, book a Treasury Design Call to get early access to the sandbox environment.
How to get test keys
- Book a Treasury Design Call at stackit.ai/meet
- Request sandbox access during onboarding
- Receive
sk_test_*credentials via email - Start testing against
sandbox.api.stackit.ai
Base URL
https://api.stackit.ai
https://sandbox.api.stackit.ai
All endpoints work identically in both environments. Only the base URL and key prefix differ.
Test Scenarios
Deposit Flow
Test a full deposit cycle: create deposit, verify allocation, check treasury status.
// 1. Create a test deposit
const deposit = await fetch('https://sandbox.api.stackit.ai/api/v1/deposits', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_test_your_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
amount: 10000,
allocation: { btc: 60, eth: 40 },
}),
}).then(r => r.json());
console.log(deposit.deposit_id); // "dep_test_abc123"
console.log(deposit.fee_usdc); // 200
console.log(deposit.net_amount); // 9800
// 2. Check treasury after deposit
const treasury = await fetch('https://sandbox.api.stackit.ai/api/v1/treasury', {
headers: { 'Authorization': 'Bearer sk_test_your_key' },
}).then(r => r.json());
console.log(treasury.holdings); // Updated balancesBorrowing Limits
Test LTV enforcement: try borrowing within limits and verify rejection when exceeding the configured LTV ceiling (default 60%).
// 1. Check current health
const health = await fetch('https://sandbox.api.stackit.ai/api/v1/health', {
headers: { 'Authorization': 'Bearer sk_test_your_key' },
}).then(r => r.json());
console.log(health.ltv); // 36.5
console.log(health.ltv_zone); // "active"
// 2. Borrow within safe range — should succeed
const safeBorrow = await fetch('https://sandbox.api.stackit.ai/api/v1/borrow', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_test_your_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({ amount: 5000 }),
}).then(r => r.json());
console.log(safeBorrow.status); // "approved"
// 3. Borrow that would exceed ceiling — should return 403
const unsafeBorrow = await fetch('https://sandbox.api.stackit.ai/api/v1/borrow', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_test_your_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({ amount: 999999 }),
});
console.log(unsafeBorrow.status); // 403 — LTV ceiling enforcedHealth Monitoring
Test health score polling and LTV zone transitions for agent monitoring workflows.
// Poll health score — typical agent monitoring loop
async function monitorHealth() {
const health = await fetch('https://sandbox.api.stackit.ai/api/v1/health', {
headers: { 'Authorization': 'Bearer sk_test_your_key' },
}).then(r => r.json());
console.log(`Health: ${health.health_score}`);
console.log(`LTV: ${health.ltv}% (${health.ltv_zone})`);
console.log(`Auto-repay: ${health.auto_repay_active}`);
// Alert conditions
if (health.health_score < 70) {
console.warn('Health score below 70 — attention needed');
}
if (health.ltv > 48) {
console.warn('LTV approaching ceiling — consider repayment');
}
}Sandbox Limitations
No real transactions
All deposits, borrows, and conversions are simulated.
Mock balances
Sandbox accounts start with pre-set BTC, ETH, and USDC balances.
Static rates
Aave rates and DEX spreads are fixed mock values.
No webhooks yet
Webhook delivery is not available in sandbox (coming soon).
Ready to test?
Book a Treasury Design Call to get sandbox access and start building.