3. Program Options

Many command-line options are available to override program defaults and configuration file defaults.

3.1. –config

Use the config option to tell clib where to find it’s clib.ini file.

3.2. –client

Use the client option to specify a client ID other than the default client ID defined in the configuration file

3.3. –exclude

Synonyms: -e

Use the exclude option to suppress output matching the exclude regular expression.

3.4. –extended

Synonyms: -x

The extended option is used to indicate to certain commands that outside regular trading hours are to be used. Affected commands are: bars, buy, head, history, and sell.

Note: The market order type is not supported in extended hours trading; instead use a limit order.

3.5. –filter

Synonyms: -f

Use the filter option to limit output to lines matching the filter regular expression. For example:

$ clib -f PnL account
RealizedPnL, 2536
UnrealizedPnL, 0

3.6. –host

Synonyms: None

Use the host option to override the TWS or IB Gateway host defined in the configuration file.

For example, if you’re running TWS or IB Gateway on the same machine as clib, then the IP address would be

3.7. –headings

Use the headings option to display column headings as the first line of the output. This typically results in a more readable CSV file and is the default.

See also –no-headings

3.8. –no-headings

Headings may be suppressed with this option. This might be useful when concatinating multiple CSV files, or when the data returned by Interactive Brokers is in HTML format and you wish to pipe to an HTML to text converter.

See the news command for a working example.

3.9. –port

Synonyms: -p

Use the port option to override the TWS or IB Gateway host defined in the configuration file. Typically, this is 7496 for TWS or 4001 for IB Gateway.

3.10. –terminate

Use the terminate option to specify an expression on which to terminate. For an example, see the bars command.

3.11. –timeout

Synonyms: None

Use the timeout option to override the timeout specified in the configuration file. The timeout is the number of seconds clib will wait between messages before cancelling and closing the connection.

Use 0 to run forever.

Some commands take longer to return results than others. History for example, has a default timeout higher than the default timeout.