gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
How to get annual dividend figures for HK stock yahoo finance python code
- User
How to get annual dividend figures for HK stock yahoo finance python code
- Assistant
You can use the yfinance library in Python to get annual dividend figures for a HK stock on Yahoo Finance. Here is an example code:
import yfinance as yf # replace "0001.HK" with the stock ticker you want to get the data for stock = yf.Ticker("0001.HK") # get the annual dividend data dividends = stock.dividends # print the annual dividend data print(dividends)This will output a pandas series with the annual dividend figures for the specified stock ticker. You can then manipulate and analyze this data further as needed.