24 lines
765 B
Python
24 lines
765 B
Python
from __future__ import annotations
|
|
|
|
from delta_trace.replay import DeterministicReplayEngine
|
|
from delta_trace.core import LocalEvent, OrderEvent, FillEvent
|
|
|
|
|
|
def build_toy_stream():
|
|
now = 1700000000.0
|
|
tick = LocalEvent(event_id="evt1", asset="AAPL", venue="MD", timestamp=now, source="TOY")
|
|
order = OrderEvent(order_id="ord1", timestamp=now + 0.1, side="buy", instrument="AAPL", price=150.0, quantity=10)
|
|
fill = FillEvent(fill_id="fill1", order_id="ord1", timestamp=now + 0.5, price=149.8, quantity=10, venue="XCH")
|
|
return [tick, order, fill]
|
|
|
|
|
|
def main():
|
|
engine = DeterministicReplayEngine()
|
|
stream = build_toy_stream()
|
|
result = engine.replay(stream, [])
|
|
print("Replay result:", result)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|