Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to add mapping of exchange {exchange} to xcal (ticker={self._ticker}) #77

Open
hajes opened this issue Nov 24, 2024 · 1 comment
Open

Comments

@hajes
Copy link

hajes commented Nov 24, 2024

hi,

I have a little script for options. I have used yfinance, but it always fetches all data despite use of cache.

print(ticker.info)

no issues

ohlc_data = ticker.history(period="1y", interval="1d", actions=False, adjust_splits=False, adjust_divs=False)

ends up with following error:

Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\spawn.py", line 122, in spawn_main exitcode = _main(fd, parent_sentinel) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\spawn.py", line 131, in _main prepare(preparation_data) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\spawn.py", line 246, in prepare _fixup_main_from_path(data['init_main_from_path']) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\Lib\multiprocessing\spawn.py", line 297, in _fixup_main_from_path main_content = runpy.run_path(main_path, ^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen runpy>", line 287, in run_path File "<frozen runpy>", line 98, in _run_module_code File "<frozen runpy>", line 88, in _run_code File "c:\Users\hajes\Dropbox\_programing_scripts\python_scripts\trading\options-screener\options-scanner.py", line 188, in <module> screener_list.append(get_ticker_stats(i, etf=0)) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\hajes\Dropbox\_programing_scripts\python_scripts\trading\options-screener\options-scanner.py", line 124, in get_ticker_stats ohlc_data = ticker.history(period="1y") ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hajes\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\yfinance_cache\yfc_ticker.py", line 108, in history raise Exception(f"Need to add mapping of exchange {exchange} to xcal (ticker={self._ticker})") Exception: Need to add mapping of exchange NMS to xcal (ticker=NVDA)

@ValueRaider
Copy link
Owner

Looks like a Windows issue, and I don't have Windows to test fixes. Look here:

from multiprocessing import Lock, Manager, current_process
if current_process().name == 'MainProcess':
# Ensure only main (parent) processes creates a manager
manager = Manager()
exchange_locks = {e:manager.Lock() for e in exchangeToXcalExchange.keys()}
else:
exchange_locks = {}

I know you aren't running parallel, but exchange_locks needs to be initialised anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants