기본 콘텐츠로 건너뛰기

라벨이 UDF인 게시물 표시

[matplotlib]quiver()함수

[stock] 지표계산을 위한 UDF

지표계산을 위한 UDF import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.dates as mpl_dates x축형식 지정을 위한 UDF def xaxis_form(n=20, format='%y/%m/%d', ax=False): locator = mpl_dates.DayLocator(interval=n) form = mpl_dates.DateFormatter(format) if ax==False: ax=plt.gca() ax.xaxis.set_major_locator(locator) ax.set_xticklabels([]) else: ax=plt.gca() ax.xaxis.set_major_locator(locator) ax.xaxis.set_major_formatter(form) plt.xticks(rotation=45) A ADL def calculate_adl(df, short_period=3, long_period=10): high = df['High'] low = df['Low'] close = df['Close'] volume = df['Volume'] result=pd.DataFrame() result["MFM"] = ((close - low) - (high - close)) / (high - low) result["MFV"] = result["MFM"] * volume result["ADL"] = result["MFV"].cumsum() short_ema=result["ADL"].ewm...