Git Product home page Git Product logo

iex-api-python's Issues

Stock.dividends return unexpected values.

Hi,
Stock.dividends() returns chart response. Is that expected behavior?
If not, need to change to call dividends API.

def dividends(self, range='1m'):
    """
        Args:
            range - what range of data to retrieve. The variable
                    'DIVIDEND_RANGES' has possible values in addition to a date.
    """
    validate_range_set(range, RANGES)
    return self._get(f"**dividends**/{range}")

Problem with import

Could you help with this issue?
c:\RH\myRH>python3 iex.py
Traceback (most recent call last):
File "iex.py", line 1, in
from iex import stock
File "c:\RH\myRH\iex.py", line 1, in
from iex import stock
ImportError: cannot import name 'stock' from 'iex' (c:\RH\myRH\iex.py)

Can't import iex at Google Colab

After installing iex-api-python on fresh notebook at Google Colab, got error

!pip install iex-api-python
from iex import Stock
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-13-5a07ca1b682b> in <module>()
----> 1 from iex import Stock

/usr/local/lib/python3.6/dist-packages/iex/__init__.py in <module>()
      2 from iex.stocks import Stock
      3 from iex.batch import Batch
----> 4 from iex.market import market, Market
      5 from iex.iex_stats import iex_stats, IexStats
      6 from iex.iex_market import IexMarket

ImportError: cannot import name 'market'

---------------------------------------------------------------------------

Stock.peers() returns NameError

Calling the peers method does not return a list of Stock objects; instead errors.

def peers(self, as_string=False):
  if as_string:
    return [x for x in self._get("peers")]
  else:
    return [stock(x) for x in self._get("peers")]

` NameError: name 'stock' is not defined

However, using the as_string=True parameter does successfully return the list which can then be looped through to get each peer's info.

Print revisited

I actually meant this print statement:

diff --git a/iex/stocks.py b/iex/stocks.py
index 8d031e0..03c9d8e 100644
--- a/iex/stocks.py
+++ b/iex/stocks.py
@@ -26,7 +26,8 @@ class Stock:
     def _get(self, url, params={}):
         request_url =f"{BASE_URL}/stock/{self.symbol}/{url}"
         response = requests.get(request_url, params=params)
-        print(response.url)
+        # Removed print for every URL we request
+        #print(response.url)
         if response.status_code != 200:
             raise Exception(f"{response.status_code}: {response.content.decode('utf-8')}")
         result = response.json()

403: Forbidden

Getting Exception: 403: Forbidden
on the example:
Stock("F").price()

Did the api change?

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.