> For the complete documentation index, see [llms.txt](https://developer.barchart.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.barchart.com/getting-started/filtering-by-instrument-type.md).

# Filtering by Instrument Type

When subscribing by exchange code, specify the instrument types to stream.

If you omit `instrument_type`, Openfeed subscribes to all types except `OPTION`, `SPREAD`, and `USER_DEFINED_SPREAD`. If you omit `subscription_type`, it defaults to `QUOTE`, which includes quotes and trades.

### Python

Use `instrument_type` to stream options and futures data from CME:

```python
of_client.add_exchange_subscription(
    'CME',
    callback=on_message,
    service='DELAYED',
    instrument_type=['OPTION', 'FUTURE'],
    subscription_type=['QUOTE'],
)
```

### Java

Use the Java client to subscribe to CME futures and options:

```shell
java -jar target/openfeed-client-1.0.0-SNAPSHOT-shaded.jar -u <username> -p <password> -host demo.openfeed.barchart.com -e CME -st quote -it future,option -lu -li
```

<details>

<summary>Options and futures data instrument subscription sample output</summary>

```
subscriptionResponse {
  status {
    result: SUCCESS
    service: DELAYED
  }
  exchange: "CME"
  numberOfDefinitions: 555252
  subscriptionType: QUOTE
}

instrumentDefinition {
  marketId: 6501313388015627782
  instrumentType: OPTION
  supportBookTypes: PRICE_LEVEL_DEPTH
  bookDepth: 3
  vendorId: "Barchart"
  symbol: "CAUV2 P0920"
  description: "Canadian Dollar"
  cfiCode: "OPEFPS"
  currencyCode: "USD"
  exchangeCode: "CME"
  minimumPriceIncrement: 5.0
  contractPointValue: 100000.0
  calendar {
    events {
      type: FIRST_TRADE_DATE
      date: 1633728600000
    }
    events {
      type: LAST_TRADE_DATE
      date: 1665151200000
    }
  }
  timeZoneName: "America/Chicago"
  instrumentGroup: "CAU"
  symbolExpiration {
    year: 2022
    month: 10
    day: 255
  }
  channel: 6
  underlyingMarketId: 930310
  priceFormat {
    denominator: 100000
    subDenominator: 1
  }
  priceDenominator: 1000000000
  quantityDenominator: 1
  symbols {
    vendor: "CME-SYM"
    symbol: "699547:CAUV2 P0920"
  }
  symbols {
    vendor: "CME-SBE-ID"
    symbol: "55"
  }
  symbols {
    vendor: "CME-CH-ID"
    symbol: "321"
  }
  symbols {
    vendor: "Barchart"
    symbol: "D6V920P"
  }
  optionStrike: 9200000000000
  optionType: PUT
  optionStyle: EUROPEAN
  optionStrikeDenominator: 1000000000
  exchangeSendsVolume: true
  exchangeSendsHigh: true
  exchangeSendsLow: true
  exchangeSendsOpen: true
  barchartExchangeCode: "M"
  barchartBaseCode: "D"
}

// Initial MarketSnapshot

marketSnapshot {
  marketId: 6501313388015627782
  marketSequence: 12789
  tradeDate: 20220613
  symbol: "CAUV2 P0920"
  service: DELAYED
  instrumentStatus {
    tradingStatus: OPEN
    tradeDate: 20220613
  }
  bbo {
    bidPrice: 141200000
    bidQuantity: 10
    bidOrderCount: 1
    offerPrice: 142000000
    offerQuantity: 10
    offerOrderCount: 1
  }
  previousSession {
    tradeDate: 20220610
    high {
      tradeDate: 20220610
      price: 136300000
    }
    low {
      tradeDate: 20220610
      price: 136300000
    }
    settlement {
      tradeDate: 20220610
      price: 136300000
    }
    numberOfTrades {
    }
    transactionTime: 1654897072743037435
    prevSettlement {
      tradeDate: 20220609
      price: 131900000
    }
  }
  volumeAtPrice {
    marketId: 6501313388015627782
  }
}

...

instrumentDefinition {
  marketId: 8372137820168902406
  instrumentType: FUTURE
  supportBookTypes: PRICE_LEVEL_DEPTH
  bookDepth: 5
  vendorId: "Barchart"
  symbol: "SONH2"
  description: "Quarterly IMM Sonia"
  cfiCode: "FFDXSX"
  currencyCode: "GBP"
  exchangeCode: "CME"
  minimumPriceIncrement: 25.0
  contractPointValue: 2500.0
  calendar {
    events {
      type: FIRST_TRADE_DATE
      date: 1537565400000
    }
    events {
      type: LAST_TRADE_DATE
      date: 1655280000000
    }
  }
  timeZoneName: "America/Chicago"
  instrumentGroup: "SON"
  symbolExpiration {
    year: 2022
    month: 3
    day: 255
  }
  channel: 6
  priceFormat {
    denominator: 10000
    subDenominator: 1
  }
  priceDenominator: 1000000000
  quantityDenominator: 1
  symbols {
    vendor: "CME-SYM"
    symbol: "55943:SONH2"
  }
  symbols {
    vendor: "CME-SBE-ID"
    symbol: "54"
  }
  symbols {
    vendor: "CME-CH-ID"
    symbol: "312"
  }
  symbols {
    vendor: "Barchart"
    symbol: "MZH2"
  }
  exchangeSendsVolume: true
  exchangeSendsHigh: true
  exchangeSendsLow: true
  exchangeSendsOpen: true
  barchartExchangeCode: "M"
  barchartBaseCode: "C"
}

marketSnapshot {
  marketId: 8372137820168902406
  transactionTime: 1655134665289976437
  marketSequence: 12
  tradeDate: 20220613
  totalChunks: 1
  currentChunk: 1
  symbol: "SONH2"
  service: DELAYED
  instrumentStatus {
    tradingStatus: OPEN
    tradeDate: 20220613
  }
  open {
  }
  high {
    price: 99197500000
  }
  low {
    price: 99197500000
  }
  last {
  }
  volume {
  }
  settlement {
    tradeDate: 20220613
    price: 99197500000
    preliminarySettle: true
  }
  numberOfTrades {
  }
  previousSession {
    tradeDate: 20220610
    high {
      tradeDate: 20220610
      price: 99200000000
    }
    low {
      tradeDate: 20220610
      price: 99200000000
    }
    volume {
      tradeDate: 20220610
    }
    settlement {
      tradeDate: 20220610
      price: 99200000000
    }
    openInterest {
      tradeDate: 20220610
      volume: 373
    }
    numberOfTrades {
    }
    monetaryValue {
      value: 9978
    }
    transactionTime: 1654897137133558015
    prevSettlement {
      tradeDate: 20220609
      price: 99200000000
    }
  }
}

...
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.barchart.com/getting-started/filtering-by-instrument-type.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
