Merge branch 'main' into dev

pull/1569/head
ValueRaider 2023-06-21 23:13:12 +01:00 committed by GitHub
commit 1cb0b215c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 37 deletions

View File

@ -1,14 +0,0 @@
---
name: Feature request
about: Request a new feature
title: ''
labels: ''
assignees: ''
---
**Describe the problem**
**Describe the solution**
**Additional context**

View File

@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies

View File

@ -1,20 +1,13 @@
Change Log
===========
0.2.19b4
--------
Fix `download` logging #1541
Fix corrupt tkr-tz-csv halting code #1528
0.2.19b3
-------
Improve logging messages #1522
Price fixes #1523
0.2.19b1 - beta
-------
Optimise Ticker.history #1514
Logging module #1493
0.2.20
------
Switch to `logging` module #1493 #1522 #1541
Price history:
- optimise #1514
- fixes #1523
- fix TZ-cache corruption #1528
0.2.18
------

View File

@ -248,6 +248,11 @@ Install `yfinance` using `pip`:
$ pip install yfinance --upgrade --no-cache-dir
```
Test new features by installing betas, provide feedback in [corresponding Discussion](https://github.com/ranaroussi/yfinance/discussions):
``` {.sourceCode .bash}
$ pip install yfinance --upgrade --no-cache-dir --pre
```
To install `yfinance` using `conda`, see
[this](https://anaconda.org/ranaroussi/yfinance).

View File

@ -1,5 +1,5 @@
{% set name = "yfinance" %}
{% set version = "0.2.19b4" %}
{% set version = "0.2.20" %}
package:
name: "{{ name|lower }}"

View File

@ -917,14 +917,21 @@ class _KVStore:
def get(self, key: str) -> Union[str, None]:
"""Get value for key if it exists else returns None"""
item = self.conn.execute('select value from "kv" where key=?', (key,))
try:
item = self.conn.execute('select value from "kv" where key=?', (key,))
except _sqlite3.IntegrityError as e:
self.delete(key)
return None
if item:
return next(item, (None,))[0]
def set(self, key: str, value: str) -> None:
with self._cache_mutex:
self.conn.execute('replace into "kv" (key, value) values (?,?)', (key, value))
self.conn.commit()
if value is None:
self.delete(key)
else:
with self._cache_mutex:
self.conn.execute('replace into "kv" (key, value) values (?,?)', (key, value))
self.conn.commit()
def bulk_set(self, kvdata: Dict[str, str]):
records = tuple(i for i in kvdata.items())
@ -996,7 +1003,17 @@ class _TzCache:
except TypeError:
_os.remove(old_cache_file_path)
else:
self.tz_db.bulk_set(df.to_dict()['Tz'])
# Discard corrupt data:
df = df[~df["Tz"].isna().to_numpy()]
df = df[~(df["Tz"]=='').to_numpy()]
df = df[~df.index.isna()]
if not df.empty:
try:
self.tz_db.bulk_set(df.to_dict()['Tz'])
except Exception as e:
# Ignore
pass
_os.remove(old_cache_file_path)

View File

@ -1 +1 @@
version = "0.2.19b4"
version = "0.2.20"