examples moved to archive

This commit is contained in:
David Brazda
2024-10-04 12:04:55 +02:00
parent c4356bef3a
commit 0da6839bcb
29 changed files with 3 additions and 3 deletions

View File

@ -0,0 +1,23 @@
import pandas as pd
from lightweight_charts import Chart
def calculate_sma(df, period: int = 50):
return pd.DataFrame({
'time': df['date'],
f'SMA {period}': df['close'].rolling(window=period).mean()
}).dropna()
if __name__ == '__main__':
chart = Chart()
chart.legend(visible=True)
df = pd.read_csv('ohlcv.csv')
chart.set(df)
line = chart.create_line('SMA 50')
sma_data = calculate_sma(df, period=50)
line.set(sma_data)
chart.show(block=True)