April 2017

Example of requesting historical data

request_data request_data(historyData= None, realTimePrice = None, contractDetails= None, marketSnapShot=None, waitForFeedbackinSeconds=30,repeat=3) historyData: a list of requests of historical data. Each request is defined by a tuple with three elements, security, timeframe, goBack. IB supports the following timeframes: 1 sec, 5 secs, 15 secs, 30 secs, 1 min, 2 mins, 3 mins, 5 mins, 15 mins, 30 […]

Example of requesting historical data Read More »

Use IBridgePy to place a group order with One Cancel All (OCA)

You can use create_order ( ) and place_combination_orders ( ) to place a bracket order with One Cancel All (OCA) features. Create_Order User create_order to clear define all kinds orders that IB supports using critical parameters. action: “BUY” or “SELL” amount: number of shares security: a security object that is created by symbol ( )

Use IBridgePy to place a group order with One Cancel All (OCA) Read More »

Is there any way for me to save history data using IBridgePy?

A: Yes. The historical data received in IBridgePy from the IB server are saved in data[symbol(‘xxx’)].hist that is a pandas dataframe. Therefore, you can save it to a csv file by pd.dataframe.to_csv(“Path_to_your_local_folder”) and use it later in anyway. Example: Request historical data of AAPL and SPY and save them to local folder. def initialize(context): pass

Is there any way for me to save history data using IBridgePy? Read More »

Add reqHistParam( ) to IBridgePy documentation 4/10/2017

reqHistParam(security=None, barSize=None, goBack=None, endTime=dt.datetime.now()) Use reqHistParam to clearly define the parameters when you request historical data from IB. security: use symbol( ) or symbols( ) or superSymbol( ) to define security barSize: 1 sec, 5 secs, 15 secs, 30 secs, 1 min, 2 mins, 3 mins, 5 mins, 15 mins, 30 mins, 1 hour, 1

Add reqHistParam( ) to IBridgePy documentation 4/10/2017 Read More »

Add superSymbol to IBridgePy documentation 4/8/2017

superSymbol(self, secType=None, symbol=None, currency=’USD’, exchange=’ ‘, primaryExchange=’ ‘, expiry=’ ‘, strike=-1, right=’ ‘, multiplier=-1, includeExpired=False) Create a security object by clearly defining every details. It can be used to define any securities/commodities that are available at IB. secType:  STK, OPT, FUT, IND, CASH; (FOP, BAG, NEWS upon request) symbol: Symbol of securities that are defined by IB

Add superSymbol to IBridgePy documentation 4/8/2017 Read More »