You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Show future and historic earnings dates, returns at most next 4 quarters and last 8 quarters by default.
140
-
# Note: If more are needed use msft.get_earnings_dates(limit=XX) with increased limit argument.
141
-
msft.earnings_dates
142
-
143
-
# show ISIN code - *experimental*
144
-
# ISIN = International Securities Identification Number
145
-
msft.isin
146
-
147
-
# show options expirations
148
-
msft.options
149
-
150
-
# show news
151
-
msft.news
152
-
153
-
# get option chain for specific expiration
154
-
opt = msft.option_chain('YYYY-MM-DD')
155
-
# data available via: opt.calls, opt.puts
156
-
```
157
-
158
-
For tickers that are ETFs/Mutual Funds, `Ticker.funds_data` provides access to fund related data.
159
-
160
-
Funds' Top Holdings and other data with category average is returned as `pd.DataFrame`.
161
-
162
-
```python
163
-
import yfinance as yf
164
-
spy = yf.Ticker('SPY')
165
-
data = spy.funds_data
166
-
167
-
# show fund description
168
-
data.description
169
-
170
-
# show operational information
171
-
data.fund_overview
172
-
data.fund_operations
173
-
174
-
# show holdings related information
175
-
data.asset_classes
176
-
data.top_holdings
177
-
data.equity_holdings
178
-
data.bond_holdings
179
-
data.bond_ratings
180
-
data.sector_weightings
181
-
```
182
-
183
-
If you want to use a proxy server for downloading data, use:
184
-
185
-
```python
186
-
import yfinance as yf
187
-
188
-
msft = yf.Ticker("MSFT")
189
-
190
-
msft.history(..., proxy="PROXY_SERVER")
191
-
msft.get_actions(proxy="PROXY_SERVER")
192
-
msft.get_dividends(proxy="PROXY_SERVER")
193
-
msft.get_splits(proxy="PROXY_SERVER")
194
-
msft.get_capital_gains(proxy="PROXY_SERVER")
195
-
msft.get_balance_sheet(proxy="PROXY_SERVER")
196
-
msft.get_cashflow(proxy="PROXY_SERVER")
197
-
msft.option_chain(..., proxy="PROXY_SERVER")
198
-
...
199
-
```
200
-
201
-
### Multiple tickers
202
-
203
-
To initialize multiple `Ticker` objects, use
204
-
205
-
```python
206
-
import yfinance as yf
207
-
208
-
tickers = yf.Tickers('msft aapl goog')
209
-
210
-
# access each ticker using (example)
211
-
tickers.tickers['MSFT'].info
212
-
tickers.tickers['AAPL'].history(period="1mo")
213
-
tickers.tickers['GOOG'].actions
214
-
```
215
-
216
-
To download price history into one table:
217
-
218
-
```python
219
-
import yfinance as yf
220
-
data = yf.download("SPY AAPL", period="1mo")
221
-
```
222
-
223
-
#### `yf.download()` and `Ticker.history()` have many options for configuring fetching and processing. [Review the Wiki](https://github.com/ranaroussi/yfinance/wiki) for more options and detail.
224
-
225
-
### Sector and Industry
226
-
227
-
The `Sector` and `Industry` modules allow you to access the US market information.
228
-
229
-
To initialize, use the relevant sector or industry key as below. (Complete mapping of the keys is available in `const.py`.)
230
-
231
-
```python
232
-
import yfinance as yf
67
+
The list of changes can be found in the [changelog](https://github.com/ranaroussi/yfinance/blob/main/CHANGELOG.rst)
The `Screener` module allows you to screen the market based on specified queries.
276
-
277
-
#### Query Construction
278
-
To create a query, you can use the `EquityQuery` class to construct your filters step by step. The queries support operators: `GT` (greater than), `LT` (less than), `BTWN` (between), `EQ` (equals), and logical operators `AND` and `OR` for combining multiple conditions.
279
-
280
-
#### Screener
281
-
The `Screener` class is used to execute the queries and return the filtered results. You can set a custom body for the screener or use predefined configurations.
282
-
283
-
<!-- TODO: link to Github Pages for more including list of predefined bodies, supported fields, operands, and sample code -->
284
-
285
-
### Logging
286
-
287
-
`yfinance` now uses the `logging` module to handle messages, default behaviour is only print errors. If debugging, use `yf.enable_debug_mode()` to switch logging to debug with custom formatting.
288
-
289
-
### Smarter scraping
290
-
291
-
Install the `nospam` packages for smarter scraping using `pip` (see [Installation](#installation)). These packages help cache calls such that Yahoo is not spammed with requests.
292
-
293
-
To use a custom `requests` session, pass a `session=` argument to
294
-
the Ticker constructor. This allows for caching calls to the API as well as a custom way to modify requests via the `User-agent` header.
You can direct cache to use a different location with `set_tz_cache_location()`:
345
-
346
-
```python
347
-
import yfinance as yf
348
-
yf.set_tz_cache_location("custom/cache/location")
349
-
...
350
-
```
351
-
352
-
---
353
69
354
70
## Developers: want to contribute?
355
-
356
71
`yfinance` relies on community to investigate bugs and contribute code. Developer guide: https://github.com/ranaroussi/yfinance/discussions/1084
0 commit comments