erdewit / ib_insync

Python sync/async framework for Interactive Brokers API
BSD 2-Clause "Simplified" License
2.75k stars 723 forks source link

Dividend Events Calendar #26

Closed joseph-henry closed 6 years ago

joseph-henry commented 6 years ago

First off, thanks for writing this. It seems to work well so far.

But I had a question, I didn't see anything in here about getting dividend calendar event data. Is this something that I can request via ib_insync? If not, is this feature on the roadmap?

Thanks!

erdewit commented 6 years ago

I'm not aware of a dividend calendar in the IB API. If there is any and ib_insync does not expose it let me know.

vertangelx commented 6 years ago

I'm trying to achieve something similar, is there a way to get a contract's dividends, such as the next dividend date?

https://interactivebrokers.github.io/tws-api/tick_types.html#ib_dividends

erdewit commented 6 years ago

Thanks for the suggestion vertangelx. I've added Ticker.dividends (for the next release) and it can be used like:

from ib_insync import *
ib = IB().connect()
contract = Stock('MSFT', 'SMART', 'USD')
ib.qualifyContracts(contract)
ticker = ib.reqMktData(contract, '456') 
IB.sleep(4)
print(ticker.dividends)

output:

Dividends(past12Months=1.62, next12Months=1.68, nextDate=datetime.date(2018, 5, 16), nextAmount=0.42)
vertangelx commented 6 years ago

Thank you so much for the swift updates!!!

How often do you push out new releases?

erdewit commented 6 years ago

There's a new release now with the dividends.