1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

仮想通貨をローソク足でグラフ出力

Posted at

Ta-Libraryとは

金融データをテクニカル指標などで分析が行えるツール
https://mrjbq7.github.io/ta-lib/

準備

必要ライブラリをインストールする

!brew install ta-lib
!pip install TA-Lib mplfinance

Binanceから過去データを取得

下記URLを参考に取得
http://algotrade-for-everyone.com/2021/07/14/binance-get-historic-data/

出力

使用するライブラリをimportします。

import talib
import pandas as pd
import mplfinance as mpf

取得したデータをdatetime型に変更して読み込める形にする。

df['date'] = pd.to_datetime(df['Time'])
df = df[['Open', 'High', 'Low', 'Close', 'Volume','date']].set_index('date')

Mplfinanceの表示できる制限があるため、500まで

df.head(500)

あとは表示するだけ

mpf.plot(df, 
         type='candle',
         style='binance',
        addplot = macd_dataset)
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?