Code Monkey home page Code Monkey logo

Comments (13)

MahanyaKochhar avatar MahanyaKochhar commented on August 21, 2024 2

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.

TZimm55 avatar TZimm55 commented on August 21, 2024 1

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.

sw8989 avatar sw8989 commented on August 21, 2024 1

@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.

ahloytan avatar ahloytan commented on August 21, 2024 1

@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.

sw8989 avatar sw8989 commented on August 21, 2024

+1, experienced the same issue

from finviz.

sw8989 avatar sw8989 commented on August 21, 2024

Just now

from finviz.

thirumalairajr avatar thirumalairajr commented on August 21, 2024

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.

thirumalairajr avatar thirumalairajr commented on August 21, 2024

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.

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.

TZimm55 avatar TZimm55 commented on August 21, 2024

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.

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.

AdamMuzz avatar AdamMuzz commented on August 21, 2024

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.

eliluong avatar eliluong commented on August 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.