Quote & simulate¶
Pricing calls move no funds and don't need a login. Use them to size a trade and to derive slippage protection before you swap.
Which price call to use¶
First classify the symbol — the pricing path differs:
pd.instrument_kind("AMMT1") # "amm" -> pool-priced, 24/7
pd.instrument_kind("AAPL") # "oracle" -> oracle-priced, US market hours
| Symbol kind | Price with | Notes |
|---|---|---|
amm |
quote_swap, simulate_swap, spot_price |
Real pool pricing |
oracle |
oracle_price |
A reference USD price; quote_swap/spot_price don't apply |
Quote a swap (AMM)¶
from decimal import Decimal
from primedelta import SwapSide
quote = pd.quote_swap("AMMT1", SwapSide.STABLECOIN_TO_STOCK, Decimal("10"), exact="input")
exact="input"— "I'm spending this much, how much do I get?"exact="output"— "I want this much out, how much will it cost?"
Turn a quote into a minimum-out with slippage protection:
min_out_from_quote is a static helper: quote * (10000 - slippage_bps) / 10000. Never pass slippage_bps that yields zero — the swap will reject a non-positive floor.
Simulate (AMM)¶
For a full preview in one call:
sim = pd.simulate_swap("AMMT1", SwapSide.STABLECOIN_TO_STOCK, Decimal("10"), slippage_bps=100)
sim.expected_amount_out # Decimal
sim.min_amount_out # Decimal
sim.spot_price # Decimal
sim.fee_tier # int
simulate_swap returns a SwapSimulation with symbol, side, amount_in, expected_amount_out, min_amount_out, slippage_bps, spot_price, and fee_tier.
Spot price (AMM)¶
Oracle price (stocks)¶
Oracle stocks have no pool quote — read the reference price and compute your minimum-out yourself, widening slippage to cover the pool's dynamic fee:
if pd.is_market_open():
ref = pd.oracle_price("AAPL") # reference USD price
# derive min_amount_out from ref with extra slippage, then swap
oracle_price is a reference price, not fee-adjusted, and it expires — act promptly.
Next → Place a swap