Rebalance & Operations

All operations are permissionless. On-chain cooldowns prevent spam.

IDL: pass the fund’s main state PDA as fundState in .accounts({ ... }) for Alpha and Neutral instructions below (Rust fund_state).


Keystone Alpha Fund

Single atomic transaction: read oracle → calculate target → execute swap.

When: Cooldown elapsed (7 days mainnet), fund not paused, oracle available.

Example — SOL at $100, ATH $260:

1. Read oracle: $100
2. Thresholds: $65 (low) / $208 (high)
3. Target: ~65% SOL → Current: 50% SOL
4. Move 3% toward target → 53% SOL
5. Jupiter swap: $3K USDC → jitoSOL
6. 0.1% rebalancing fee on $3K
await program.methods
  .rebalance(fundId, swapData)
  .accounts({ caller, fundState: fundState, fundAuthority: fundAuthority, fundUsdc: fundUsdc, fundJitosol: fundJitosol, solOracle: PYTH_SOL_FEED })
  .remainingAccounts([{ pubkey: JUPITER_PROGRAM_ID, isSigner: false, isWritable: false }, ...accounts])
  .rpc();

Keystone Neutral Fund

Deploy Capital (Standard Basis)

Deploys idle USDC into the standard basis trade with volatility-aware sizing.

When: Idle USDC ≥ min_deploy_amount, no position open, N consecutive positive periods, funding ≥ min_funding_rate_to_deploy.

Steps: Calculate vol regime → adjust size → split USDC by collateral_bps → USDC collateral → Jupiter Perps short opened; remainder → jitoSOL via Jupiter swap.

Deploy Reverse (Reverse Basis)

Deploys reverse basis trade when funding is persistently negative.

When: No position open, N consecutive negative periods.

Steps: Borrow jitoSOL from Kamino → sell for USDC collateral → open long SOL-PERP on Jupiter Perps.

Close Reverse

Closes the reverse basis position when funding recovers.

When: Reverse basis open, funding near-zero or positive.

Settle Funding

Reads Jupiter Perps position account, computes carry delta, updates share price and NAV watermark.

When: Time since last settle ≥ min_settle_interval.

Adjust Position

Rebalances hedge ratio when it drifts from target.


Rate Limits

Operation
Cooldown

Alpha rebalance

7 days (mainnet) / 1 day (devnet)

Neutral deploy (standard)

1 hour

Neutral deploy (reverse)

1 hour

Neutral settle

4 hours

Neutral adjust

1 hour


Automation

Keeper setup →


Common Errors

Error
Cause
Fix

RebalanceTooSoon

Cooldown active

Wait

FundPaused

Fund paused

Contact admin

OraclePriceStale

Price feed old

Wait for Pyth

SlippageExceeded

Market moved

Retry

PositionAlreadyOpen

Deploy when position exists

Use settle/adjust

FundingRateTooLow

Funding below deploy gate

Wait for recovery

InsufficientUsdcForDeployment

Below min_deploy_amount

Wait for deposits

Last updated