Uncategorized

How to retrieve the whole option chains from IB using IBridgePy?

As an example, the following code can be used to know the available futures of E-mini S&P 500. “xx” in the code represents the expiry of the futures. def initialize(context): request_data(contractDetails=[symbol(‘FUT,ES,USD,xx’)]) def handle_data(context, data): print data.data[symbol(‘FUT,ES,USD,xx’)].contractDetails exit() Another example is provided to get the option chains of E-mini S&P 500 futures. “xx,xx,xx,xx” in the code represents expiry,

How to retrieve the whole option chains from IB using IBridgePy? Read More »

Great News: IBridgePy on Python 3 is available !

Dear IBridgePy users, Thank you very much for your interest in IBridgePy. We are working very hard to make IBridgePy the easiest Python tool to trade with Interactive Brokers. As promised, we are delighted to announce that IBridgePy on Python 3 is available ! You can download it at www.IBridgePy.com/download and choose IBridgePy_python3_64bit Please contact with

Great News: IBridgePy on Python 3 is available ! Read More »

Do you have any feature for scheduling? Which would be similar to Quantopian schedule_function?

No. The main products that quantopian trades are US equities and they have clear market open and close time. Therefore, quantopian provides schedule_function either before market opens or after market closes. In IBridgePy, you can trade any securities or commodities that IB supports and they may have totally different trading hours. The solution is to

Do you have any feature for scheduling? Which would be similar to Quantopian schedule_function? Read More »

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 »