Skip to content

Commit

Permalink
Merge pull request #2250 from R5dan/fix-market-doc
Browse files Browse the repository at this point in the history
Fix Market Docs
  • Loading branch information
ValueRaider authored Feb 1, 2025
2 parents 6d7c5b6 + e09f77e commit 8e369a2
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 15 deletions.
18 changes: 16 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
Change Log
===========

0.2.51
0.2.52
------
Features:
- Improve Screener & docs #2207
- Add Market summary & status #2175
- Support custom period in Ticker.history() #2192
- raise YfRateLimitError if rate limited #2108
- add more options to Search #2191
Fixes:
- earnings_dates #2169
- remove hardcoded keys in Analysis #2194
- handle Yahoo changed Search response #2202
Maintenance:
- add optional dependencies to requirements.txt #2199

0.2.51
------
Features:
- Screener tweaks #2168
- Search #2160
- get_news() expose count #2173
Fixes:
- earnings_dates #2169

0.2.50
------
Expand Down
2 changes: 2 additions & 0 deletions doc/source/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The following are the publicly available classes, and functions exposed by the `

- :attr:`Ticker <yfinance.Ticker>`: Class for accessing single ticker data.
- :attr:`Tickers <yfinance.Tickers>`: Class for handling multiple tickers.
- :attr:`Market <yfinance.Market>`: Class for accessing market summary.
- :attr:`download <yfinance.download>`: Function to download market data for multiple tickers.
- :attr:`Search <yfinance.Search>`: Class for accessing search results.
- :attr:`Sector <yfinance.Sector>`: Domain class for accessing sector information.
Expand All @@ -33,6 +34,7 @@ The following are the publicly available classes, and functions exposed by the `

yfinance.ticker_tickers
yfinance.stock
yfinance.market
yfinance.financials
yfinance.analysis
yfinance.market
Expand Down
33 changes: 29 additions & 4 deletions doc/source/reference/yfinance.market.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,41 @@
=====================
Market Summary
Market
=====================

.. currentmodule:: yfinance


Class
------------
The `Market` class, allows you to access market data in a Pythonic way.

.. autosummary::
:toctree: api/

Market

Market Sample Code
--------------------------
The `Market` class, allows you to access market summary data in a Pythonic way.
------------------

.. literalinclude:: examples/market.py
:language: python
:language: python


Markets
------------
There are 8 different markets available in Yahoo Finance.

* US
* GB

\

* ASIA
* EUROPE

\

* RATES
* COMMODITIES
* CURRENCIES
* CRYPTOCURRENCIES
2 changes: 1 addition & 1 deletion meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "yfinance" %}
{% set version = "0.2.51" %}
{% set version = "0.2.52" %}

package:
name: "{{ name|lower }}"
Expand Down
14 changes: 7 additions & 7 deletions yfinance/domain/market.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from ..const import _QUERY1_URL_
import json as _json

class Market():
class Market:
def __init__(self, market:'str', session=None, proxy=None, timeout=30):
self.market = market
self.session = session
Expand Down Expand Up @@ -52,7 +52,7 @@ def _parse_data(self):
status_params = {
"formatted": True,
"key": "finance",
"lang": "en-GB",
"lang": "en-US",
"market": self.market
}

Expand All @@ -73,11 +73,11 @@ def _parse_data(self):
self._status['timezone'] = self._status['timezone'][0]
del self._status['time'] # redundant
try:
self._status.update(
open = dt.datetime.fromisoformat(self._status["open"]),
close = dt.datetime.fromisoformat(self._status["close"]),
tz = dt.timezone(self._status["timezone"]["gmtoffset"], self._status["timezone"]["short"])
)
self._status.update({
"open": dt.datetime.fromisoformat(self._status["open"]),
"close": dt.datetime.fromisoformat(self._status["close"]),
"tz": dt.timezone(dt.timedelta(hours=int(self._status["timezone"]["gmtoffset"]))/1000, self._status["timezone"]["short"])
})
except Exception as e:
self._logger.error(f"{self.market}: Failed to update market status")
self._logger.debug(f"{type(e)}: {e}")
Expand Down
2 changes: 1 addition & 1 deletion yfinance/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "0.2.51"
version = "0.2.52"

0 comments on commit 8e369a2

Please sign in to comment.