Compare commits

...

18 Commits

Author SHA1 Message Date
ValueRaider
07a4594455 Dev version 0.2.25b1 2023-07-14 21:55:29 +01:00
ValueRaider
adfa2e9beb Merge pull request #1604 from ranaroussi/main
sync main -> dev
2023-07-14 20:11:45 +01:00
ValueRaider
b286797e8c Bump version to 0.2.24 2023-07-14 15:52:33 +01:00
ValueRaider
b306bef350 Merge pull request #1603 from ranaroussi/hotfix/info-missing-values
Fix info[] missing values
2023-07-14 15:51:23 +01:00
ValueRaider
61c89660df Optimise info fetch, improve test 2023-07-14 15:29:55 +01:00
Value Raider
31af2ab1d5 Fix recently-fixed info[] missing data 2023-07-13 22:20:42 +01:00
Value Raider
21c380fa61 Bump version to 0.2.23 2023-07-13 20:54:56 +01:00
ValueRaider
e0000cd787 Merge pull request #1595 from signifer-geo/bug20230714
Update quote.py
2023-07-13 20:51:33 +01:00
signifer-geo
11d43eb1a1 Update quote.py
dead code deleted
2023-07-14 04:29:59 +09:00
signifer-geo
509a109f29 Update quote.py
It fixes the error: unauthorized, invalid crumb
2023-07-14 03:11:24 +09:00
ValueRaider
b0639409a3 Merge pull request #1586 from ranaroussi/improve-readme
Emphasise API on Wiki
2023-07-10 15:26:31 +01:00
ValueRaider
ed10feee9a Merge pull request #1584 from lucas03/lukas/start-date-docs
update start parameter docstring
2023-07-06 21:20:17 +01:00
ValueRaider
aba81eedc2 Emphasise API on Wiki
More emphasis that user should review the Wiki for the full API for download() and Ticker.history()
2023-07-06 21:15:41 +01:00
Lukas Vojt
d424d027ac update docstrings for start parameter
requested here
https://github.com/ranaroussi/yfinance/pull/1576#issuecomment-1616599633
2023-07-06 08:17:07 +00:00
ValueRaider
9268fcfa76 Merge pull request #1545 from SnoozeFreddo/main
fix: Readme cache-ratelimit. Limiter parenthesis was never closed
2023-06-27 13:54:08 +01:00
ValueRaider
711e1138d3 Merge pull request #1576 from lucas03/lukas/start-date
fix start date on history
2023-06-27 12:32:17 +01:00
Lukas Vojt
0789b690a4 fix: start year on history
timestamp of 1900 is older than 100 years,
so yahoo responds with error:

GDEVW: 1d data not available for startTime=-2208994789 and
endTime=1687780922. Only 100 years worth of day granularity data are
allowed to be fetched per request.

this should fix it,
something similar was proposed here:
https://github.com/ranaroussi/yfinance/pull/648

 # Please enter the commit message for
your changes. Lines starting
2023-06-26 18:43:35 +02:00
Konstantinos Ftikas
762abd8bba fix: Readme cache-ratelimit. Limiter parenthesis was never closed
The example in the docs will not work out of the box due to a syntax error.
2023-06-03 14:19:31 +02:00
9 changed files with 28 additions and 25 deletions

1
.gitignore vendored
View File

@@ -4,6 +4,7 @@ dist
yfinance.egg-info
*.pyc
.coverage
.idea/
.vscode/
build/
*.html

View File

@@ -1,6 +1,14 @@
Change Log
===========
0.2.24
------
Fix info[] missing values #1603
0.2.23
------
Fix 'Unauthorized' error #1595
0.2.22
------
Fix unhandled 'sqlite3.DatabaseError' #1574

View File

@@ -144,20 +144,10 @@ To download price history into one table:
```python
import yfinance as yf
data = yf.download("SPY AAPL", start="2017-01-01", end="2017-04-30")
data = yf.download("SPY AAPL", period="1mo")
```
`yf.download()` and `Ticker.history()` have many options for configuring fetching and processing, e.g.:
```python
yf.download(tickers = "SPY AAPL", # list of tickers
period = "1y", # time period
interval = "1d", # trading interval
prepost = False, # download pre/post market hours data?
repair = True) # repair obvious price errors e.g. 100x?
```
Review the [Wiki](https://github.com/ranaroussi/yfinance/wiki) for more options and detail.
#### `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.
### Logging
@@ -188,7 +178,7 @@ class CachedLimiterSession(CacheMixin, LimiterMixin, Session):
pass
session = CachedLimiterSession(
limiter=Limiter(RequestRate(2, Duration.SECOND*5), # max 2 requests per 5 seconds
limiter=Limiter(RequestRate(2, Duration.SECOND*5)), # max 2 requests per 5 seconds
bucket_class=MemoryQueueBucket,
backend=SQLiteCache("yfinance.cache"),
)

View File

@@ -1,5 +1,5 @@
{% set name = "yfinance" %}
{% set version = "0.2.22" %}
{% set version = "0.2.24" %}
package:
name: "{{ name|lower }}"

View File

@@ -692,7 +692,10 @@ class TestTickerInfo(unittest.TestCase):
def test_info(self):
data = self.tickers[0].info
self.assertIsInstance(data, dict, "data has wrong type")
self.assertIn("symbol", data.keys(), "Did not find expected key in info dict")
expected_keys = ['industry', 'currentPrice', 'exchange', 'floatShares', 'companyOfficers', 'bid']
for k in expected_keys:
print(k)
self.assertIn("symbol", data.keys(), f"Did not find expected key '{k}' in info dict")
self.assertEqual(self.symbols[0], data["symbol"], "Wrong symbol value in info dict")
# def test_fast_info_matches_info(self):

View File

@@ -101,7 +101,7 @@ class TickerBase:
Intraday data cannot extend last 60 days
start: str
Download start date string (YYYY-MM-DD) or _datetime, inclusive.
Default is 1900-01-01
Default is 99 years ago
E.g. for start="2020-01-01", the first data point will be on "2020-01-01"
end: str
Download end date string (YYYY-MM-DD) or _datetime, exclusive.
@@ -170,8 +170,8 @@ class TickerBase:
if interval == "1m":
start = end - 604800 # Subtract 7 days
else:
_UNIX_TIMESTAMP_1900 = -2208994789
start = _UNIX_TIMESTAMP_1900
max_start_datetime = pd.Timestamp.utcnow().floor("D") - _datetime.timedelta(days=99 * 365)
start = int(max_start_datetime.timestamp())
else:
start = utils._parse_user_dt(start, tz)
params = {"period1": start, "period2": end}

View File

@@ -47,7 +47,7 @@ def download(tickers, start=None, end=None, actions=False, threads=True, ignore_
Intraday data cannot extend last 60 days
start: str
Download start date string (YYYY-MM-DD) or _datetime, inclusive.
Default is 1900-01-01
Default is 99 years ago
E.g. for start="2020-01-01", the first data point will be on "2020-01-01"
end: str
Download end date string (YYYY-MM-DD) or _datetime, exclusive.

View File

@@ -20,8 +20,7 @@ info_retired_keys_symbol = {"symbol"}
info_retired_keys = info_retired_keys_price | info_retired_keys_exchange | info_retired_keys_marketCap | info_retired_keys_symbol
_BASIC_URL_ = "https://query2.finance.yahoo.com/v10/finance/quoteSummary"
_BASIC_URL_ = "https://query2.finance.yahoo.com/v6/finance/quoteSummary"
from collections.abc import MutableMapping
class InfoDictWrapper(MutableMapping):
@@ -587,10 +586,12 @@ class Quote:
if self._already_fetched:
return
self._already_fetched = True
modules = ['summaryProfile', 'financialData', 'quoteType',
'defaultKeyStatistics', 'assetProfile', 'summaryDetail']
modules = ['financialData', 'quoteType', 'defaultKeyStatistics', 'assetProfile', 'summaryDetail']
params_dict = {}
params_dict["modules"] = modules
params_dict["ssl"] = "true"
result = self._data.get_raw_json(
_BASIC_URL_ + f"/{self._data.ticker}", params={"modules": ",".join(modules), "ssl": "true"}, proxy=proxy
_BASIC_URL_ + f"/{self._data.ticker}", params=params_dict, proxy=proxy
)
result["quoteSummary"]["result"][0]["symbol"] = self._data.ticker
query1_info = next(

View File

@@ -1 +1 @@
version = "0.2.22"
version = "0.2.25b1"