Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to write the financial code of candle diagram

Shulou Source: shulou.com Published: 2022-06-02 03:42:33 10月04日 Update

This article mainly explains "how to write the financial code of candle diagram". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. let's study and learn how to write the financial code of candle diagram.

Show candle chart financial code

Import tushare as ts

Import matplotlib.pyplot as plt

Import matplotlib

From matplotlib.dates import date2num, DateFormatter

Import mpl_finance as mpf

Import pandas as pd

% matplotlib inline

Stock_data = ts.get_k_data (code='600036', start='2019-01-01-01, end='2019-10-22')

Print (stock_data.head ())

# use of candlestick2_ochl

Fig, ax = plt.subplots (figsize= (12,5))

Mpf.candlestick2_ochl (ax, stock_data ['open'], stock_data [' close'], stock_data ['high'], stock_data [' low'])

Width=0.6, colorup='r', colordown='g')

Ax.set_xticklabels (stock_data ['date'])

Plt.grid (True)

Plt.xticks (rotation=45)

Plt.ylabel ('Stock Price')

Plt.xlabel ('Date')

Plt.show ()

Thank you for your reading. The above is the content of "how to write the financial code of candle diagram". After the study of this article, I believe you have a deeper understanding of how to write the financial code of candle diagram. The specific use of the situation also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Code candle finance learning content that is ideas situations articles more knowledge knowledge points articles follow questions practice push research verification Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Linux Huawei Xiaomi MariaDB