Skip to content
/ ibfetch Public

A Node.js module for fetching historical data from Interactive Brokers.

License

Notifications You must be signed in to change notification settings

heqian/ibfetch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ibfetch

A tool for fetching historical data from Interactive Brokers.

Requirements

You can install both together either via package manager or installer.

Installation

git clone https://github.com/heqian/ibfetch.git
cd ibfetch/
npm install

Usage

  • node index.js combo [symbol]
  • node index.js forex [symbol]
  • node index.js future [symbol] [expiry <YYYYMM|YYYYMMDD>]
  • node index.js option [symbol] [expiry <YYYYMM|YYYYMMDD>] [strike] [right <CALL|PUT|C|P>]
  • node index.js stock [symbol]

Examples

  • node index.js combo FIT
  • node index.js forex EUR
  • node index.js future FIT 201604
  • node index.js option FIT 20160401 20.0 CALL
  • node index.js stock FIT

Step by Step

  1. Launch IB Trader Workstation or IB Gateway;
  2. Open terminal and enter the directory of ibfetch;
  3. Execute any command demostrated in Usage section;
  4. Press Ctrl+C when you think ibfetch has fetched enough data;
  5. A file with name [SYMBOL]_[SECURITY TYPE].csv (e.g., "FIT_OPT.csv") will be generated.

Advanced Configuration

Edit the config.js file

{
	ib: {
		host: "127.0.0.1",	// the IP address of machine running IB Trader Workstation (TWS) or IB Gateway (IBG) 
		clientId: 200,		// any number
		port: 7496			// port number, 7496 (default for TWS) or 4002 (default for IBG)
	},
	what: "MIDPOINT",		// "TRADES", "BID", "ASK", "MIDPOINT"
	size: "1 min"			// bar size of each entry in the .CSV file
	// "1 sec", "5 secs", "15 secs", "30 secs", "1 min", "2 mins", "3 mins", "5 mins", "15 mins", "30 mins", "1 hour", "1 day"
}

About

A Node.js module for fetching historical data from Interactive Brokers.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published