Traceback (most recent call last):
File "C:\\Users\\49152\\PycharmProjects\\pythonProject\\main.py", line 4, in \<module\>
import panda as pd
File "C:\\Users\\49152\\PycharmProjects\\pythonProject\\venv\\lib\\site-packages\\panda\__init_\_.py", line 1, in \<module\>
from request import PandaRequest
ModuleNotFoundError: No module named 'request'
import requests
import pandas as pd
from datetime import datetime
api_key = 'API_KEY'
symbol = 'AAPL'
interval = '10s'
url = f'https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol={symbol}&interval={interval}&apikey={api_key}'
response = requests.get(url)
data = response.json()
times = []
open_prices = []
close_prices = []
high_prices = []
low_prices = []
for time, values in data['Time Series (10s)'].items():
times.append(datetime.strptime(time, '%Y-%m-%d %H:%M:%S'))
open_prices.append(float(values['1. open']))
close_prices.append(float(values['4. close']))
high_prices.append(float(values['2. high']))
low_prices.append(float(values['3. low']))
df = pd.DataFrame({
'Symbol': [symbol] * len(times),
'Time': times,
'Open': open_prices,
'Close': close_prices,
'High': high_prices,
'Low': low_prices
})
print(df)