4. Symbology

Many clib commands require a symbol as one parameter. This section describes how to write them.

A symbol is composed of 3 parts:

  1. ticker - this is the stock’s ticker symbol on the exchange
  2. Type - this is one of stk, fut, ind, opt, bnd, or cash
  3. Exchange - the exchange on which the instrument is traded, such as smart or island.

Future: Other examples of exchanges?

4.1. Stocks

For most stocks, all that is required is a ticker symbol. The security type defaults to stk and exchange defaults to smart, as configured in Global Options.

Here’s an example of retrieving contract details for Google:

$ clib details goog
Symbol,Company,Exchange,Expiry,Right,Strike
GOOG, ALPHABET INC-CL C, SMART, None, None, 0.000000

4.2. Futures

When specifying a futures contract, we must include the symbol, security type of fut, and exchange.

Here are some common future symbols and their associated exchanges:

Symbol Description
cl-fut-nymex Light sweet crude oil
es-fut-globex E-mini S&P 500
nq-fut-globex E-mini NASDAQ 100
rty-fut-globex E-mini Russel 2000
spx-fut-globex S&P 500 index
ym-fut-ecbot Mini Sized Dow Jones Industrial

For example, if we wanted to know details on all the S&P Minis, we could run:

$ clib details es-fut-globex
Symbol,Company,Exchange,Expiry,Right,Strike
ES, E-mini S&P 500, GLOBEX, 2019-03-15, None, 0.000000
ES, E-mini S&P 500, GLOBEX, 2019-06-21, None, 0.000000
ES, E-mini S&P 500, GLOBEX, 2019-09-20, None, 0.000000
ES, E-mini S&P 500, GLOBEX, 2019-12-20, None, 0.000000
ES, E-mini S&P 500, GLOBEX, 2020-03-20, None, 0.000000

4.3. Indices

When specifying an index, we must include the symbol, security type of ind, and exchange.

Here’s an example of contract details for the S&P 500 index:

$ clib details spx-ind-cboe
Symbol,Company,Exchange,Expiry,Right,Strike
SPX, S&P 500 Stock Index, CBOE, None, None, 0.000000

Tip: A low cost way of subscribing to indices is the “US Securities Snapshot and Futures Value Bundle.” To subscribe to indices, visit the “Market Data Subscriptions” page under Account Settings > User Settings on the Interactive Brokers website.

4.4. Options

When specifying an options contract, we must include the symbol, security type of opt, and exchange.

For example:

$ clib details nflx-opt-smart

However, as this can be a long list, we can narrow down the results by optionally specifying three more parameters:

  1. The date in YYYYMMDD format
  2. The right (either C for call or P for put)
  3. The strike price

For example, we may be looking for NetFlix options and work our way through greater and greater specificity as follows:

$ clib details nflx-opt-smart
Symbol,Company,Exchange,Expiry,Right,Strike
NFLX, NETFLIX INC, SMART, 2019-01-18, C, 100.000000
NFLX, NETFLIX INC, SMART, 2019-01-18, C, 105.000000
NFLX, NETFLIX INC, SMART, 2019-01-18, C, 110.000000
...
NFLX, NETFLIX INC, SMART, 2019-03-01, P, 395.000000
NFLX, NETFLIX INC, SMART, 2019-03-01, P, 400.000000
$ clib details nflx-opt-smart-20200619
Symbol,Company,Exchange,Expiry,Right,Strike
NFLX, NETFLIX INC, SMART, 2020-06-19, C, 210.000000
NFLX, NETFLIX INC, SMART, 2020-06-19, C, 220.000000
NFLX, NETFLIX INC, SMART, 2020-06-19, C, 250.000000
...
NFLX, NETFLIX INC, SMART, 2020-06-19, P, 140.000000
NFLX, NETFLIX INC, SMART, 2020-06-19, P, 135.000000
$ clib details nflx-opt-smart-20200619-P
Symbol,Company,Exchange,Expiry,Right,Strike
NFLX, NETFLIX INC, SMART, 2020-06-19, P, 200.000000
NFLX, NETFLIX INC, SMART, 2020-06-19, P, 210.000000
NFLX, NETFLIX INC, SMART, 2020-06-19, P, 220.000000
...
NFLX, NETFLIX INC, SMART, 2020-06-19, P, 140.000000
NFLX, NETFLIX INC, SMART, 2020-06-19, P, 135.000000

4.5. Cash or FX

Future: Need to complete this section.

4.6. Using Aliases

As you can see, symbols other than stocks require a type, exchange, and sometimes a right and strike price. This can become cumbersome and error-prone to enter routinely. Fortunately, aliases provide a shorthand for a full symbol.

For example, instead of typing:

$ clib1 buy 1 es-fut-blobex-20190315

We could instead define the alias @es in the config file and type:

$ $ clib buy 1 @es

See also Defining Aliases.