Trading Evolution

Markets are never wrong - opinions often are

Command line tool for Interactive Brokers

Many times in the past I came across people who needed quick and simple way to send orders to Interactive Brokers. I decided to share command line tool that I use to send orders to TWS and IB Gateway from command line. It can be used in automated trading systems or scripts.

Download:  IbCmdDemo.zip

Few simple examples: 

Buy 100 shares of Facebook at Market

IbCmd.exe /s:FB /pe:Nasdaq

Buy 250 shares of Google at $752.5

IbCmd.exe /s:GOOG /pe:Nasdaq /q:250 /p:752.5

Sell 1 ES (E-Mini S&P 500) at Market

IbCmd.exe /s:ES /e:Globex /t:Future /a:Sell

Full list of parameters for IbCmd 

/ServerIp:<string> IP address of copumter that hosts TWS or TWS Gateway. Default value:'127.0.0.1' (short form /srv)

/ServerPort:<int> Port number. Default value:'7496' (short form /port)

/ClientId:<int> API client id. Default value:'10' (short form /cid)

/Action:{Buy|Sell} Buy or sell. Default value:'Buy' (short form /a)

/Symbol:<string> Symbol of the underlying asset. (short form /s)

/SecurityType:{Stock|Future} Security type. (short form /t)

/Exchange:<string> The order destination, such as SMART. Default value:'SMART' (short form /e)

/PrimaryExchange:<string> To clarify any ambiguity for Smart-routed contracts, include the primary exchange, along with the Smart designation. (short form /pe)

/Quantity:<int> The order quantity. Default is 100 for stocks and 1 for futures. Default value:'0' (short form /q)

/OrderType:{Market|Limit} The order type. Default value:'Market' (short form /ot)

/Price:<decimal>  The price for limit orders. (short form /p)

 

Loading