highfestiva / finplot

Performant and effortless finance plotting for Python
MIT License
907 stars 186 forks source link

How to add my history trades into the chart? #390

Closed tmaczjj closed 1 year ago

tmaczjj commented 1 year ago

i 've added the history data into the finplot chart, and the klines was successfully displayed.Now i am going to add my trades into the chart.

highfestiva commented 1 year ago
import finplot as fplt
import yfinance

df = yfinance.download('AAPL')
fplt.candlestick_ochl(df[['Open', 'Close', 'High', 'Low']])
fplt.plot(df.Close.iloc[1000:-1000:200], style='^', width=2, color='#0f0', legend='Bought')
fplt.plot(df.Close.iloc[1100:-1000:200], style='v', width=2, color='#f00', legend='Sold')
fplt.show()

image