(module embed_backtest_step_tick

  (data State
    (ctor State (con Float) (con Int)))

  (data Tick
    (ctor Tick (con Float)))

  (fn step
    (export "backtest_step_tick")
    (type
      (fn-type
        (params (own (con State)) (own (con Tick)))
        (ret (own (con State)))))
    (params st tick)
    (body
      (match st
        (case (pat-ctor State acc n)
          (match tick
            (case (pat-ctor Tick px)
              (term-ctor State State (app + acc px) (app + n 1)))))))))
