Comments (13)
thanks @ahloytan fixed the issue based on your solution !
In the meantime, feel free to install from this fork https://github.com/MahanyaKochhar/finviz
Steps ->
Just uninstall your local finviz dependency and install it from the fork
pip install -U git+https://github.com/MahanyaKochhar/finviz
from finviz.
Fixed it. Can someone review this PR #200 ?
In the meantime, you can use this fork https://github.com/thirumalairajr/finviz @TZimm55 @sw8989
Thank you thank you. I appreciate the promptness. I will try to figure out how to use a fork.
from finviz.
@thirumalairajr unfortunately a new related error popped up.
stock_data = get_stock(ticker)
^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/finviz/main_func.py", line 37, in get_stock
data["Ticker"] = title.cssselect('h1[class="quote-header_ticker-wrapper_ticker"]')[0].text_content().strip()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
Any idea what is the issue this time ?
from finviz.
@thirumalairajr hi, seems like finviz made another small update or something.
Line 37
Before: data["Ticker"] = title.cssselect('h1[class="quote-header_ticker-wrapper_ticker"]')[0].text_content().strip()
After: data["Ticker"] = title.cssselect('h1[class="js-recent-quote-ticker quote-header_ticker-wrapper_ticker"]')[0].text_content().strip()
I have made the following change and it seems to work for me!
@sw8989 Not sure if you're able to edit the "main_func.py" as such, else I think we can wait for @thirumalairajr to make the change. Let me know if it helps/works
from finviz.
+1, experienced the same issue
from finviz.
Just now
from finviz.
Fixed it. Can someone review this PR #200 ?
In the meantime, you can use this fork https://github.com/thirumalairajr/finviz @TZimm55 @sw8989
from finviz.
Fixed it. Can someone review this PR #200 ?
In the meantime, you can use this fork https://github.com/thirumalairajr/finviz @TZimm55 @sw8989Thank you thank you. I appreciate the promptness. I will try to figure out how to use a fork.
You can uninstall your local finviz dependency and install it from the fork
pip install -U git+https://github.com/thirumalairajr/finviz
Once the PR is merged, you can switch back to the main repo.
from finviz.
Fixed it. Can someone review this PR #200 ?
In the meantime, you can use this fork https://github.com/thirumalairajr/finviz @TZimm55 @sw8989Thank you thank you. I appreciate the promptness. I will try to figure out how to use a fork.
You can uninstall your local finviz dependency and install it from the fork
pip install -U git+https://github.com/thirumalairajr/finviz
Once the PR is merged, you can switch back to the main repo.
Ahh, thank you very much, that worked! : ) That is what I needed.
from finviz.
still experiencing this issue. @MahanyaKochhar Im not sure entirely why but using your fork messed up some numpy math in another area of my project. Specifically when I have your fork installed, a matrix multiplication results in all NaNs instead of the expected values.
from finviz.
I am getting error on example code, too.
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[5], line 2
1 filters = ['exch_nasd', 'idx_sp500']
----> 2 stock_list = Screener(filters=filters, table='Performance', order='price')
File ~/notebooks/algotrading/algotrading/lib/python3.10/site-packages/finviz/screener.py:128, in Screener.__init__(self, tickers, filters, rows, order, signal, table, custom, user_agent, request_method)
125 self._request_method = request_method
127 self.analysis = []
--> 128 self.data = self.__search_screener()
File ~/notebooks/algotrading/algotrading/lib/python3.10/site-packages/finviz/screener.py:436, in Screener.__search_screener(self)
421 """ Private function used to return data from the FinViz screener. """
423 self._page_content, self._url = http_request_get(
424 "https://finviz.com/screener.ashx",
425 payload={
(...)
433 user_agent=self._user_agent,
434 )
--> 436 self._rows = self.__check_rows()
437 self.headers = self.__get_table_headers()
439 if self._request_method == "async":
File ~/notebooks/algotrading/algotrading/lib/python3.10/site-packages/finviz/screener.py:404, in Screener.__check_rows(self)
398 def __check_rows(self):
399 """
400 Checks if the user input for row number is correct.
401 Otherwise, modifies the number or raises NoResults error.
402 """
--> 404 self._total_rows = scrape.get_total_rows(self._page_content)
406 if self._total_rows == 0:
407 raise NoResults(self._url.split("?")[1])
File ~/notebooks/algotrading/algotrading/lib/python3.10/site-packages/finviz/helper_functions/scraper_functions.py:46, in get_total_rows(page_content)
42 """ Returns the total number of rows(results). """
44 total_element = page_content.cssselect('td[width="128"]')
45 total_number = (
---> 46 etree.tostring(total_element[0]).decode("utf-8").split("</b>")[1].split()[0]
47 )
49 try:
50 return int(total_number)
IndexError: list index out of range
from finviz.
Related Issues (20)
- KeyError: Sector name is wrong HOT 1
- Issue with screener
- SCREENER ERROR
- Header contains line feed code and blank characters when retrieving header HOT 1
- No results found for query when using Screener HOT 5
- Screener returning data with empty columns added HOT 2
- ValueError when converting date HOT 2
- Can't Call get_crypto(pair) with the pair name only it's number
- IndexError: list index out of range HOT 8
- Header labels are not aligned with content HOT 2
- duplicate column name in sqllite database initialization
- INDEX OUT OF RANGE HOT 1
- Issue with pyproject.toml when I try to pip install HOT 1
- News Date Issue HOT 9
- Screener data and headers are empty HOT 9
- finviz api Unable to parse page for ticker
- ValueError: time data '\r\n Today 07:00AM\r\n ' does not match format '%b-%d-%y %I:%M%p'
- Full List of Stocks on Finviz HOT 2
- get_stock() IndexError: list index out of range on line to fetch `company_details`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from finviz.