Orders & Execution

The deterministic SDK has no order-submission API. Strategies return target weights from signal(); the engine derives the orders. There is no buy(), sell(), or close_all_positions().

Weights → Orders

python
def signal(self, ctx):
    # You return target weights — NOT orders.
    return {"AAPL": 0.5, "MSFT": 0.5}

# The engine compares targets to the current book and trades the delta:
#   current:  {AAPL: 0.5, MSFT: 0.0, NVDA: 0.5}
#   target:   {AAPL: 0.5, MSFT: 0.5}
#   -> SELL NVDA to 0, BUY MSFT to 0.5, leave AAPL
# Orders fill at the next open (delay-1).

What the Engine Does

  • Normalizes target weights and runs them through guardrails (may scale or reject).
  • Computes the difference between target weights and the current portfolio.
  • Generates buy/sell orders for the deltas and fills them at the next open.
  • Marks the book to the close and records a portfolio snapshot.

See the Execution Model for delay-1 mechanics and Risk Limits for guardrails.