Skip to main content

simulate_path

Function simulate_path 

Source
pub fn simulate_path(
    hops: &[HopDescriptor],
    amount_in: &BigUint,
    market: &MarketState,
    overrides: &MarketOverrides,
) -> Result<SimResult, AlgorithmError>
Expand description

Simulates a path hop-by-hop, threading output of each hop as input to the next.

For each hop, the path’s own post-swap states are checked first, then overrides, then the live market state. Returns the final output amount, per-hop results, the post-swap component states, and the marginal price product, the spot prices at the state each hop executed against.