Skip to content

Conversation

@Romazes
Copy link
Contributor

@Romazes Romazes commented Sep 17, 2025

Description

Fixed handling of future options in the SymbolMapper for Tastytrade brokerage.
Tastytrade supports different formats for future option symbols:

  • With a space: ./ZBU5 OZBN5 250620C142.5
  • Without a space: ./MNQZ5D4AU5 250922C24575

The mapping now correctly parses both formats, including the optional exchange codes and encoded expiration parts. This ensures proper conversion between QuantConnect Symbols and brokerage symbols for order placement and market data subscriptions.

Example JSON from Tastytrade:

# endpoint: https: //api.cert.tastyworks.com/futures-option-chains/GC
{
    "active": true,
    "days-to-expiration": 8,
    "display-factor": "0.01",
    "exchange": "CME",
    "exchange-symbol": "OGV5 P2755",
    "exercise-style": "American",
    "expiration-date": "2025-09-25",
    "expires-at": "2025-09-25T17:30:00.000+00:00",
    "future-price-ratio": "1.0",
    "is-closing-only": false,
    "is-confirmed": true,
    "is-exercisable-weekly": true,
    "is-primary-deliverable": true,
    "is-vanilla": true,
    "last-trade-time": "0",
    "maturity-date": "2025-09-25",
    "multiplier": "1.0",
    "notional-value": "1.0",
    "option-root-symbol": "OG",
    "option-type": "P",
    "product-code": "GC",
    "root-symbol": "/GC",
    "security-exchange": "4",
    "settlement-type": "Future",
    "stops-trading-at": "2025-09-25T17:30:00.000+00:00",
    "streamer-symbol": "./OGV25P2755:XCEC",
    "strike-factor": "1.0",
    "strike-price": "2755.0",
    "sx-id": "0",
    "symbol": "./GCV5 OGV5  250925P2755",
    "underlying-count": "1.0",
    "underlying-symbol": "/GCV5",
    "future-option-product": {
        "cash-settled": false,
        "clearing-code": "37",
        "clearing-exchange-code": "04",
        "clearing-price-multiplier": "1.0",
        "clearport-code": "OG",
        "code": "OG",
        "display-factor": "0.01",
        "exchange": "CME",
        "expiration-type": "Regular",
        "is-rollover": false,
        "legacy-code": "OG",
        "market-sector": "Metals",
        "product-type": "Physical",
        "root-symbol": "OG",
        "settlement-delay-days": 0,
        "supported": true
    }
},
# endpoint: https: //api.cert.tastyworks.com/futures-option-chains/MNQ
{
    "active": true,
    "days-to-expiration": 1,
    "display-factor": "0.01",
    "exchange": "CME",
    "exchange-symbol": "D3DU5 P23270",
    "exercise-style": "American",
    "expiration-date": "2025-09-18",
    "expires-at": "2025-09-18T20:00:00.000+00:00",
    "future-price-ratio": "1.0",
    "is-closing-only": false,
    "is-confirmed": true,
    "is-exercisable-weekly": true,
    "is-primary-deliverable": true,
    "is-vanilla": true,
    "last-trade-time": "0",
    "maturity-date": "2025-09-18",
    "multiplier": "1.0",
    "notional-value": "0.02",
    "option-root-symbol": "D3D",
    "option-type": "P",
    "product-code": "MNQ",
    "root-symbol": "/MNQ",
    "security-exchange": "2",
    "settlement-type": "Future",
    "stops-trading-at": "2025-09-18T20:00:00.000+00:00",
    "streamer-symbol": "./D3DU25P23270:XCME",
    "strike-factor": "1.0",
    "strike-price": "23270.0",
    "sx-id": "0",
    "symbol": "./MNQU5D3DU5 250918P23270",
    "underlying-count": "1.0",
    "underlying-symbol": "/MNQU5",
    "future-option-product": {
        "cash-settled": false,
        "clearing-code": "HS",
        "clearing-exchange-code": "9C",
        "clearing-price-multiplier": "1.0",
        "clearport-code": "D3D",
        "code": "D3D",
        "display-factor": "0.01",
        "exchange": "CME",
        "expiration-type": "Weekly",
        "is-rollover": false,
        "legacy-code": "D3D",
        "market-sector": "Equity Index",
        "product-type": "Physical",
        "root-symbol": "D3D",
        "settlement-delay-days": 0,
        "supported": true
    }
},

Related Issue

closes #11

Motivation and Context

Previously, the SymbolMapper did not correctly handle future option symbols in the Tastytrade format.
Some symbols include spaces, others are compact and contain encoded parts for the exchange and expiration month/year.

Requires Documentation Change

N/A

How Has This Been Tested?

  • Added unit tests for multiple Tastytrade future option formats, both with and without spaces.
image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (non-breaking change which improves implementation)
  • Performance (non-breaking change which improves performance. Please add associated performance test and results)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Non-functional change (xml comments/documentation/etc)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My branch follows the naming convention bug-<issue#>-<description> or feature-<issue#>-<description>

@Romazes Romazes self-assigned this Sep 17, 2025
@Romazes Romazes added bug Something isn't working SecurityType.FutureOption labels Sep 17, 2025
feat: cache fops chain response
feat: new api endpoint get fop metadata
feat: update FutureOption entity
feat: convert OptionType  <-> OptionRight
test:feat: additional test for futures
test:feat: new TestCases FOPs in SymbolMapper
@Romazes Romazes force-pushed the fix-11-format-exception-with-mnq-fop branch from c668d4b to 532f75a Compare October 7, 2025 18:37
@Romazes Romazes merged commit ecc85a6 into master Oct 8, 2025
1 check failed
@Romazes Romazes deleted the fix-11-format-exception-with-mnq-fop branch October 8, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working SecurityType.FutureOption

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FormatException With MNQ FOP

3 participants