investfly.models.marketdata.Future

A specific futures contract (e.g., ESM25) for product ES expiring June 2025.

Extends Security with contract-specific metadata. Instances are created by the platform via StrategyDataService.listFutures(); strategy developers do not construct these directly.

Since Future is a Security, it can be passed anywhere a Security is accepted — getQuote(future), getBars(future), TradeOrder(security=future, ...), etc.

Future(symbol: str, productCode: str, expiryDate: datetime.date)
productCode: str
expiryDate: datetime.date
def getYear(self) -> int:

Return the last two digits of the expiry year, e.g. expiry 2026-03-20 -> 26.

def getFullYear(self) -> int:

Return the full 4-digit expiry year.

def getMonth(self) -> str:

Return the futures month code character from the symbol.

Handles both one-digit and two-digit year formats:

  • 'ESU3' -> 'U'
  • 'ESU23' -> 'U'