2. Command Reference

2.1. account

Synonyms: a, acc

The account command lists many account values, such as:

  • Account number
  • Net liquidation value
  • Margin and day-trading limits
  • Realized and unrealized profit and loss
  • And many more

Here’s an example of a full account values listing:

$ clib account
Key, Value
AccountCode, DU169481
AccountOrGroup, DU169481
AccountReady, true
AccountType, INDIVIDUAL
AccruedCash, 545
AccruedCash-C, 0.00
AccruedCash-S, 545.27
AccruedDividend, 0.00
AccruedDividend-C, 0.00
AccruedDividend-S, 0.00
AvailableFunds, 681274.24
AvailableFunds-C, 26716.77
AvailableFunds-S, 654557.47
Billable, 0.00
Billable-C, 0.00
Billable-S, 0.00
BuyingPower, 2617984.35
CashBalance, 680630
CorporateBondValue, 0
Currency, BASE
Currency, USD
Cushion, 0.999952
DayTradesRemaining, -1
DayTradesRemainingT+1, -1
DayTradesRemainingT+2, -1
DayTradesRemainingT+3, -1
DayTradesRemainingT+4, -1
EquityWithLoanValue, 681307.27
EquityWithLoanValue-C, 26716.77
EquityWithLoanValue-S, 654590.50
ExcessLiquidity, 681274.24
ExcessLiquidity-C, 26716.77
ExcessLiquidity-S, 654557.47
ExchangeRate, 1.00
FullAvailableFunds, 681274.24
FullAvailableFunds-C, 26716.77
FullAvailableFunds-S, 654557.47
FullExcessLiquidity, 681274.24
FullExcessLiquidity-C, 26716.77
FullExcessLiquidity-S, 654557.47
FullInitMarginReq, 33.03
FullInitMarginReq-C, 0.00
FullInitMarginReq-S, 33.03
FullMaintMarginReq, 33.03
FullMaintMarginReq-C, 0.00
FullMaintMarginReq-S, 33.03
FundValue, 0
FutureOptionValue, 0
FuturesPNL, -537
FxCashBalance, 0
GrossPositionValue, 132.13
GrossPositionValue-S, 132.13
Guarantee, 0.00
Guarantee-C, 0.00
Guarantee-S, 0.00
IndianStockHaircut, 0.00
IndianStockHaircut-C, 0.00
IndianStockHaircut-S, 0.00
InitMarginReq, 33.03
InitMarginReq-C, 0.00
InitMarginReq-S, 33.03
IssuerOptionValue, 0
Leverage-S, 0.00
LookAheadAvailableFunds, 681274.24
LookAheadAvailableFunds-C, 26716.77
LookAheadAvailableFunds-S, 654557.47
LookAheadExcessLiquidity, 681274.24
LookAheadExcessLiquidity-C, 26716.77
LookAheadExcessLiquidity-S, 654557.47
LookAheadInitMarginReq, 33.03
LookAheadInitMarginReq-C, 0.00
LookAheadInitMarginReq-S, 33.03
LookAheadMaintMarginReq, 33.03
LookAheadMaintMarginReq-C, 0.00
LookAheadMaintMarginReq-S, 33.03
LookAheadNextChange, 0
MaintMarginReq, 33.03
MaintMarginReq-C, 0.00
MaintMarginReq-S, 33.03
MoneyMarketFundValue, 0
MutualFundValue, 0
NLVAndMarginInReview, false
NetDividend, 0
NetLiquidation, 681307.27
NetLiquidation-C, 26716.77
NetLiquidation-S, 654590.50
NetLiquidationByCurrency, 681307
NetLiquidationUncertainty, 0.00
OptionMarketValue, 0
PASharesValue, 0.00
PASharesValue-C, 0.00
PASharesValue-S, 0.00
PostExpirationExcess, 681274.24
PostExpirationExcess-C, 26716.77
PostExpirationExcess-S, 654557.47
PostExpirationMargin, 33.03
PostExpirationMargin-C, 0.00
PostExpirationMargin-S, 33.03
PreviousDayEquityWithLoanValue, 654529.12
PreviousDayEquityWithLoanValue-S, 654529.12
RealCurrency, BASE
RealCurrency, USD
RealizedPnL, -911
RegTEquity, 654590.50
RegTEquity-S, 654590.50
RegTMargin, 66.07
RegTMargin-S, 66.07
SMA, 800717.80
SMA-S, 800717.80
SegmentTitle-C, US Commodities
SegmentTitle-S, US Securities
StockMarketValue, 132
TBillValue, 0
TBondValue, 0
TotalCashBalance, 680630
TotalCashValue, 680629.87
TotalCashValue-C, 26716.77
TotalCashValue-S, 653913.10
TotalDebitCardPendingCharges, 0.00
TotalDebitCardPendingCharges-C, 0.00
TotalDebitCardPendingCharges-S, 0.00
TradingType-S, STKNOPT
UnrealizedPnL, 1
WarrantValue, 0
WhatIfPMEnabled, true

As you can see, there are nearly 130 account values, so it’s sometimes helpful to limit the values shown.

An optional code may be specified, as follows:

Code Description —— ————- all Show all account values c Show commodities account values only s Show security account values only t Show totals only

Here’s an example of account values relating to commodities only:

$ clib account c
Key, Value
AccruedCash-C, 0.00
AccruedDividend-C, 0.00
AvailableFunds-C, 14671.23
Billable-C, 0.00
EquityWithLoanValue-C, 17154.03
ExcessLiquidity-C, 17154.03
FullAvailableFunds-C, 14671.23
FullExcessLiquidity-C, 17154.03
FullInitMarginReq-C, 12414.00
FullMaintMarginReq-C, 9931.20
Guarantee-C, 0.00
IndianStockHaircut-C, 0.00
InitMarginReq-C, 12414.00
LookAheadAvailableFunds-C, 20878.23
LookAheadExcessLiquidity-C, 22119.63
LookAheadInitMarginReq-C, 6207.00
LookAheadMaintMarginReq-C, 4965.60
MaintMarginReq-C, 9931.20
NetLiquidation-C, 27085.23
PASharesValue-C, 0.00
PostExpirationExcess-C, 27085.23
PostExpirationMargin-C, 0.00
SegmentTitle-C, US Commodities
TotalCashValue-C, 27085.23
TotalDebitCardPendingCharges-C, 0.00

Another way of limiting account values is to use the –filter option to filter just the results you want. For example:

$ clib --filter=Day account
DayTradesRemaining, -1
DayTradesRemainingT+1, -1
DayTradesRemainingT+2, -1
DayTradesRemainingT+3, -1
DayTradesRemainingT+4, -1
PreviousDayEquityWithLoanValue, 654529.12
PreviousDayEquityWithLoanValue-S, 654529.12

2.2. article

Synonyms: art

The article command can be used to retrieve the full article text of a headline from the**news** command.

See the news command for a full example.

2.3. bars

Synonyms: None

The bars command is used to retrieve real-time 5 second bars.

The following parameters are required:

  1. Symbol (see Symbology
  2. What to show: valid choices are midpoint or trades. Midpoint is the average of bid and ask but includes no volume.
    Trades represents actual trade prices.

Here’s an example:

$ clib bars spy trades
Time, Open, High, Low, Close, Volume, Local Time
2019-01-07 14:13:35, 254.69, 254.72, 254.68, 254.72, 5600, 14:13:44.51
2019-01-07 14:13:40, 254.72, 254.72, 254.71, 254.72, 8100, 14:13:46.07
2019-01-07 14:13:45, 254.72, 254.74, 254.72, 254.74, 4700, 14:13:51.07
2019-01-07 14:13:50, 254.74, 254.78, 254.74, 254.78, 11800, 14:13:56.07

Note: The bars command will continue to run indefinitely unless either the user presses Ctrl+C or a –terminate option is specified. For example, here’s a script that runs 5 second bars until time of 18:45.

$ clib --extended --terminate=18.45 bars spy trades
Time, Open, High, Low, Close, Volume, Local Time
2018-12-21 18:44:15, 240.30, 240.30, 240.30, 240.30, 0, 18:44:25.68
2018-12-21 18:44:20, 240.30, 240.30, 240.30, 240.30, 0, 18:44:26.11
2018-12-21 18:44:25, 240.30, 240.30, 240.30, 240.30, 0, 18:44:31.12
2018-12-21 18:44:30, 240.30, 240.30, 240.30, 240.30, 0, 18:44:36.11
2018-12-21 18:44:35, 240.30, 240.30, 240.30, 240.30, 0, 18:44:41.14
2018-12-21 18:44:40, 240.30, 240.30, 240.25, 240.30, 30400, 18:44:46.11
2018-12-21 18:44:45, 240.30, 240.30, 240.30, 240.30, 200, 18:44:50.66
2018-12-21 18:44:50, 240.33, 240.33, 240.33, 240.33, 100, 18:44:56.10
2018-12-21 18:44:55, 240.33, 240.33, 240.33, 240.33, 0, 18:45:01.11

2.4. bulletins

Use the bulletins command to show notices concerning exchange issues, system problems and other trading information. Here’s an example:

$ clib --no-headings bulletins | html2text
1543919649, 4,
 
 
                         US Markets Closed for National Day of Mourning
...
Message Reference Number: 178460562, Sent Date: 2018.12.04 17:17:10 -0500
Closing connection

2.5. buy and sell

Synonyms: b and s

We can use the buy and sell commands, along with order types, to buy and sell stocks, options, futures, ETFs, and other security types supported by Interactive Brokers.

The following parameters are required:

  1. Quantity
  2. Symbol (see Symbology
  3. Order type - see table below
  4. A limit or stop price for orders other than market
  5. An optional Time In Force

clib currently supports the following order types:

Type Description
mkt Market order
lmt L imit order
stp S top order
fok Fi ll or kill
io I mmediate or cancel
moc Market on close
moo Market on open
loc Limit on close
loo Limit on open

Future: Support other order types based on customer interest.

The following Time in Force have been tested:

TIF Description
None Defaults to day
gtc Good until cancelled

Future: Test more of these

Here’s an example of buying 100 shares of spy at market:

$ clib buy 100 spy market
Type, Order ID, Status, Filled, Remaining, Average Price, Last Price, Exec Side, Exec Shares, Exec Price, Commission ID, Commission $
Status, 79, PreSubmitted, 0, 100, 0.00, 0.00
Execution, 79, , , , , BOT, 100, 239.59
Status, 79, Filled, 100, 0, 239.59, 239.59
Commission, , , , , , , , , 00012bb1.5c24fd78.01.01, 1.00

Note: Many order types do not return fill info right away. If you want clib to wait longer than the default timeout you can specify a –timeout command line option.

Here’s an example:

$ clib1 --timeout=0 buy 100 spy lmt 2500.00

2.6. cancel

Synonyms: del

We can use the cancel command to cancel open orders by ID, a range of IDs, or a comma separated list of IDs.

For example, these are all valid cancel commands:

$ clib cancel 10
$ clib cancel 10-14
$ clib cancel 10,12,14

Note: No spaces between commas.

We can obtain the IDs of the orders to cancel using the orders command.

Here’s an example that demonstrates placing a limit order, checking its status, and cancelling the order.

$ clib buy 100 spy lmt 100.00
Type, Order ID, Status, Filled, Remaining, Average Price, Last Price, Exec Side, Exec Shares, Exec Price, Commission ID, Commission $
Status, 211, Submitted, 0, 100, 0.00, 0.00
Closing connection
$ clib orders
Type, Order ID, Client ID, Action, Total Qty, Symbol, Exchange, Sec Type, Status
openOrder, 211, 101, BUY, 100, SPY, STK, SMART, Submitted
$ clib cancel 211
Order ID, Status, Filled, Remaining, Average Price, Last Price
211, Cancelled, 0, 100, 0.00, 0.00
Closing connection

2.7. commissions

Synonyms: com

The commissions command is used to list commissions for the current day.

Here’s a sample commission run:

$ clib commissions
ExecID, Commission
0000d322.5c113215.01.01, 1.00

2.7.1. Commission Limitations

The commissions provided by Interactive Brokers leave a few things to be desired:

  1. Paper trading account commissions are not available until late in the day while production account commissions are available immediately
  2. The realized Profit and Loss provided by Interactive Brokers is often a nonsensical number so it is not shown
  3. There is no easy way to obtain a commission and its corresponding execution, so for example, we can ot easily see from commissions which symbol they relate to

2.7.2. Matching Commissions to Executions

We can however execute both a commissions command and an executions command. Then we can cross reference the commission with its execution and trade details by Exec ID. Here’s an example:

$ clib commissions
Exec ID, Commission
0000d322.5c113215.01.01, 1.00

$ clib executions
Order ID, Exec ID, Side, Shares, Symbol, Price
9, 0000d322.5c113215.01.01 BOT, 1, AAPL 170.046900

2.8. create

Synonyms: None

Use the create command to create an a default initialization file. The initialization file will be named clib.ini and be placed in the directory where the clib executable resides.

Once the configuration file has been created, refer to the Configuration and Customization Chapter for explanation of all the options it contains.

2.9. data

Synonyms: d

Use the data command to request current market data for a symbol. this can include:

  1. Bid and ask prices and volumes
  2. Last trade price and size
  3. Total volume

Here’s an example of a data request for spy:

$ clib --terminate=askSize data spy
Tick Type, Price, Size
lastPrice, 254.64
volume, 85131100
high, 255.95
low, 251.69
close, 252.39
open, 252.76
bidPrice, 254.63
bidSize, 2800
askPrice, 254.64
bidSize, 2800
bidPrice, 254.65
askPrice, 254.66
askSize, 800

Note: the data command will run continuously if not limited with a –terminate option, –timeout option, a default timeout without any new market data, or the user pressing Ctrl+C.

See also: quote and snap commands.

Future: Allow user to specify a “genericTicklist” to get data other than default

2.10. details

Synonyms: det

We can use the details command to display contract details on stocks, options, futures, indices, and other financial instruments.

The following parameters are required:

  1. Symbol

See Symbology for the format of symbols and many usage examples of the details command.

2.11. executions

Synonyms: e

Use the executions command to display information about all trade fills for the current day.

No parameters are required.

Note: As many trades initiated with clib will not fill right away, it’s a good idea to log daily executions after the end of the trading day.

See Example 1 - Nightly log of Trades and Commissions for a working example.

2.12. fundamental

Synonyms: f, fun

Use the fundamental command to request company information such as company calendars and financial statements.

This command takes these parameters:

  1. Symbol (see Symbology
  2. report - may be one of summary, statements, ownership, risc, snapshot, or calendar
    If none is specified, snapshot is assumed.

The data from this command is returned as XML from Interactive Brokers. In order to parse fundamental data, a utility like xmlstarlet is helpful.

Here’s an example that retrieves fundamental data on aapl. Then uses the xmlstarlet utility to extract the numbrr of shares outstanding.

$ clib fundamental aapl > aapl.xml
$ xmlstarlet sel -t -v "/ReportSnapshot/CoGeneralInfo/SharesOut" aapl.xml
4745398000.0

2.14. history

Synonyms: h, his

The history command is used to retrieve historical data for a security or other symbol. The data retrieved includes Datetime, Open, High, Low, Close, and Volume

The following parameters are required:

  1. Symbol (see Symbology
  2. What to show: valid choices are midpoint, trades, or adjusted_last. midpoint uses the average of bid and ask, trades uses actual trade data, and adjusted_last is historically adjusted for dividend. midpoint does not contain volume information.
  3. The ending datetime in the format YYYYMMDD[HHMMSS]. You can also use the @today, @yesterday, and @tomorrow macros in place of an actual date.
  4. The number of periods , such as 30d for 30 days, to go back from the ending date. The format is xy where x is the number of periods and y is the type of period, such as s for seconds, d for days, w for weeks, m for months, and y for years. Note there is no period for minutes; use 60s instead.
  5. The bar size, such as 30m for 30 minutes, covered by each bar. Valid choices are 1s, 5s, 10s, 15s, 30s, 1m, 2m, 3m, 5m, 10m, 15m, 20m, 30m, 1h, 2h, 3h, 4h, 8h, 1d, 1w, 1M,

Here’s an example of using history to obtain yesterday’s closing price:

$ clib history spy trades 20180102 1d 1d
Date, Open, High, Low, Close, Volume
2018-01-02, 267.84, 268.81, 267.40, 268.77, 50845800

This example shows how to retrieve hourly historical data for yesterday:

$ clib history spy trades @yesterday 1d 1h
Date, Open, High, Low, Close, Volume
2018-12-20   09:30:00, 249.86, 250.83, 248.89, 250.41, 20049700
2018-12-20   10:00:00, 250.41, 251.62, 249.88, 250.59, 22835200
2018-12-20   11:00:00, 250.59, 250.72, 246.78, 247.66, 25903900
2018-12-20   12:00:00, 247.66, 249.23, 246.91, 248.31, 22797500
2018-12-20   13:00:00, 248.31, 248.37, 246.63, 246.78, 15690200
2018-12-20   14:00:00, 246.79, 249.47, 244.65, 247.92, 40001600
2018-12-20   15:00:00, 247.92, 249.10, 246.13, 247.23, 47569400

This example is the same as above but includes the before-hours and after-hours trading sessions, as specified by the –extended option:

$ clib --extended history spy trades @yesterday 1d 1h
Date, Open, High, Low, Close, Volume
2018-12-20   04:00:00, 250.00, 250.60, 249.48, 250.58, 51600
2018-12-20   05:00:00, 250.64, 251.01, 250.19, 250.59, 71400
2018-12-20   06:00:00, 250.68, 251.67, 250.68, 251.60, 73900
2018-12-20   07:00:00, 251.57, 252.26, 251.15, 251.61, 417200
2018-12-20   08:00:00, 251.60, 251.96, 248.42, 250.25, 1235100
2018-12-20   09:00:00, 250.24, 250.83, 248.89, 250.41, 21238700
2018-12-20   10:00:00, 250.41, 251.62, 249.88, 250.59, 22835200
2018-12-20   11:00:00, 250.59, 250.72, 246.78, 247.66, 25903900
2018-12-20   12:00:00, 247.66, 249.23, 246.91, 248.31, 22797500
2018-12-20   13:00:00, 248.31, 248.37, 246.63, 246.78, 15690200
2018-12-20   14:00:00, 246.79, 249.47, 244.65, 247.92, 40001600
2018-12-20   15:00:00, 247.92, 249.10, 246.13, 247.23, 47569400
2018-12-20   16:00:00, 247.24, 249.19, 247.07, 249.14, 9858300
2018-12-20   17:00:00, 249.09, 249.20, 247.17, 248.85, 2423500
2018-12-20   18:00:00, 248.92, 249.49, 248.65, 248.65, 3297800
2018-12-20   19:00:00, 248.65, 248.65, 247.17, 248.54, 318900

This example retrieves a year’s worth of history:

$ clib history spy trades 20171231 1y 1d
Date, Open, High, Low, Close, Volume
2016-12-30, 224.73, 224.83, 222.73, 223.53, 72735200
2017-01-03, 225.04, 225.83, 223.88, 225.24, 65816900
2017-01-04, 225.62, 226.75, 225.61, 226.58, 53682700
2017-01-05, 226.27, 226.58, 225.48, 226.40, 43631700
2017-01-06, 226.53, 227.75, 225.90, 227.21, 53296500
2017-01-09, 226.91, 227.08, 226.41, 226.46, 34343700
2017-01-10, 226.48, 227.45, 226.01, 226.46, 45365900
2017-01-11, 226.36, 227.07, 225.59, 227.10, 60106400
2017-01-12, 226.50, 226.75, 224.95, 226.53, 59432700
2017-01-13, 226.73, 227.40, 226.69, 227.05, 42883000
2017-01-17, 226.31, 226.78, 225.80, 226.25, 44397600
2017-01-18, 226.54, 226.80, 225.90, 226.75, 42486500
2017-01-19, 226.84, 227.00, 225.41, 225.91, 47426900
2017-01-20, 226.70, 227.31, 226.05, 226.74, 68552700
2017-01-23, 226.35, 226.81, 225.27, 226.15, 49394800
2017-01-24, 226.40, 228.08, 226.27, 227.60, 50073300
2017-01-25, 228.70, 229.57, 228.51, 229.57, 55937200
2017-01-26, 229.40, 229.71, 229.01, 229.33, 39634600
2017-01-27, 229.42, 229.59, 228.76, 228.97, 34691800
2017-01-30, 228.17, 228.20, 226.41, 227.55, 62132400
2017-01-31, 226.98, 227.60, 226.32, 227.53, 54079900
2017-02-01, 228.25, 228.59, 226.94, 227.62, 60059600
2017-02-02, 227.20, 228.10, 226.82, 227.77, 51007700
2017-02-03, 228.81, 229.55, 228.46, 229.34, 54487200
2017-02-06, 228.87, 229.33, 228.54, 228.93, 37438900
2017-02-07, 229.38, 229.66, 228.72, 228.94, 36963300
2017-02-08, 228.61, 229.39, 228.31, 229.24, 37837000
2017-02-09, 229.56, 230.95, 229.52, 230.60, 45521300
2017-02-10, 231.02, 231.77, 230.88, 231.51, 44461300
2017-02-13, 232.08, 233.07, 232.05, 232.77, 42342100
2017-02-14, 232.56, 233.71, 232.16, 233.70, 50850000
2017-02-15, 233.45, 235.14, 233.39, 234.92, 61473600
2017-02-16, 234.96, 235.16, 233.85, 234.72, 66786200
2017-02-17, 233.95, 235.07, 233.93, 235.09, 48329800
2017-02-21, 235.52, 236.69, 235.51, 236.49, 52838400
2017-02-22, 236.02, 236.54, 235.83, 236.28, 39266200
2017-02-23, 236.88, 236.90, 235.56, 236.44, 62442100
2017-02-24, 235.46, 236.80, 235.41, 236.74, 57964700
2017-02-27, 236.63, 237.31, 236.35, 237.11, 41659100
2017-02-28, 236.67, 236.95, 236.01, 236.47, 59059300
2017-03-01, 238.38, 240.32, 238.37, 239.78, 79898900
2017-03-02, 239.56, 239.57, 238.21, 238.27, 55178700
2017-03-03, 238.17, 238.61, 237.73, 238.42, 45071500
2017-03-06, 237.50, 238.12, 237.01, 237.71, 38523700
2017-03-07, 237.35, 237.77, 236.76, 237.00, 39725800
2017-03-08, 237.32, 237.64, 236.40, 236.56, 54523000
2017-03-09, 236.68, 237.24, 235.74, 236.86, 58603300
2017-03-10, 237.97, 238.02, 236.59, 237.69, 57074500
2017-03-13, 237.62, 237.86, 237.24, 237.81, 38759600
2017-03-14, 237.20, 237.24, 236.19, 236.90, 45468800
2017-03-15, 237.56, 239.44, 237.29, 238.95, 68195800
2017-03-16, 239.11, 239.20, 238.10, 238.48, 52399400
2017-03-17, 237.75, 237.97, 237.07, 237.03, 50207400
2017-03-20, 237.03, 237.36, 236.32, 236.77, 37736300
2017-03-21, 237.47, 237.61, 233.58, 233.73, 102884600
2017-03-22, 233.77, 234.61, 233.05, 234.28, 70252300
2017-03-23, 233.99, 235.34, 233.60, 234.03, 76535500
2017-03-24, 234.38, 235.04, 232.96, 233.86, 82182100
2017-03-27, 231.93, 233.92, 231.61, 233.62, 67181400
2017-03-28, 233.27, 235.81, 233.14, 235.32, 64554400
2017-03-29, 235.01, 235.81, 234.72, 235.54, 40664000
2017-03-30, 235.49, 236.52, 235.27, 236.29, 40604900
2017-03-31, 235.91, 236.51, 235.68, 235.74, 47612100
2017-04-03, 235.80, 236.03, 233.91, 235.33, 58628000
2017-04-04, 235.00, 235.58, 234.55, 235.48, 43130700
2017-04-05, 236.26, 237.39, 234.54, 234.78, 84819600
2017-04-06, 234.95, 236.04, 234.42, 235.44, 53572400
2017-04-07, 235.15, 236.00, 234.64, 235.20, 53294000
2017-04-10, 235.36, 236.26, 234.73, 235.34, 46610500
2017-04-11, 234.87, 235.18, 233.34, 235.06, 63952200
2017-04-12, 234.74, 234.96, 233.77, 234.03, 55427800
2017-04-13, 233.63, 234.49, 232.54, 232.51, 63217700
2017-04-17, 233.11, 234.57, 232.88, 234.57, 46820000
2017-04-18, 233.71, 234.49, 233.08, 233.87, 52794000
2017-04-19, 234.52, 234.95, 233.18, 233.44, 53759300
2017-04-20, 234.15, 235.85, 233.78, 235.34, 65462900
2017-04-21, 235.25, 235.31, 234.13, 234.59, 54069300
2017-04-24, 237.18, 237.41, 236.61, 237.17, 72981900
2017-04-25, 237.91, 238.95, 237.81, 238.55, 55752300
2017-04-26, 238.53, 239.53, 238.35, 238.40, 57950100
2017-04-27, 238.78, 238.95, 237.98, 238.60, 39577700
2017-04-28, 238.90, 238.93, 237.93, 238.08, 42264700
2017-05-01, 238.69, 239.17, 238.19, 238.68, 38750600
2017-05-02, 238.84, 238.98, 238.30, 238.77, 39563800
2017-05-03, 238.32, 238.88, 237.70, 238.48, 47293100
2017-05-04, 238.83, 238.93, 237.78, 238.76, 46170500
2017-05-05, 239.18, 239.72, 238.68, 239.70, 43732900
2017-05-08, 239.76, 239.92, 239.17, 239.66, 32087900
2017-05-09, 239.96, 240.19, 239.04, 239.44, 39723800
2017-05-10, 239.38, 239.87, 239.15, 239.87, 34223000
2017-05-11, 239.35, 239.57, 238.13, 239.38, 45435700
2017-05-12, 239.09, 239.21, 238.67, 238.98, 35283500
2017-05-15, 239.47, 240.44, 239.45, 240.30, 42331100
2017-05-16, 240.62, 240.67, 239.63, 240.08, 37206100
2017-05-17, 238.10, 238.64, 235.75, 235.82, 118615600
2017-05-18, 235.70, 237.75, 235.43, 236.77, 82965400
2017-05-19, 237.33, 239.08, 237.27, 238.31, 69369300
2017-05-22, 238.90, 239.71, 238.82, 239.52, 37631100
2017-05-23, 239.95, 240.24, 239.51, 240.05, 36771600
2017-05-24, 240.32, 240.73, 239.93, 240.61, 37424900
2017-05-25, 241.20, 242.08, 240.96, 241.76, 45278700
2017-05-26, 241.55, 241.90, 241.45, 241.71, 30002000
2017-05-30, 241.33, 241.79, 241.16, 241.50, 28437300
2017-05-31, 241.84, 241.88, 240.64, 241.44, 59150500
2017-06-01, 241.96, 243.34, 241.64, 243.36, 50892600
2017-06-02, 243.41, 244.35, 243.08, 244.17, 50298800
2017-06-05, 243.98, 244.30, 243.76, 243.99, 27596400
2017-06-06, 243.31, 243.98, 243.12, 243.21, 36565300
2017-06-07, 243.60, 243.92, 242.83, 243.66, 38602600
2017-06-08, 243.77, 244.33, 243.17, 243.78, 48051300
2017-06-09, 244.09, 245.01, 241.95, 243.41, 103578200
2017-06-12, 243.14, 243.42, 242.38, 243.36, 57096500
2017-06-13, 243.99, 244.61, 243.57, 244.55, 43470500
2017-06-14, 244.86, 244.87, 243.29, 244.24, 55101500
2017-06-15, 242.68, 243.91, 242.36, 243.77, 51519200
2017-06-16, 242.77, 242.83, 241.63, 242.64, 48987400
2017-06-19, 243.59, 244.73, 243.48, 244.66, 42503600
2017-06-20, 244.25, 244.26, 242.99, 243.01, 39206800
2017-06-21, 243.43, 243.59, 242.41, 242.95, 42749800
2017-06-22, 242.97, 243.53, 242.64, 242.84, 32991300
2017-06-23, 242.91, 243.51, 242.47, 243.13, 45792600
2017-06-26, 243.89, 244.38, 243.04, 243.29, 43153800
2017-06-27, 243.04, 243.38, 241.31, 241.33, 60858300
2017-06-28, 242.50, 243.72, 242.23, 243.49, 50077300
2017-06-29, 243.66, 243.72, 239.95, 241.35, 87799500
2017-06-30, 242.26, 242.71, 241.57, 241.80, 50347400
2017-07-03, 242.91, 243.38, 242.29, 242.21, 27272100
2017-07-05, 242.62, 243.01, 241.70, 242.77, 41068700
2017-07-06, 241.88, 242.03, 240.34, 240.55, 52390000
2017-07-07, 241.21, 242.28, 241.02, 242.11, 36833200
2017-07-10, 241.95, 242.80, 241.76, 242.37, 27917400
2017-07-11, 242.16, 242.55, 240.85, 242.19, 40920200
2017-07-12, 243.30, 244.20, 243.30, 244.01, 38804500
2017-07-13, 244.02, 244.55, 243.76, 244.42, 29908800
2017-07-14, 244.42, 245.97, 244.31, 245.56, 40814100
2017-07-17, 245.47, 245.91, 245.33, 245.53, 22399700
2017-07-18, 245.06, 245.72, 244.67, 245.66, 31705300
2017-07-19, 246.02, 247.00, 246.01, 246.99, 31007700
2017-07-20, 247.28, 247.42, 246.47, 247.10, 33660600
2017-07-21, 246.45, 246.91, 246.18, 246.88, 38773800
2017-07-24, 246.79, 246.98, 246.28, 246.82, 28662000
2017-07-25, 247.68, 247.80, 247.16, 247.42, 35713900
2017-07-26, 247.75, 247.79, 247.13, 247.43, 34673100
2017-07-27, 247.96, 248.00, 245.68, 247.20, 56650500
2017-07-28, 246.65, 247.06, 246.13, 246.91, 36164800
2017-07-31, 247.37, 247.48, 246.53, 246.77, 36239500
2017-08-01, 247.46, 247.50, 246.71, 247.32, 33212000
2017-08-02, 247.48, 247.60, 246.37, 247.44, 37142800
2017-08-03, 247.31, 247.34, 246.64, 246.96, 29202200
2017-08-04, 247.52, 247.79, 246.97, 247.41, 39151600
2017-08-07, 247.49, 247.87, 247.37, 247.87, 20901900
2017-08-08, 247.51, 248.91, 246.83, 247.26, 44662400
2017-08-09, 246.47, 247.31, 246.06, 247.25, 48559600
2017-08-10, 246.28, 246.44, 243.70, 243.76, 87927200
2017-08-11, 244.02, 244.80, 243.75, 244.12, 56557000
2017-08-14, 245.59, 246.79, 245.55, 246.54, 49087300
2017-08-15, 246.98, 247.00, 246.16, 246.51, 35283200
2017-08-16, 247.11, 247.57, 246.45, 246.94, 45032000
2017-08-17, 246.24, 246.60, 243.10, 243.09, 89496300
2017-08-18, 242.90, 244.19, 242.20, 242.71, 86285500
2017-08-21, 242.64, 243.20, 241.83, 242.90, 47865000
2017-08-22, 243.58, 245.62, 243.55, 245.44, 49447800
2017-08-23, 244.35, 245.05, 244.16, 244.56, 33791700
2017-08-24, 245.00, 245.18, 243.75, 243.99, 40692400
2017-08-25, 244.90, 245.61, 244.39, 244.56, 44552100
2017-08-28, 245.13, 245.20, 244.09, 244.57, 24828500
2017-08-29, 243.11, 245.15, 242.93, 244.85, 40455500
2017-08-30, 244.83, 246.32, 244.62, 246.01, 40191200
2017-08-31, 246.73, 247.77, 246.61, 247.49, 52610100
2017-09-01, 247.92, 248.33, 247.67, 247.84, 39613500
2017-09-05, 247.24, 247.52, 244.95, 246.06, 66632500
2017-09-06, 246.84, 247.28, 246.23, 246.90, 44579700
2017-09-07, 247.26, 247.27, 246.40, 246.87, 38571300
2017-09-08, 246.53, 247.11, 246.30, 246.58, 39329000
2017-09-11, 248.04, 249.30, 248.02, 249.21, 48788800
2017-09-12, 249.63, 250.07, 249.42, 250.05, 42768500
2017-09-13, 249.73, 250.21, 249.59, 250.17, 30866200
2017-09-14, 249.79, 250.32, 249.60, 250.09, 40844700
2017-09-15, 248.69, 249.29, 248.57, 249.19, 41701700
2017-09-18, 249.61, 250.12, 249.28, 249.72, 31229800
2017-09-19, 250.00, 250.07, 249.60, 249.97, 25489000
2017-09-20, 250.06, 250.19, 248.92, 250.06, 42783400
2017-09-21, 249.89, 249.98, 249.18, 249.39, 29184700
2017-09-22, 249.05, 249.63, 249.02, 249.44, 31078500
2017-09-25, 249.14, 249.56, 248.08, 248.93, 42816500
2017-09-26, 249.42, 249.70, 248.80, 249.08, 36756900
2017-09-27, 249.88, 250.49, 248.87, 250.05, 51453300
2017-09-28, 249.73, 250.44, 249.63, 250.35, 25569700
2017-09-29, 250.34, 251.32, 250.13, 251.23, 41424100
2017-10-02, 251.49, 252.30, 251.29, 252.32, 37463700
2017-10-03, 252.46, 252.89, 252.23, 252.86, 33869200
2017-10-04, 252.70, 253.44, 252.56, 253.16, 30226100
2017-10-05, 253.51, 254.68, 253.40, 254.66, 45348900
2017-10-06, 254.15, 254.46, 253.85, 254.37, 40714100
2017-10-09, 254.63, 254.70, 253.65, 253.95, 23492400
2017-10-10, 254.62, 255.05, 253.98, 254.62, 28249900
2017-10-11, 254.51, 255.02, 254.32, 255.02, 24704700
2017-10-12, 254.66, 255.06, 254.36, 254.64, 32195900
2017-10-13, 255.14, 255.27, 254.64, 254.95, 33555600
2017-10-16, 255.22, 255.51, 254.82, 255.29, 25329300
2017-10-17, 255.24, 255.52, 254.98, 255.47, 23608800
2017-10-18, 255.90, 255.95, 255.50, 255.72, 25173800
2017-10-19, 254.82, 255.82, 254.35, 255.79, 41420600
2017-10-20, 256.70, 257.14, 256.42, 257.11, 41154800
2017-10-23, 257.48, 257.51, 256.02, 256.11, 36347700
2017-10-24, 256.59, 256.83, 256.15, 256.56, 44465300
2017-10-25, 256.19, 256.31, 254.00, 255.29, 72221000
2017-10-26, 255.99, 256.30, 255.56, 255.62, 37724900
2017-10-27, 256.50, 257.89, 256.16, 257.71, 49914600
2017-10-30, 257.07, 257.60, 256.41, 256.75, 37107800
2017-10-31, 257.18, 257.44, 256.80, 257.15, 35713000
2017-11-01, 258.04, 258.43, 257.07, 257.49, 40454200
2017-11-02, 257.41, 257.75, 256.19, 257.59, 42414200
2017-11-03, 257.78, 258.50, 257.30, 258.45, 38007400
2017-11-06, 258.29, 259.00, 258.22, 258.85, 22669200
2017-11-07, 258.97, 259.35, 258.09, 258.67, 40161200
2017-11-08, 258.46, 259.22, 258.15, 259.11, 32193700
2017-11-09, 257.73, 258.39, 256.36, 258.17, 75307300
2017-11-10, 257.73, 258.21, 257.37, 258.09, 35744100
2017-11-13, 257.32, 258.59, 257.27, 258.33, 32425600
2017-11-14, 257.40, 257.85, 256.52, 257.73, 40944400
2017-11-15, 256.62, 257.22, 255.63, 256.44, 55527000
2017-11-16, 257.52, 259.04, 257.47, 258.62, 57927000
2017-11-17, 258.22, 258.44, 257.77, 257.86, 42067700
2017-11-20, 258.14, 258.53, 257.86, 258.30, 29350100
2017-11-21, 259.18, 260.20, 259.09, 259.99, 42318200
2017-11-22, 260.03, 260.15, 259.57, 259.76, 27600000
2017-11-24, 260.28, 260.48, 260.16, 260.36, 16321200
2017-11-27, 260.41, 260.75, 260.00, 260.23, 29726700
2017-11-28, 260.76, 262.90, 260.65, 262.87, 57817600
2017-11-29, 263.02, 263.63, 262.20, 262.71, 51223500
2017-11-30, 263.76, 266.05, 263.67, 265.01, 82842200
2017-12-01, 264.77, 265.31, 260.76, 264.46, 129828300
2017-12-04, 266.31, 266.80, 264.12, 264.14, 65823100
2017-12-05, 264.43, 265.15, 263.04, 263.19, 60164000
2017-12-06, 262.87, 263.73, 262.71, 263.24, 40840700
2017-12-07, 263.09, 264.43, 262.94, 264.07, 40145300
2017-12-08, 265.01, 265.52, 264.72, 265.51, 40960700
2017-12-11, 265.57, 266.38, 265.49, 266.31, 38139100
2017-12-12, 266.57, 267.32, 266.34, 266.78, 46507100
2017-12-13, 267.06, 267.56, 266.65, 266.75, 48965800
2017-12-14, 267.12, 267.22, 265.60, 265.66, 57350800
2017-12-15, 265.45, 267.04, 265.39, 266.51, 59281700
2017-12-18, 268.08, 268.60, 267.98, 268.20, 45671500
2017-12-19, 268.48, 268.53, 267.09, 267.17, 46993700
2017-12-20, 268.25, 268.33, 266.69, 267.03, 42145600
2017-12-21, 267.73, 268.39, 267.30, 267.58, 35004600
2017-12-22, 267.59, 267.64, 266.90, 267.51, 36583500
2017-12-26, 267.06, 267.39, 266.88, 267.19, 24881200
2017-12-27, 267.36, 267.73, 267.01, 267.32, 32569200
2017-12-28, 267.85, 267.92, 267.45, 267.87, 23583400
2017-12-29, 268.55, 268.55, 266.64, 266.86, 43875600

As you can see in the example above, Interactive Brokers returned an extra day at the beginning of the series. Instead of requesting 1y, we can instead request 251 days, as follows:

$ clib history spy trades 20171231 251d 1d
Date, Open, High, Low, Close, Volume
2017-01-03, 225.04, 225.83, 223.88, 225.24, 65816900
2017-01-04, 225.62, 226.75, 225.61, 226.58, 53682700
2017-01-05, 226.27, 226.58, 225.48, 226.40, 43631700
2017-01-06, 226.53, 227.75, 225.90, 227.21, 53296500
2017-01-09, 226.91, 227.08, 226.41, 226.46, 34343700
2017-01-10, 226.48, 227.45, 226.01, 226.46, 45365900
2017-01-11, 226.36, 227.07, 225.59, 227.10, 60106400
2017-01-12, 226.50, 226.75, 224.95, 226.53, 59432700
2017-01-13, 226.73, 227.40, 226.69, 227.05, 42883000
2017-01-17, 226.31, 226.78, 225.80, 226.25, 44397600
2017-01-18, 226.54, 226.80, 225.90, 226.75, 42486500
2017-01-19, 226.84, 227.00, 225.41, 225.91, 47426900
2017-01-20, 226.70, 227.31, 226.05, 226.74, 68552700
2017-01-23, 226.35, 226.81, 225.27, 226.15, 49394800
2017-01-24, 226.40, 228.08, 226.27, 227.60, 50073300
2017-01-25, 228.70, 229.57, 228.51, 229.57, 55937200
2017-01-26, 229.40, 229.71, 229.01, 229.33, 39634600
2017-01-27, 229.42, 229.59, 228.76, 228.97, 34691800
2017-01-30, 228.17, 228.20, 226.41, 227.55, 62132400
2017-01-31, 226.98, 227.60, 226.32, 227.53, 54079900
2017-02-01, 228.25, 228.59, 226.94, 227.62, 60059600
2017-02-02, 227.20, 228.10, 226.82, 227.77, 51007700
2017-02-03, 228.81, 229.55, 228.46, 229.34, 54487200
2017-02-06, 228.87, 229.33, 228.54, 228.93, 37438900
2017-02-07, 229.38, 229.66, 228.72, 228.94, 36963300
2017-02-08, 228.61, 229.39, 228.31, 229.24, 37837000
2017-02-09, 229.56, 230.95, 229.52, 230.60, 45521300
2017-02-10, 231.02, 231.77, 230.88, 231.51, 44461300
2017-02-13, 232.08, 233.07, 232.05, 232.77, 42342100
2017-02-14, 232.56, 233.71, 232.16, 233.70, 50850000
2017-02-15, 233.45, 235.14, 233.39, 234.92, 61473600
2017-02-16, 234.96, 235.16, 233.85, 234.72, 66786200
2017-02-17, 233.95, 235.07, 233.93, 235.09, 48329800
2017-02-21, 235.52, 236.69, 235.51, 236.49, 52838400
2017-02-22, 236.02, 236.54, 235.83, 236.28, 39266200
2017-02-23, 236.88, 236.90, 235.56, 236.44, 62442100
2017-02-24, 235.46, 236.80, 235.41, 236.74, 57964700
2017-02-27, 236.63, 237.31, 236.35, 237.11, 41659100
2017-02-28, 236.67, 236.95, 236.01, 236.47, 59059300
2017-03-01, 238.38, 240.32, 238.37, 239.78, 79898900
2017-03-02, 239.56, 239.57, 238.21, 238.27, 55178700
2017-03-03, 238.17, 238.61, 237.73, 238.42, 45071500
2017-03-06, 237.50, 238.12, 237.01, 237.71, 38523700
2017-03-07, 237.35, 237.77, 236.76, 237.00, 39725800
2017-03-08, 237.32, 237.64, 236.40, 236.56, 54523000
2017-03-09, 236.68, 237.24, 235.74, 236.86, 58603300
2017-03-10, 237.97, 238.02, 236.59, 237.69, 57074500
2017-03-13, 237.62, 237.86, 237.24, 237.81, 38759600
2017-03-14, 237.20, 237.24, 236.19, 236.90, 45468800
2017-03-15, 237.56, 239.44, 237.29, 238.95, 68195800
2017-03-16, 239.11, 239.20, 238.10, 238.48, 52399400
2017-03-17, 237.75, 237.97, 237.07, 237.03, 50207400
2017-03-20, 237.03, 237.36, 236.32, 236.77, 37736300
2017-03-21, 237.47, 237.61, 233.58, 233.73, 102884600
2017-03-22, 233.77, 234.61, 233.05, 234.28, 70252300
2017-03-23, 233.99, 235.34, 233.60, 234.03, 76535500
2017-03-24, 234.38, 235.04, 232.96, 233.86, 82182100
2017-03-27, 231.93, 233.92, 231.61, 233.62, 67181400
2017-03-28, 233.27, 235.81, 233.14, 235.32, 64554400
2017-03-29, 235.01, 235.81, 234.72, 235.54, 40664000
2017-03-30, 235.49, 236.52, 235.27, 236.29, 40604900
2017-03-31, 235.91, 236.51, 235.68, 235.74, 47612100
2017-04-03, 235.80, 236.03, 233.91, 235.33, 58628000
2017-04-04, 235.00, 235.58, 234.55, 235.48, 43130700
2017-04-05, 236.26, 237.39, 234.54, 234.78, 84819600
2017-04-06, 234.95, 236.04, 234.42, 235.44, 53572400
2017-04-07, 235.15, 236.00, 234.64, 235.20, 53294000
2017-04-10, 235.36, 236.26, 234.73, 235.34, 46610500
2017-04-11, 234.87, 235.18, 233.34, 235.06, 63952200
2017-04-12, 234.74, 234.96, 233.77, 234.03, 55427800
2017-04-13, 233.63, 234.49, 232.54, 232.51, 63217700
2017-04-17, 233.11, 234.57, 232.88, 234.57, 46820000
2017-04-18, 233.71, 234.49, 233.08, 233.87, 52794000
2017-04-19, 234.52, 234.95, 233.18, 233.44, 53759300
2017-04-20, 234.15, 235.85, 233.78, 235.34, 65462900
2017-04-21, 235.25, 235.31, 234.13, 234.59, 54069300
2017-04-24, 237.18, 237.41, 236.61, 237.17, 72981900
2017-04-25, 237.91, 238.95, 237.81, 238.55, 55752300
2017-04-26, 238.53, 239.53, 238.35, 238.40, 57950100
2017-04-27, 238.78, 238.95, 237.98, 238.60, 39577700
2017-04-28, 238.90, 238.93, 237.93, 238.08, 42264700
2017-05-01, 238.69, 239.17, 238.19, 238.68, 38750600
2017-05-02, 238.84, 238.98, 238.30, 238.77, 39563800
2017-05-03, 238.32, 238.88, 237.70, 238.48, 47293100
2017-05-04, 238.83, 238.93, 237.78, 238.76, 46170500
2017-05-05, 239.18, 239.72, 238.68, 239.70, 43732900
2017-05-08, 239.76, 239.92, 239.17, 239.66, 32087900
2017-05-09, 239.96, 240.19, 239.04, 239.44, 39723800
2017-05-10, 239.38, 239.87, 239.15, 239.87, 34223000
2017-05-11, 239.35, 239.57, 238.13, 239.38, 45435700
2017-05-12, 239.09, 239.21, 238.67, 238.98, 35283500
2017-05-15, 239.47, 240.44, 239.45, 240.30, 42331100
2017-05-16, 240.62, 240.67, 239.63, 240.08, 37206100
2017-05-17, 238.10, 238.64, 235.75, 235.82, 118615600
2017-05-18, 235.70, 237.75, 235.43, 236.77, 82965400
2017-05-19, 237.33, 239.08, 237.27, 238.31, 69369300
2017-05-22, 238.90, 239.71, 238.82, 239.52, 37631100
2017-05-23, 239.95, 240.24, 239.51, 240.05, 36771600
2017-05-24, 240.32, 240.73, 239.93, 240.61, 37424900
2017-05-25, 241.20, 242.08, 240.96, 241.76, 45278700
2017-05-26, 241.55, 241.90, 241.45, 241.71, 30002000
2017-05-30, 241.33, 241.79, 241.16, 241.50, 28437300
2017-05-31, 241.84, 241.88, 240.64, 241.44, 59150500
2017-06-01, 241.96, 243.34, 241.64, 243.36, 50892600
2017-06-02, 243.41, 244.35, 243.08, 244.17, 50298800
2017-06-05, 243.98, 244.30, 243.76, 243.99, 27596400
2017-06-06, 243.31, 243.98, 243.12, 243.21, 36565300
2017-06-07, 243.60, 243.92, 242.83, 243.66, 38602600
2017-06-08, 243.77, 244.33, 243.17, 243.78, 48051300
2017-06-09, 244.09, 245.01, 241.95, 243.41, 103578200
2017-06-12, 243.14, 243.42, 242.38, 243.36, 57096500
2017-06-13, 243.99, 244.61, 243.57, 244.55, 43470500
2017-06-14, 244.86, 244.87, 243.29, 244.24, 55101500
2017-06-15, 242.68, 243.91, 242.36, 243.77, 51519200
2017-06-16, 242.77, 242.83, 241.63, 242.64, 48987400
2017-06-19, 243.59, 244.73, 243.48, 244.66, 42503600
2017-06-20, 244.25, 244.26, 242.99, 243.01, 39206800
2017-06-21, 243.43, 243.59, 242.41, 242.95, 42749800
2017-06-22, 242.97, 243.53, 242.64, 242.84, 32991300
2017-06-23, 242.91, 243.51, 242.47, 243.13, 45792600
2017-06-26, 243.89, 244.38, 243.04, 243.29, 43153800
2017-06-27, 243.04, 243.38, 241.31, 241.33, 60858300
2017-06-28, 242.50, 243.72, 242.23, 243.49, 50077300
2017-06-29, 243.66, 243.72, 239.95, 241.35, 87799500
2017-06-30, 242.26, 242.71, 241.57, 241.80, 50347400
2017-07-03, 242.91, 243.38, 242.29, 242.21, 27272100
2017-07-05, 242.62, 243.01, 241.70, 242.77, 41068700
2017-07-06, 241.88, 242.03, 240.34, 240.55, 52390000
2017-07-07, 241.21, 242.28, 241.02, 242.11, 36833200
2017-07-10, 241.95, 242.80, 241.76, 242.37, 27917400
2017-07-11, 242.16, 242.55, 240.85, 242.19, 40920200
2017-07-12, 243.30, 244.20, 243.30, 244.01, 38804500
2017-07-13, 244.02, 244.55, 243.76, 244.42, 29908800
2017-07-14, 244.42, 245.97, 244.31, 245.56, 40814100
2017-07-17, 245.47, 245.91, 245.33, 245.53, 22399700
2017-07-18, 245.06, 245.72, 244.67, 245.66, 31705300
2017-07-19, 246.02, 247.00, 246.01, 246.99, 31007700
2017-07-20, 247.28, 247.42, 246.47, 247.10, 33660600
2017-07-21, 246.45, 246.91, 246.18, 246.88, 38773800
2017-07-24, 246.79, 246.98, 246.28, 246.82, 28662000
2017-07-25, 247.68, 247.80, 247.16, 247.42, 35713900
2017-07-26, 247.75, 247.79, 247.13, 247.43, 34673100
2017-07-27, 247.96, 248.00, 245.68, 247.20, 56650500
2017-07-28, 246.65, 247.06, 246.13, 246.91, 36164800
2017-07-31, 247.37, 247.48, 246.53, 246.77, 36239500
2017-08-01, 247.46, 247.50, 246.71, 247.32, 33212000
2017-08-02, 247.48, 247.60, 246.37, 247.44, 37142800
2017-08-03, 247.31, 247.34, 246.64, 246.96, 29202200
2017-08-04, 247.52, 247.79, 246.97, 247.41, 39151600
2017-08-07, 247.49, 247.87, 247.37, 247.87, 20901900
2017-08-08, 247.51, 248.91, 246.83, 247.26, 44662400
2017-08-09, 246.47, 247.31, 246.06, 247.25, 48559600
2017-08-10, 246.28, 246.44, 243.70, 243.76, 87927200
2017-08-11, 244.02, 244.80, 243.75, 244.12, 56557000
2017-08-14, 245.59, 246.79, 245.55, 246.54, 49087300
2017-08-15, 246.98, 247.00, 246.16, 246.51, 35283200
2017-08-16, 247.11, 247.57, 246.45, 246.94, 45032000
2017-08-17, 246.24, 246.60, 243.10, 243.09, 89496300
2017-08-18, 242.90, 244.19, 242.20, 242.71, 86285500
2017-08-21, 242.64, 243.20, 241.83, 242.90, 47865000
2017-08-22, 243.58, 245.62, 243.55, 245.44, 49447800
2017-08-23, 244.35, 245.05, 244.16, 244.56, 33791700
2017-08-24, 245.00, 245.18, 243.75, 243.99, 40692400
2017-08-25, 244.90, 245.61, 244.39, 244.56, 44552100
2017-08-28, 245.13, 245.20, 244.09, 244.57, 24828500
2017-08-29, 243.11, 245.15, 242.93, 244.85, 40455500
2017-08-30, 244.83, 246.32, 244.62, 246.01, 40191200
2017-08-31, 246.73, 247.77, 246.61, 247.49, 52610100
2017-09-01, 247.92, 248.33, 247.67, 247.84, 39613500
2017-09-05, 247.24, 247.52, 244.95, 246.06, 66632500
2017-09-06, 246.84, 247.28, 246.23, 246.90, 44579700
2017-09-07, 247.26, 247.27, 246.40, 246.87, 38571300
2017-09-08, 246.53, 247.11, 246.30, 246.58, 39329000
2017-09-11, 248.04, 249.30, 248.02, 249.21, 48788800
2017-09-12, 249.63, 250.07, 249.42, 250.05, 42768500
2017-09-13, 249.73, 250.21, 249.59, 250.17, 30866200
2017-09-14, 249.79, 250.32, 249.60, 250.09, 40844700
2017-09-15, 248.69, 249.29, 248.57, 249.19, 41701700
2017-09-18, 249.61, 250.12, 249.28, 249.72, 31229800
2017-09-19, 250.00, 250.07, 249.60, 249.97, 25489000
2017-09-20, 250.06, 250.19, 248.92, 250.06, 42783400
2017-09-21, 249.89, 249.98, 249.18, 249.39, 29184700
2017-09-22, 249.05, 249.63, 249.02, 249.44, 31078500
2017-09-25, 249.14, 249.56, 248.08, 248.93, 42816500
2017-09-26, 249.42, 249.70, 248.80, 249.08, 36756900
2017-09-27, 249.88, 250.49, 248.87, 250.05, 51453300
2017-09-28, 249.73, 250.44, 249.63, 250.35, 25569700
2017-09-29, 250.34, 251.32, 250.13, 251.23, 41424100
2017-10-02, 251.49, 252.30, 251.29, 252.32, 37463700
2017-10-03, 252.46, 252.89, 252.23, 252.86, 33869200
2017-10-04, 252.70, 253.44, 252.56, 253.16, 30226100
2017-10-05, 253.51, 254.68, 253.40, 254.66, 45348900
2017-10-06, 254.15, 254.46, 253.85, 254.37, 40714100
2017-10-09, 254.63, 254.70, 253.65, 253.95, 23492400
2017-10-10, 254.62, 255.05, 253.98, 254.62, 28249900
2017-10-11, 254.51, 255.02, 254.32, 255.02, 24704700
2017-10-12, 254.66, 255.06, 254.36, 254.64, 32195900
2017-10-13, 255.14, 255.27, 254.64, 254.95, 33555600
2017-10-16, 255.22, 255.51, 254.82, 255.29, 25329300
2017-10-17, 255.24, 255.52, 254.98, 255.47, 23608800
2017-10-18, 255.90, 255.95, 255.50, 255.72, 25173800
2017-10-19, 254.82, 255.82, 254.35, 255.79, 41420600
2017-10-20, 256.70, 257.14, 256.42, 257.11, 41154800
2017-10-23, 257.48, 257.51, 256.02, 256.11, 36347700
2017-10-24, 256.59, 256.83, 256.15, 256.56, 44465300
2017-10-25, 256.19, 256.31, 254.00, 255.29, 72221000
2017-10-26, 255.99, 256.30, 255.56, 255.62, 37724900
2017-10-27, 256.50, 257.89, 256.16, 257.71, 49914600
2017-10-30, 257.07, 257.60, 256.41, 256.75, 37107800
2017-10-31, 257.18, 257.44, 256.80, 257.15, 35713000
2017-11-01, 258.04, 258.43, 257.07, 257.49, 40454200
2017-11-02, 257.41, 257.75, 256.19, 257.59, 42414200
2017-11-03, 257.78, 258.50, 257.30, 258.45, 38007400
2017-11-06, 258.29, 259.00, 258.22, 258.85, 22669200
2017-11-07, 258.97, 259.35, 258.09, 258.67, 40161200
2017-11-08, 258.46, 259.22, 258.15, 259.11, 32193700
2017-11-09, 257.73, 258.39, 256.36, 258.17, 75307300
2017-11-10, 257.73, 258.21, 257.37, 258.09, 35744100
2017-11-13, 257.32, 258.59, 257.27, 258.33, 32425600
2017-11-14, 257.40, 257.85, 256.52, 257.73, 40944400
2017-11-15, 256.62, 257.22, 255.63, 256.44, 55527000
2017-11-16, 257.52, 259.04, 257.47, 258.62, 57927000
2017-11-17, 258.22, 258.44, 257.77, 257.86, 42067700
2017-11-20, 258.14, 258.53, 257.86, 258.30, 29350100
2017-11-21, 259.18, 260.20, 259.09, 259.99, 42318200
2017-11-22, 260.03, 260.15, 259.57, 259.76, 27600000
2017-11-24, 260.28, 260.48, 260.16, 260.36, 16321200
2017-11-27, 260.41, 260.75, 260.00, 260.23, 29726700
2017-11-28, 260.76, 262.90, 260.65, 262.87, 57817600
2017-11-29, 263.02, 263.63, 262.20, 262.71, 51223500
2017-11-30, 263.76, 266.05, 263.67, 265.01, 82842200
2017-12-01, 264.77, 265.31, 260.76, 264.46, 129828300
2017-12-04, 266.31, 266.80, 264.12, 264.14, 65823100
2017-12-05, 264.43, 265.15, 263.04, 263.19, 60164000
2017-12-06, 262.87, 263.73, 262.71, 263.24, 40840700
2017-12-07, 263.09, 264.43, 262.94, 264.07, 40145300
2017-12-08, 265.01, 265.52, 264.72, 265.51, 40960700
2017-12-11, 265.57, 266.38, 265.49, 266.31, 38139100
2017-12-12, 266.57, 267.32, 266.34, 266.78, 46507100
2017-12-13, 267.06, 267.56, 266.65, 266.75, 48965800
2017-12-14, 267.12, 267.22, 265.60, 265.66, 57350800
2017-12-15, 265.45, 267.04, 265.39, 266.51, 59281700
2017-12-18, 268.08, 268.60, 267.98, 268.20, 45671500
2017-12-19, 268.48, 268.53, 267.09, 267.17, 46993700
2017-12-20, 268.25, 268.33, 266.69, 267.03, 42145600
2017-12-21, 267.73, 268.39, 267.30, 267.58, 35004600
2017-12-22, 267.59, 267.64, 266.90, 267.51, 36583500
2017-12-26, 267.06, 267.39, 266.88, 267.19, 24881200
2017-12-27, 267.36, 267.73, 267.01, 267.32, 32569200
2017-12-28, 267.85, 267.92, 267.45, 267.87, 23583400
2017-12-29, 268.55, 268.55, 266.64, 266.86, 43875600

2.15. Pacing Violations

Interactive Brokers summarizes their policy on pacing violations like this: “do not request too much data too quick”.

In practice, observe the following: #. Limit requests to 60 within 10 minutes or 1 every 10 seconds. A “sleep” may be useful between requests. #. Break up large requests into smaller requests. In general, a large request is more than several thousand.

Here’s an example of breaking up a historical request. We want minute bars for the last month so we’ll request each one week at a time.

$ clib history spy trades 20181228 1w 1m
Date, Open, High, Low, Close, Volume
2018-12-24   09:30:00, 239.03, 239.62, 238.91, 239.60, 1196900
2018-12-24   09:31:00, 239.61, 239.91, 239.59, 239.76, 832600
...
2018-12-28   15:58:00, 247.38, 247.82, 247.37, 247.69, 1056200
2018-12-28   15:59:00, 247.69, 248.18, 247.36, 247.80, 3960500
$ clib history spy trades 20181221 1w 1m
Date, Open, High, Low, Close, Volume
2018-12-17   09:30:00, 259.43, 259.49, 259.19, 259.27, 695800
2018-12-17   09:31:00, 259.26, 259.28, 258.55, 258.60, 761100
...
2018-12-21   15:58:00, 241.15, 241.26, 240.95, 241.03, 1691700
2018-12-21   15:59:00, 241.03, 241.21, 240.70, 240.71, 3822700
$ clib history spy trades 20181214 1w 1m
Date, Open, High, Low, Close, Volume
2018-12-10   09:30:00, 263.37, 263.48, 263.22, 263.25, 541800
2018-12-10   09:31:00, 263.23, 263.76, 263.20, 263.72, 616100
...
2018-12-14   15:58:00, 260.65, 260.78, 260.49, 260.52, 1160900
2018-12-14   15:59:00, 260.52, 260.59, 260.28, 260.49, 3352300
$ clib history spy trades 20181207 1w 1m
Date, Open, High, Low, Close, Volume
2018-12-03   09:30:00, 280.26, 280.40, 280.21, 280.27, 1283300
2018-12-03   09:31:00, 280.28, 280.28, 279.88, 279.90, 549300
...
2018-12-07   15:58:00, 263.91, 264.07, 263.74, 263.77, 1995400
2018-12-07   15:59:00, 263.77, 264.09, 263.62, 263.65, 2566800

Future: Automatically break up large history reuuests.

2.16. news

Synonyms: None

The news command is used to retrieve headlines relating to a symbol.

The following parameters are supported:

  1. Symbol (see Symbology
  2. Source - An optional news source.
    If none is specified, the brfg news service is used.

Available news sources may be obtained using the newsp command.

The following example demonstrates how to retrieve news headlines for Facebook using the BRFG news source. Once the news article ID is obtained with the news command, the article command is used to retrieve the text of the article.

Note on Linux: The article ID must be enclosed in single quotes to prevent shell expansion of the $ in the article ID.

The final command uses the –no-headings argument to suppress column headings so that valid HTML can be passed to the html2text command.

$ clib --no-headings article 'BRFG$07ba0a4b' | html2text
Facebook (FB+9%) is surging after the company blew out first quarter estimates
on the top and bottom line.
Sentiment on the stock had turned decidedly negative in the wake of the
Cambridge Analytica data scandal. Fears of potential regulation and reduced
engagement on its core platform are being put on the back burner after the
company once again showed that it is an advertising powerhouse.
The numbers are quite staggering. Operating income grew 64% to $5.4 billion
while revenue grew 49% to $12 billion. The first quarter is seasonally
Facebook's slowest.
As we learned when Mark Zuckerberg testified before Congress two weeks ago,
Facebook is taking its role in the world much more seriously these days. As a
result, the company upped expense and capital expenditure guidance towards the
high end of their previous ranges.
Management said 2018 will be an investment year in order to make Facebook
safer. Still, Facebook is expected to grow earnings 22% with revenue up 39% to
$56.6 billion this year. Risk to those estimates appears to be to the upside.
One week ago, the fear was that money making machine would have to be reeled in
to some extent.
What's more, engagement metrics, which were an issue even before the data
privacy scandal, actually improved quarter-over-quarter. Monthly active users
grew 13% to 2.2 billion while daily active users grew 13% to 1.45 billion.
After falling for the first time ever in the fourth quarter, daily active users
in the US and Canada rebounded in the first quarter.
Instagram is firing on all cylinders, well on its way to 1 billion users of its
own. Some might say the $1 billion acquisition of Instagram is Mark
Zuckerberg's savings grace as Facebook has become 'uncool' with younger crowds.
Facebook's integration skills and advertising expertise cannot be understated.
Facebook also plans to build business ecosystems around WhatsApp and Messenger,
both of which have over 1 billion users.
Regulatory risk isn't going away anytime soon for this $500 billion company.
But at 23x earnings estimates and the very realistic potential for earnings
growth acceleration next year, data privacy concerns seem like noise for the
scarily dominant global advertising player.


Copyright (C) 2018 Briefing.com

2.17. newsp

Synonyms: None

The newsp command lists news sources to which you are subscribed.

This command takes no parameters.

Here’s an example of a news source listing:

$ clib newsp
Code, Name
BRFG, Briefing.com General Market Columns
BRFUPDN, Briefing.com Analyst Actions
DJ-RT, Dow Jones Trader News
DJNL, Dow Jones Newsletters
BZ, Benzinga

All accounts have access to the Briefing.com General Market Columns and Briefing.com Analyst Actions news sources. Other news sources can be subscribed for a fee.

Tip: We have found the Dow Jones news subscription to be a low-cost news source with high quality and timely delivery. To subscribe to additional news sources, visit the “Research Subscriptions” page under Account Settings > User Settings on the Interactive Brokers website.

2.18. orders

Synonyms: o

We can use the orders command to list orders which have not yet been executed.

The following parameters are optional:

  1. Order ID - Optionally limit orders shown to just this Order ID

By default, the orders command will show orders only for the default client ID:

$ clib orders

To show orders for all client IDs, specify a –client of 0:

$ clib --client=0 orders

To show orders for a specific client ID, specify –client with the client ID:

$ clib --client=123 orders

2.19. positions

Synonyms: pos, p

We can use the positions command to list the contents of our portfolio.

This command takes no parameters.

Here’s an example:

$ clib positions
Symbol,Quantity,MarketValue,UnrealizedPL
ES, 0, 0, 0
F, 0, 0, 0
RTY, 0, 0, 0
VALE, 0, 0, 0

2.20. quote

Synonyms: q

The quote command will return the last trade price for a symbol. It is actually just a customized version of the data command that is configured to show only last trade price and terminate. Here’s an example:

$ clib quote spy
Last Price
240.36

2.21. scanner

Synonyms: scan

We can use the scanner command to search markets and return the top securities based on filter criteria.

The easiest way to obtain useful scanner data is with one of the predefined scan codes. A scan code is a case-sensitive abbreviation such as MOST_ACTIVE or HOT_BY_VOLUME.

Here’s how we might scan for securities with high volume today:

$ clib scanner HOT_BY_VOLUME
Rank, Symbol, Company
0, SAN PRB, 
1, AXSM, 
2, LXFT, 
3, PCG PRA, 
4, LOXO, 
5, GNMX, 
6, FALN, 
7, MYND, 
8, BTEC, 
9, PEZ, 
10, SLMBP, 
11, CIC, 
12, LEU, 
13, EVI, 
14, CFRX, 
15, NHTC, 
16, LJPC, 
17, TCRZ, 
18, TLC, 
19, IZEA, 
20, BCACR, 
21, YUMA, 
22, LTSL, 
23, CNCR, 
24, ROBT, 

2.22. List of Scan Codes

Here is a non-exhaustive list of scan codes. Some of them may return data and some may not, depending on your data subscriptions.

Scanner Description Scan Code # of Analyst Price Targets (Reuters) Asc SCAN_numPriceTargets_ASC # of Analyst Price Targets (Reuters) Desc SCAN_numPriceTargets_DESC # of Analyst Ratings (Reuters) Asc SCAN_numRatings_ASC # of Analyst Ratings (Reuters) Desc SCAN_numRatings_DESC # Shares Held By Insider Asc SCAN_ihNumSharesInsider_ASC # Shares Held By Insider Desc SCAN_ihNumSharesInsider_DESC # Shares Held By Institutions Asc SCAN_iiNumSharesInstitutional_ASC # Shares Held By Institutions Desc SCAN_iiNumSharesInstitutional_DESC 13-Week High HIGH_VS_13W_HL 13-Week Low LOW_VS_13W_HL 26-Week High HIGH_VS_26W_HL 26-Week Low LOW_VS_26W_HL 52-Week High HIGH_VS_52W_HL 52-Week Low LOW_VS_52W_HL All (Quote Time Asc) COMBO_ALL_QUOTE_TIME_ASC All (Quote Time Desc) COMBO_ALL_QUOTE_TIME_DESC All (Time Asc) COMBO_ALL_TRADE_QUOTE_TIME_ASC All (Time Desc) COMBO_ALL_TRADE_QUOTE_TIME_DESC All (Trade Time Asc) COMBO_ALL_TRADE_TIME_ASC All (Trade Time Desc) COMBO_ALL_TRADE_TIME_DESC All (Volume Asc) COMBO_ALL_VOLUME_ASC All (Volume Desc) COMBO_ALL_VOLUME_DESC Analyst Target/Price Ratio (Reuters) Asc SCAN_avgAnalystTarget2PriceRatio_ASC Analyst Target/Price Ratio (Reuters) Desc SCAN_avgAnalystTarget2PriceRatio_DESC Avg Analyst Price Target (Reuters) Asc SCAN_avgPriceTarget_ASC Avg Analyst Price Target (Reuters) Desc SCAN_avgPriceTarget_DESC Avg Analyst Rating (Reuters) Asc SCAN_avgRating_ASC Avg Analyst Rating (Reuters) Desc SCAN_avgRating_DESC Bearish EMA(20) vs EMA(200) BEARISH_EMA_DIFF_VS_LAST Bearish MACD Histogram BEARISH_MACD_DIST_VS_LAST Bearish PPO Histogram BEARISH_PPO_DIST Bearish Price vs EMA(100) BEARISH_LAST_VS_EMA100 Bearish Price vs EMA(20) BEARISH_LAST_VS_EMA20 Bearish Price vs EMA(200) BEARISH_LAST_VS_EMA200 Bearish Price vs EMA(50) BEARISH_LAST_VS_EMA50 Bullish EMA(20) vs EMA(200) BULLISH_EMA_DIFF_VS_LAST Bullish MACD Histogram BULLISH_MACD_DIST_VS_LAST Bullish PPO Histogram BULLISH_PPO_DIST Bullish Price vs EMA(100) BULLISH_LAST_VS_EMA100 Bullish Price vs EMA(20) BULLISH_LAST_VS_EMA20 Bullish Price vs EMA(200) BULLISH_LAST_VS_EMA200 Bullish Price vs EMA(50) BULLISH_LAST_VS_EMA50 Closest to Limit Up/Down LIMIT_UP_DOWN Fee Rate (High-Low) SCAN_feeRate_DESC Fee Rate (Low-High) SCAN_feeRate_ASC Halted HALTED High 10min Volume HIGH_STVOLUME_10MIN High 3min Volume HIGH_STVOLUME_3MIN High 5min Volume HIGH_STVOLUME_5MIN High Debt/Book (Reuters) HIGH_BOND_DEBT_2_BOOK_RATIO High Debt/Equity HIGH_BOND_DEBT_2_EQUITY_RATIO High Debt/Tang. Book (Reuters) HIGH_BOND_DEBT_2_TAN_BOOK_RATIO High Dividend Yield HIGH_DIVIDEND_YIELD_IB High Equity/Book (Reuters) HIGH_BOND_EQUITY_2_BOOK_RATIO High Equity/Tang. Book (Reuters) HIGH_BOND_EQUITY_2_TAN_BOOK_RATIO High Growth Rate (Reuters) HIGH_GROWTH_RATE High Opt Open Interest P/C Ratio HIGH_OPT_OPEN_INTEREST_PUT_CALL_RATIO High Opt Volume P/C Ratio HIGH_OPT_VOLUME_PUT_CALL_RATIO High Option Imp Vol Over Historical HIGH_OPT_IMP_VOLAT_OVER_HIST High P/E Ratio (Reuters) HIGH_PE_RATIO High Price/Book Ratio (Reuters) HIGH_PRICE_2_BOOK_RATIO High Price/Tang. Book Ratio (Reuters) HIGH_PRICE_2_TAN_BOOK_RATIO High Quick Ratio (Reuters) HIGH_QUICK_RATIO High Return On Equity (Reuters) HIGH_RETURN_ON_EQUITY High Synth Bid Rev Yield HIGH_SYNTH_BID_REV_NAT_YIELD Highest Bid HIGHEST_SLB_BID Highest Option Imp Vol HIGH_OPT_IMP_VOLAT Hot by Buy Imbalance TOP_STOCK_BUY_IMBALANCE_ADV_RATIO Hot by Buy Regulatory Imbalance TOP_STOCK_BUY_REG_IMBALANCE_ADV_RATIO Hot By Opt Volume HOT_BY_OPT_VOLUME Hot By Price Range HOT_BY_PRICE_RANGE Hot by Sell Imbalance TOP_STOCK_SELL_IMBALANCE_ADV_RATIO Hot by Sell Regulatory Imbalance TOP_STOCK_SELL_REG_IMBALANCE_ADV_RATIO Hot Contracts by Price HOT_BY_PRICE Hot Contracts by Volume HOT_BY_VOLUME Insider Shares as % of Float Asc SCAN_ihInsiderOfFloatPerc_ASC Insider Shares as % of Float Desc SCAN_ihInsiderOfFloatPerc_DESC Institutional Shares as % of Float Asc SCAN_iiInstitutionalOfFloatPerc_ASC Institutional Shares as % of Float Desc SCAN_iiInstitutionalOfFloatPerc_DESC Low Debt/Book (Reuters) LOW_BOND_DEBT_2_BOOK_RATIO Low Debt/Equity LOW_BOND_DEBT_2_EQUITY_RATIO Low Debt/Tang. Book (Reuters) LOW_BOND_DEBT_2_TAN_BOOK_RATIO Low Equity/Book (Reuters) LOW_BOND_EQUITY_2_BOOK_RATIO Low Equity/Tang. Book (Reuters) LOW_BOND_EQUITY_2_TAN_BOOK_RATIO Low Growth Rate (Reuters) LOW_GROWTH_RATE Low Opt Open Interest P/C Ratio LOW_OPT_OPEN_INTEREST_PUT_CALL_RATIO Low Opt Volume P/C Ratio LOW_OPT_VOLUME_PUT_CALL_RATIO Low Option Imp Vol Over Historical LOW_OPT_IMP_VOLAT_OVER_HIST Low P/E Ratio (Reuters) LOW_PE_RATIO Low Price/Book Ratio (Reuters) LOW_PRICE_2_BOOK_RATIO Low Price/Tang. Book Ratio (Reuters) LOW_PRICE_2_TAN_BOOK_RATIO Low Quick Ratio (Reuters) LOW_QUICK_RATIO Low Return On Equity (Reuters) LOW_RETURN_ON_EQUITY Low Synth Ask Rev Yield LOW_SYNTH_ASK_REV_NAT_YIELD Lowest Ask LOWEST_SLB_ASK Lowest Option Imp Vol LOW_OPT_IMP_VOLAT Most Active MOST_ACTIVE Most Active ($) MOST_ACTIVE_USD Most Active (Avg $) MOST_ACTIVE_AVG_USD Most Active By Opt Open Interest OPT_OPEN_INTEREST_MOST_ACTIVE Most Active By Opt Volume OPT_VOLUME_MOST_ACTIVE Most Competitive IB Warrants LOW_WAR_REL_IMP_VOLAT Net Social Sentiment (Asc) SCAN_socialSentimentNet_ASC Net Social Sentiment (Desc) SCAN_socialSentimentNet_DESC Not Yet Traded Today NOT_YET_TRADED_TODAY Portfolio Members PORTFOLIO_MEMBERS Portfolio Stats PORTFOLIO_STATS Price vs EMA(100) Change(%) (High-Low) HIGH_LAST_VS_EMA100 Price vs EMA(100) Change(%) (Low-High) LOW_LAST_VS_EMA100 Price vs EMA(20) Change(%) (High-Low) HIGH_LAST_VS_EMA20 Price vs EMA(20) Change(%) (Low-High) LOW_LAST_VS_EMA20 Price vs EMA(200) Change(%) (High-Low) HIGH_LAST_VS_EMA200 Price vs EMA(200) Change(%) (Low-High) LOW_LAST_VS_EMA200 Price vs EMA(50) Change(%) (High-Low) HIGH_LAST_VS_EMA50 Price vs EMA(50) Change(%) (Low-High) LOW_LAST_VS_EMA50 Query PORTFOLIO_QUERY Quotes COMBO_QUOTES Rebate Rate (High-Low) SCAN_rebateRate_DESC Rebate Rate (Low-High) SCAN_rebateRate_ASC Recent Earnings (WSH) WSH_PREV_EARNINGS Recent Event (WSH) WSH_PREV_EVENT Recent Meeting (WSH) WSH_PREV_ANALYST_MEETING Shortable shares (High-Low) SCAN_sharesAvailableNorm_DESC Shortable shares (Low-High) SCAN_sharesAvailableNorm_ASC Social Sentiment Activity (Asc) SCAN_socialSentimentActivity_ASC Social Sentiment Activity (Desc) SCAN_socialSentimentActivity_DESC Top % After-Hours Gainers TOP_AFTER_HOURS_PERC_GAIN Top % After-Hours Losers TOP_AFTER_HOURS_PERC_LOSE Top % Gainers TOP_PERC_GAIN Top % Gainers Since Open TOP_OPEN_PERC_GAIN Top % Losers TOP_PERC_LOSE Top % Losers Since Open TOP_OPEN_PERC_LOSE Top Close-to-Open % Gainers HIGH_OPEN_GAP Top Close-to-Open % Losers LOW_OPEN_GAP Top Option Imp Vol % Gainers TOP_OPT_IMP_VOLAT_GAIN Top Option Imp Vol % Losers TOP_OPT_IMP_VOLAT_LOSE Top Price Range TOP_PRICE_RANGE Top Trade Count TOP_TRADE_COUNT Top Trade Rate TOP_TRADE_RATE Top Volume Rate TOP_VOLUME_RATE Trades COMBO_LATEST_TRADE Upcoming Earnings (WSH) WSH_NEXT_EARNINGS Upcoming Event (WSH) WSH_NEXT_EVENT Upcoming IPO Date Asc FIRST_TRADE_DATE_ASC Upcoming IPO Date Desc FIRST_TRADE_DATE_DESC Upcoming Major Event (WSH) WSH_NEXT_MAJOR_EVENT Upcoming Meeting (WSH) WSH_NEXT_ANALYST_MEETING Volume COMBO_MOST_ACTIVE

2.23. scanp

Synonyms: None

Scanners can support a wide variety of parameters. We can retrieve these parameters in an XML file using the scanp command.

For example, the table above was generated using the scanp command:

$ clib scanp > scanp.xml

And then parsing out the descriptions and scan codes with a tex editor.

2.24. sell

Synonyms: s

See buy and sell

2.25. snap

Synonyns: None

The snap command will return a “snapshot” of current market data for a security. It is actually just a customized version of the data command that is configured to terminate when askSize is received. So unlike the data command, snap does not run until terminated.

Here’s an example:

$ clib snap spy
Tick Type, Price, Size
lastPrice, 254.32
lastSize, 600
volume, 96249500
high, 255.95
low, 251.69
close, 252.39
open, 252.76
bidPrice, 254.31
bidSize, 3600
askPrice, 254.32

2.26. status

The status command will connect to the TWS or IB Gateway and then print status information. Here’s an example:

$ clib status
Host = 192.168.0.103
Port = 4001
Client = 272
Next ID = 1