简体   繁体   中英

Issues with creating candlestick chart using mplfinance

Im relatively new to coding and especially financial coding and am having issues with mpl finance candlestick charts. My code goes something like

symbol = ['NIO']

start = datetime.datetime(2016,1,1)
end = datetime.date.today()

Stockdata = yf.download(symbol,start,end)

fplt.plot(Stockdata,
          type='candle',
          title='NIO, 2016 - 2020',
          ylabel='Price ($)'
        )

My output looks like this: Looks more like a line graph than a candlestick graph

I've found multiple comprehensive codes to plot candlestick charts but this relatively simple one seems to work for others, however if it doesn't seem to work for me, I'm probably missing something simple but like I said am new to coding, any help would be greatly appreciated.

It does look like a line chart, but it just looks collapsed because of the large number of data, but if you limit the number of data, it becomes a candlestick graph. The following is a graph with a narrowed-down count.

import yfinance as yf
import datetime
import mplfinance as mpf

symbol = ['NIO']

start = datetime.datetime(2016,1,1)
end = datetime.date.today()

Stockdata = yf.download(symbol,start,end)

mpf.plot(Stockdata[350:],
          type='candle',
          title='NIO, 2016 - 2020',
          ylabel='Price ($)',
         figratio=(12,4),
         volume=True
        )

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM