import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Örnek fiyat verisi
data = {
'Date': pd.date_range(start='2023-01-01', periods=60, freq='D'),
'Price': np.random.normal(loc=1800, scale=50, size=60) # Rastgele fiyat verisi
}
df = pd.DataFrame(data)
# Destek ve direnç seviyelerini bulmak için fonksiyon
def calculate_support_resistance(df, window=5):
df['Max'] = df['Price'].rolling(window=window).max() # Direnç
df['Min'] = df['Price'].rolling(window=window).min() # Destek
return df
# Destek ve direnç seviyelerini hesapla
df = calculate_support_resistance(df)
# Sonuçları yazdır
print("Son Fiyat Verileri:")
print(df[['Date', 'Price', 'Min', 'Max']])
# Grafik Çizimi
plt.figure(figsize=(12, 6))
plt.plot(df['Date'], df['Price'], label='Fiyat', color='blue')
plt.plot(df['Date'], df['Min'], label='Destek', linestyle='--', color='green')
plt.plot(df['Date'], df['Max'], label='Direnç', linestyle='--', color='red')
plt.title('Fiyat, Destek ve Direnç Seviyeleri')
plt.xlabel('Tarih')
plt.ylabel('Fiyat (USD)')
plt.legend()
plt.show()
aW1wb3J0IHBhbmRhcyBhcyBwZAppbXBvcnQgbnVtcHkgYXMgbnAKaW1wb3J0IG1hdHBsb3RsaWIucHlwbG90IGFzIHBsdAoKIyDDlnJuZWsgZml5YXQgdmVyaXNpCmRhdGEgPSB7CiAgICAnRGF0ZSc6IHBkLmRhdGVfcmFuZ2Uoc3RhcnQ9JzIwMjMtMDEtMDEnLCBwZXJpb2RzPTYwLCBmcmVxPSdEJyksCiAgICAnUHJpY2UnOiBucC5yYW5kb20ubm9ybWFsKGxvYz0xODAwLCBzY2FsZT01MCwgc2l6ZT02MCkgICMgUmFzdGdlbGUgZml5YXQgdmVyaXNpCn0KCmRmID0gcGQuRGF0YUZyYW1lKGRhdGEpCgojIERlc3RlayB2ZSBkaXJlbsOnIHNldml5ZWxlcmluaSBidWxtYWsgacOnaW4gZm9ua3NpeW9uCmRlZiBjYWxjdWxhdGVfc3VwcG9ydF9yZXNpc3RhbmNlKGRmLCB3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