algorithmic-trading-python
algorithmic-trading-python copied to clipboard
403 Error when pulling data from api
symbol="AAPL" api_url = f'https://sandbox.iexapis.com/stable/stock/{symbol}/quote/?token={IEX_CLOUD_API_TOKEN}'#base url #print(api_url) data=requests.get(api_url) print(data.status_code)
Hi I am using this code to pull data but instead end up getting 403 error. Any solutions?
Solution:
- Open a https://iexcloud.io/ account a.Create a new account b.Go to Dashboard and copy "secret" from WORKSPACE API token. #https://iexcloud.io/console/home c.open Jupyter file secrets.py and paste your new "secret". #http://localhost:XXXX/tree/algorithmic-trading-python/starter_files d.retry pulling data.
Solution:
- Open a https://iexcloud.io/ account a.Create a new account b.Go to Dashboard and copy "secret" from WORKSPACE API token. #https://iexcloud.io/console/home c.open Jupyter file secrets.py and paste your new "secret". #http://localhost:XXXX/tree/algorithmic-trading-python/starter_files d.retry pulling data.
still getting the 403 status code
This works (get your public key and change your secrets.py (in my case I had to change secrets.py to api.py as it breaks numpy)
My workspace is called Algorithmic (you can call it anilegin as an example in the console you create it.
symbol = 'AAPL' api_url = f'https://ALGORITHMIC.iex.cloud/v1/data/core/quote/{symbol}?token={IEX_CLOUD_API_TOKEN}' print(api_url) data = requests.get(api_url).json() print(data)
better to follow the same steps as above
This works (get your public key and change your secrets.py (in my case I had to change secrets.py to api.py as it breaks numpy)
My workspace is called Algorithmic (you can call it anilegin as an example in the console you create it.
symbol = 'AAPL' api_url = f'https://ALGORITHMIC.iex.cloud/v1/data/core/quote/{symbol}?token={IEX_CLOUD_API_TOKEN}' print(api_url) data = requests.get(api_url).json() print(data)
thank you your solution had helped so much .. however I advise to do the following *this what worked for me *
- Create a new account
- Go to Dashboard and copy "public key" from WORKSPACE API token.
- open Jupyter file secrets.py and paste your new key.
- paste API URL instead it mentioned in thier docs and it is the same data as the video https://cloud.iexapis.com/stable/stock/aapl/quote?token=YOUR_TOKEN_HERE
- restart the kernal and try to pull the data again
the link is displayed in their website
import requests
symbol = "AAPL" #IEX_CLOUD_API_TOKEN = "your_api_token_here" # replace with your actual API token api_url = f'https://sandbox.iexapis.com/stable/stock/{symbol}/quote/?token=sk_47bb0c7b1acd49fe883ab7bde495b8b8' # base url
response = requests.get(api_url)
if response.status_code == 200: data = response.json() print(data) else: print(f"Error: {response.status_code}")
Still giving error 403
- Added new token from a new account
- Changed names,didnt work
- replaced token id with the token itself
But this one is real-time data which need to purchase after 7 days trial
Solution:
- Open a https://iexcloud.io/ account a.Create a new account b.Go to Dashboard and copy "secret" from WORKSPACE API token. #https://iexcloud.io/console/home c.open Jupyter file secrets.py and paste your new "secret". #http://localhost:XXXX/tree/algorithmic-trading-python/starter_files d.retry pulling data.
and i change the sandbox into https://cloud.iexapis.com/, it worked then
This works (get your public key and change your secrets.py (in my case I had to change secrets.py to api.py as it breaks numpy)
My workspace is called Algorithmic (you can call it anilegin as an example in the console you create it.
symbol = 'AAPL' api_url = f'https://ALGORITHMIC.iex.cloud/v1/data/core/quote/{symbol}?token={IEX_CLOUD_API_TOKEN}' print(api_url) data = requests.get(api_url).json() print(data)
works for me! thanks a lot
In my case there is no register new account button on the login/register page on IEX cloud, is there any help for this?
In my case there is no register new account button on the login/register page on IEX cloud, is there any help for this?
I have the same issue and cannot make a new account but found this site
https://iexcloud.io/product-bulletin
They are ending their service and the data will be availibly from intrinio.com https://intrinio.com/iex-cloud