investfly.models.portfolio.TradeOrder

Single-leg and multi-leg trade order contracts.

class OptionPackagePriceEffect(builtins.str, enum.Enum):

Whether a multi-leg option package produces a debit, credit, or even price.

class PositionEffect(builtins.str, enum.Enum):

Whether an order opens or closes a position.

@dataclass(frozen=True)
class OptionOrderIntent:

Position effect and leg role attached to an option order.

@dataclass
class TradeOrder:

A class that represents a Trade Order.

For futures, if security is a product-level Security rather than a specific Future contract, the engine automatically resolves it to the earliest active contract outside the platform expiry buffer.

Action semantics are security-type specific:

  • CRYPTO spot supports long-only BUY/SELL orders; SHORT/COVER are invalid.
  • FOREX and FUTURE support directional BUY/SELL orders. A short strategy opens with SELL and closes with BUY; it should not emit SHORT or COVER.
  • STOCK/ETF/OPTION support the full BUY/SELL/SHORT/COVER lifecycle labels.
def validate(self) -> None:

Validate that required fields are provided

@dataclass
class OptionPackageOrder:

One atomic option-combo ticket plus optional option-structure metadata.

@dataclass
class OrderStatus:

Trade Order Status