I have followed the tutorial on github https://github.com/louisnw01/lightweight-charts-python but I always have the same error. this is my code and result
import datetime as dt
from time import sleep
from lightweight_charts import Chart
import pandas as pd
import numpy as np
import yfinance as yf
ticker = yf.Ticker('MSFT')
hist = ticker.history(period="max")
stocks = ['TSLA', 'MSFT', 'NIO', 'AAPL', 'AMD', 'ADBE', 'ALGN', 'AMZN',
'AMGN', 'AEP', 'ADI', 'ANSS', 'AMAT', 'ASML', 'TEAM', 'ADSK']
data = yf.download("stocks", start="2023-01-01", end="2023-11-15", interval = "3mo")
df1 = pd.read_csv('/Users/cilincilin/lightweight_chart/ohlc.csv')
df2 = pd.read_csv('/Users/cilincilin/lightweight_chart/ticks.csv')
print(df2)
chart.set(df1)
chart.show()
for i, tick in df2.iterrows():
chart.update_from_tick(tick)
sleep(0.03)
chart.show(block=True)
======================================================================
ERROR
weight_chart/main.py
[*********************100%%**********************] 1 of 1 completed
1 Failed download:
['STOCKS']: Exception('%ticker%: No timezone found, symbol may be delisted')
Unnamed: 0 time price
0 0 2023-05-04 15:15:17.630544+00:00 162.56
1 1 2023-05-04 15:15:17.695618+00:00 162.56
2 2 2023-05-04 15:15:17.788727+00:00 162.56
3 3 2023-05-04 15:15:18.655228+00:00 162.54
4 4 2023-05-04 15:15:18.789878+00:00 162.54
... ... ... ...
2460 2460 2023-05-04 15:21:10.339107+00:00 162.08
2461 2461 2023-05-04 15:21:10.564931+00:00 162.08
2462 2462 2023-05-04 15:21:10.578956+00:00 162.08
I'm trying to get it to work I hope you can find a solution to my problem.
use as
data = yf.download(stocks, start="2023-01-01", end="2023-11-15", interval = "3mo")
stocks is not a string its a list of stocks