#!/usr/bin/env python # coding: utf-8 # # **Sipnner** # - https://separk92.tistory.com/20 : Python 으로 Spinner 구현하기 # In[1]: # https://github.com/pavdmyt/yaspin import time from yaspin import yaspin # Context manager: with yaspin(): time.sleep(3) # time consuming code # In[2]: # Function decorator: @yaspin(text="Loading...") def some_operations(): time.sleep(3) # time consuming code some_operations() # In[3]: get_ipython().run_line_magic('matplotlib', 'inline') get_ipython().run_line_magic('config', "InlineBackend.figure_format = 'retina'") import warnings import matplotlib.pyplot as plt from matplotlib.font_manager import fontManager as fm plt.style.use('seaborn') # 'seaborn-colorblind' plt.rc('axes', unicode_minus=False) warnings.simplefilter(action='ignore', category=FutureWarning) font_list_check = ['D2Coding', 'NanumGothicCoding', 'NanumGothic'] for font in font_list_check: font_counts = [ f for f in font_list_check if font in [_.name for _ in fm.ttflist]] if len(font_counts) > 1: print(f"found : {font}"); break # 폰트 적용하기 plt.rc('font', family=font) # In[4]: # Raw Package import numpy as np import pandas as pd #Data Source import yfinance as yf #Data viz import plotly.graph_objs as go # Get Bitcoin data data = yf.download(tickers='BTC-USD', period = '22h', interval = '15m') #declare figure fig = go.Figure() #Candlestick fig.add_trace(go.Candlestick(x=data.index, open=data['Open'], high=data['High'], low=data['Low'], close=data['Close'], name = 'market data')) # Add titles fig.update_layout( title='Bitcoin live share price evolution', yaxis_title='Bitcoin Price (kUS Dollars)') # X-Axes fig.update_xaxes( rangeslider_visible=True, rangeselector=dict( buttons=list([ dict(count=15, label="15m", step="minute", stepmode="backward"), dict(count=45, label="45m", step="minute", stepmode="backward"), dict(count=1, label="HTD", step="hour", stepmode="todate"), dict(count=6, label="6h", step="hour", stepmode="backward"), dict(step="all") ]) ) ) #Show fig.show()