IB native python API for dummies

Is there a way to use the API to find out the list of all available months for a futures ticker?
For example, for ZN, is there a way to return the list of 201906,201909,201912.... ?
Yes there is. If you define a futures instrument without specifying an expiry date then you will get a list of all contracts which fit your description.
Example: if you specify a contract by only the symbol (ZN), the security type (FUT), the exchange (ECBOT) and the currency (USD) and then use reqContractDetails(contract) you will get all futures contracts which match this incomplete contract specification. This information is sent by IB to the method contractDetails() which you need to override for your purposes.
 
Yes there is. If you define a futures instrument without specifying an expiry date then you will get a list of all contracts which fit your description.
Example: if you specify a contract by only the symbol (ZN), the security type (FUT), the exchange (ECBOT) and the currency (USD) and then use reqContractDetails(contract) you will get all futures contracts which match this incomplete contract specification. This information is sent by IB to the method contractDetails() which you need to override for your purposes.

Thank you.
 
Wow thanks for posting this! I have been learning Python and messing around with Alpaca's API but I want to keep all my future live trading with IB. I will definitely be looking into this.
 
I've updated the series of beginner level blog posts I did on how to get started using python with the IB API. Previously this used the third party swigibpy (a python wrapper around the C++ API). The updated series uses the brand new native python API. Enjoy!

http://qoppac.blogspot.co.uk/2017/03/interactive-brokers-native-python-api.html
http://qoppac.blogspot.co.uk/2017/03/historic-data-from-native-ib-pyhon-api.html
http://qoppac.blogspot.co.uk/2017/03/streaming-market-data-from-native.html
http://qoppac.blogspot.co.uk/2017/03/placing-orders-in-native-python-ib-api.html
http://qoppac.blogspot.co.uk/2017/03/getting-position-and-accounting-data.html

Hope they're useful
GAT

Do you still use Python with IB now?
 
Yes, but I'm using IB INSYNC as the layer between my trading code and IB

GAT

I find out you share a lot in internet community and thanks for your contribution.

Recently I finish reading a new book about Japanese trader CIS. He wrote the book and talked about how he earned over 1 billions US dollars from almost zero with aggressive trend following style. He doesnt disclose his face and never try to earn from marketing or whatever. I think normal human can only try to copy his style with automated system since the daily psychology part is too hard to overcome.
 
I find out you share a lot in internet community and thanks for your contribution.

Recently I finish reading a new book about Japanese trader CIS. He wrote the book and talked about how he earned over 1 billions US dollars from almost zero with aggressive trend following style. He doesnt disclose his face and never try to earn from marketing or whatever. I think normal human can only try to copy his style with automated system since the daily psychology part is too hard to overcome.
Could you tell me what is the title of the book? I hope it is in English. Thank you.
 
Back
Top