Skip to content

In batch api --> JSONDecodeError #53

Description

@mig9mili

symbol_groups = list(chunks(stocks['Ticker'], 100))
symbol_strings = []
for i in range(0, len(symbol_groups)):
symbol_strings.append(','.join(symbol_groups[i]))

final_dataframe = pd.DataFrame(columns=my_col)

for symbol_string in symbol_strings:
batch_api_call_url = f'https://cloud.iexapis.com/stable/stock/market/batch/types=quote&symbols={symbol_string}&token={IEX_CLOUD_API_TOKEN}'
data = requests.get(batch_api_call_url).json()
for symbol in data:
if data[symbol]['quote']:
final_dataframe = final_dataframe.append(
pd.Series([symbol,
data[symbol]['quote']['latestPrice'],
data[symbol]['quote']['marketCap'],
'N/A'],
index=my_col),
ignore_index=True)

final_dataframe
Screenshot 2023-03-20 104621
Screenshot 2023-03-20 104719

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions