ok, having a issue with this Let me give you a rundown.
im running into issues with this. First off I have redone the API key so that works. However when I try to call to it it gives me this:
JSONDecodeError Traceback (most recent call last)
Input In [64], in <cell line: 25>()
25 for symbol in stocks[âTickerâ]:
26 api_url = fâhttps://sandbox.iexapis.com/stable/stock/{symbol}/quote?token={IEX_CLOUD_API_TOKEN}â
â> 27 data = requests.get(api_url).json()
28 final_dataframe = final_dataframe.append(
29 pd.Series([symbol,
30 data[âlatestPriceâ],
(âŠ)
33 index = my_columns),
34 ignore_index = True)
File /usr/local/Caskroom/miniconda/base/envs/algorithmic-trading-python/lib/python3.8/site-packages/requests/models.py:888, in Response.json(self, **kwargs)
886 if encoding is not None:
887 try:
â 888 return complexjson.loads(
889 self.content.decode(encoding), **kwargs
890 )
891 except UnicodeDecodeError:
892 # Wrong UTF codec detected; usually because itâs not UTF-8
893 # but some other 8-bit codec. This is an RFC violation,
894 # and the server didnât bother to tell us what codec was
895 # used.
896 pass
File /usr/local/Caskroom/miniconda/base/envs/algorithmic-trading-python/lib/python3.8/json/init.py:357, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
352 del kw[âencodingâ]
354 if (cls is None and object_hook is None and
355 parse_int is None and parse_float is None and
356 parse_constant is None and object_pairs_hook is None and not kw):
â 357 return _default_decoder.decode(s)
358 if cls is None:
359 cls = JSONDecoder
File /usr/local/Caskroom/miniconda/base/envs/algorithmic-trading-python/lib/python3.8/json/decoder.py:337, in JSONDecoder.decode(self, s, _w)
332 def decode(self, s, _w=WHITESPACE.match):
333 âââReturn the Python representation of s
(a str
instance
334 containing a JSON document).
335
336 âââ
â 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
339 if end != len(s):
File /usr/local/Caskroom/miniconda/base/envs/algorithmic-trading-python/lib/python3.8/json/decoder.py:355, in JSONDecoder.raw_decode(self, s, idx)
353 obj, end = self.scan_once(s, idx)
354 except StopIteration as err:
â 355 raise JSONDecodeError(âExpecting valueâ, s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I then tried to go back from the begging and fallow it threw.
final_dataframe = pd.DataFrame(columns = my_columns)
#for stock in stocks[âTickerâ]:
api_url = fâhttps://sandbox.iexapis.com/stable/stock/{stock}/quote?token={IEX_CLOUD_API_TOKEN}â
data = requests.get(api_url).json()
final_dataframe.append(
pd.Series(
[
stock,
data[âlatestPriceâ],
data[âmarketCapâ],
âN/Aâ
],
index = my_columns),
ignore_index = True
)
for symbol in stocks[âTickerâ]:
api_url = fâhttps://sandbox.iexapis.com/stable/stock/{symbol}/quote?token={IEX_CLOUD_API_TOKEN}â
data = requests.get(api_url).json()
final_dataframe = final_dataframe.append(
pd.Series([symbol,
data[âlatestPriceâ],
data[âmarketCapâ],
âN/Aâ],
index = my_columns),
ignore_index = True)
Still nothing.
I have tried everything I can think of. More then happy to pay, please give me a place to start. TY
(algorithmic-trading-python) â algorithmic-trading-python git:(master) â pip li
st
Package Version
appnope 0.1.3
argon2-cffi 21.3.0
argon2-cffi-bindings 21.2.0
asttokens 2.0.7
attrs 22.1.0
backcall 0.2.0
beautifulsoup4 4.11.1
bleach 5.0.1
certifi 2022.6.15
cffi 1.15.1
chardet 3.0.4
debugpy 1.6.2
decorator 5.1.1
defusedxml 0.7.1
entrypoints 0.4
executing 0.9.1
fastjsonschema 2.16.1
idna 2.8
importlib-resources 5.9.0
ipykernel 6.10.0
ipython 8.4.0
ipython-genutils 0.2.0
ipywidgets 7.7.1
jedi 0.18.1
Jinja2 3.1.2
jsonschema 4.9.1
jupyter 1.0.0
jupyter-client 7.2.2
jupyter-console 6.1.0
jupyter-core 4.10.0
jupyterlab-pygments 0.1.2
jupyterlab-widgets 1.1.1
MarkupSafe 2.1.1
matplotlib-inline 0.1.3
mistune 0.8.4
nbclient 0.5.13
nbconvert 6.4.4
nbformat 5.4.0
nest-asyncio 1.5.5
notebook 6.4.12
numpy 1.17.4
packaging 21.3
pandas 0.25.3
pandocfilters 1.5.0
parso 0.8.3
pexpect 4.8.0
pickleshare 0.7.5
pip 22.1.2
pkgutil_resolve_name 1.3.10
prometheus-client 0.14.1
prompt-toolkit 3.0.30
psutil 5.9.1
ptyprocess 0.7.0
pure-eval 0.2.2
pycparser 2.21
Pygments 2.12.0
pyparsing 3.0.9
pyrsistent 0.18.1
python-dateutil 2.8.2
pytz 2022.1
pyzmq 23.2.0
qtconsole 5.3.1
QtPy 2.1.0
requests 2.22.0
scipy 1.5.2
Send2Trash 1.8.0
setuptools 61.2.0
six 1.16.0
soupsieve 2.3.1
stack-data 0.3.0
terminado 0.15.0
testpath 0.6.0
tornado 6.2
traitlets 5.3.0
urllib3 1.25.11
wcwidth 0.2.5
webencodings 0.5.1
wheel 0.37.1
widgetsnbextension 3.6.1
XlsxWriter 1.2.2
zipp 3.8.1
(algorithmic-trading-python) â algorithmic-trading-python git:(master) â python
âversion
Python 3.8.13
Yes I am making contact with API. I had to do some stuff but its working
{âavgTotalVolumeâ: 69229836, âcalculationPriceâ: âcloseâ, âchangeâ: 3.64, âchangePercentâ: 0.02186, âcloseâ: 173.3, âcloseSourceâ: âffcoialiâ, âcloseTimeâ: 1702190371433, âcompanyNameâ: âApple Incâ, âcurrencyâ: âUSDâ, âdelayedPriceâ: 172.89, âdelayedPriceTimeâ: 1702718565638, âextendedChangeâ: -0.22, âextendedChangePercentâ: -0.00126, âextendedPriceâ: 173.3, âextendedPriceTimeâ: 1678961592409, âhighâ: 175.37, âhighSourceâ: âyaprc1 l ededenuii5 tmeâ, âhighTimeâ: 1709853402297, âiexAskPriceâ: None, âiexAskSizeâ: None, âiexBidPriceâ: None, âiexBidSizeâ: None, âiexCloseâ: 178.31, âiexCloseTimeâ: 1686049225683, âiexLastUpdatedâ: None, âiexMarketPercentâ: None, âiexOpenâ: 177.62, âiexOpenTimeâ: 1691149051737, âiexRealtimePriceâ: None, âiexRealtimeSizeâ: None, âiexVolumeâ: None, âlastTradeTimeâ: 1712409069377, âlatestPriceâ: 178.1, âlatestSourceâ: âCloseâ, âlatestTimeâ: âAugust 12, 2022â, âlatestUpdateâ: 1701819845361, âlatestVolumeâ: 70245510, âlowâ: 170.3, âlowSourceâ: 'ra1idimn5epeuyc let de ', âlowTimeâ: 1740415244904, âmarketCapâ: 2853752482657, âoddLotDelayedPriceâ: 179.04, âoddLotDelayedPriceTimeâ: 1717698975554, âopenâ: 175.37, âopenTimeâ: 1700230634707, âopenSourceâ: âflaiicofâ, âpeRatioâ: 29.59, âpreviousCloseâ: 172.7, âpreviousVolumeâ: 57735518, âprimaryExchangeâ: âDNASQAâ, âsymbolâ: âAAPLâ, âvolumeâ: 70994271, âweek52Highâ: 182.63, âweek52Lowâ: 128.92, âytdChangeâ: -0.005488444357282392, âisUSMarketOpenâ: False}