Package: pgabc
## pgabc为数据分析提供各种帮助## 需要安装pandas numpy talib##类内容：
##class Indicator():
##    “””数据指数函数 可变列host_nv ,user_wm,passwd_wm,db_wm,chareset_wm来适应不同要求”””
##    period = 6    #系数
##    weight = 0.2
##    k = 12
##    ts_code = ‘000001.SZ’
##    time_temp = datetime.datetime.now() - datetime.timedelta(days=0)
##    given_dt = time_temp.strftime(‘%Y%m%d’)
##    def __init__(self,df_wm,start_dt,end_dt):
##        self.df_wm = df_wm
##        self.start_dt = start_dt
##        self.end_dt = end_dt
##        #self.cho_dt = self.cho_dt##    def ma(self):
##        #返回是的DATA 可以用data.iloc[-1].ma_5等方式获得数据,可以直接用ma_wm[1]来得到最后一个数据
##        data = self.df_wm[(self.df_wm[‘ts_code’]==self.ts_code)&(self.df_wm[‘trade_date’]>=self.start_dt)&(self.df_wm[‘trade_date’]<=self.given_dt)]
##        data.drop_duplicates(subset=[‘ts_code’,’trade_date’],keep=’first’,inplace=True)  #去重
##        data = data.reset_index()   #重新排
##        data[‘ma_{}’.format(str(self.k))] = data.close.rolling(self.k).mean()    #5日收盘价均值
##        print(data.tail())
##        ma_wm = data.iloc[-1][‘ma_{}’.format(str(self.k))]
##        return data,ma_wm
##   …## 主要指标ma(self,k:int = 10):#index_1ema(self,k:int = 10):#index_2rsi_wm(self,period:int = 6):#index_3  不推荐
#RSI相对强弱指标
#相对强弱指数（RSI）是通过比较一段时期内的平均收盘涨数和平均收盘跌数来分析市场买沽盘的意向和实力，从而作出未来市场的走势sma(self,k:int = 5):#index_4
#计算PRICE_WM K天的简单平均数wma(self,timeperiod:int=30):#index_5 wmaewma(self,period:int = 5,exponential:float = 0.2):#index_6
# 计算PRICE_WM 期数为PERIOD天,EXPONENTIAL权数的指数加权平均数momentum(self,period:int = 19):#index_7
#momentum trading strategy 动量交易策略 现价比PERIOND_WM前的价差macd(self,period1:int = 12,period2:int = 26,period3:int=9):#index_8kdj(self,n:int = 9,m1:int = 3,m2:int = 3):#index_9
#kdj 9,3,3 数据bias(self,n1:int = 6,n2:int = 12,n3:int = 24):#index_10
#bias指标  6,12,24
#N期BIAS=(当日收盘价-N期平均收盘价)/N期平均收盘价*100%wr(self,n1:int = 10,n2:int = 6):#index_11
#威廉指标obv(self,n:int = 30):#index_12boll(self):#index_13
#布林线指标，即BOLL指标，其英文全称是“Bollinger Bands”sun_moon(self):#index_14
#生成阳线阴线标志，阳线为True ,阴线为Falsek_form(self):#index_15
#生成K线实体占HIGH-LOW的比重*100ma_group(self):#index_16 ma
#生成数据的sma_ta(self,timeperiod:int = 30):#index_17 sma
#SMA （简单移动平均线）（参数1：收盘价序列，参数2：时间周期（均线的计算长度 即 几日均线））atr(self,timeperiod:int = 14):#index_18
#ATR（平均真实波幅）
#（参数1：最高价序列，参数2：最低价序列，参数3：收盘价序列，参数4：时间周期）ht_trendline(self):#inex_19 ht_trendline
#HT_TRENDLINE - Hilbert Transform - Instantaneous Trendlinekama(self,timeperiod:int=30):#index_20 kama
#KAMA - Kaufman Adaptive Moving Averagevar(self,timeperiod:int = 5,nbdev:int = 1):#index_21 var
#MAMA - MESA Adaptive Moving Averagetsf(self,timeperiod:int=14):#index_22 var
#TSF - Time Series Forecastdema(self,timeperiod:int = 30):#index_23 dema
#DEMA - Double Exponential Moving Averagemidpoint(self,timeperiod:int=14):#MIDPOINT - MidPoint over period
#index_26 minpointmidprice(self,timeperiod:int=14):#index_27 midprice
#MIDPRICE - Midpoint Price over periodsar(self):#index_28 sar
#SAR - Parabolic SARsarext(self):#index_29 sarext
#SAREXT - Parabolic SAR - Extendedt3(self,timeperiod:int = 5):#index_30 t3
#T3 - Triple Exponential Moving Average (T3)tema(self,timeperiod:int=30):#index_31 tema
#TEMA - Triple Exponential Moving Averagetrima(self,timeperiod:int=30):#index_32 tirma
#TRIMA - Triangular Moving Averagewma1(self,timeperiod:int = 30):#index_33 wma
#WMA - Weighted Moving Averageadx(self,timeperiod:int = 14):#index_34 adx
#ADX - Average Directional Movement Index
#NOTE: The ADX function has an unstable period.adxr(self,timeperiod:int=14):#index_35 adxr
#ADXR - Average Directional Movement Index Rating
#NOTE: The ADXR function has an unstable period.apo(self,fastperiod:int=12,slowperiod:int=26):#index_36 apo
#APO - Absolute Price Oscillatoraroon(self,timeperiod:int=14):#index_37 aroon
#AROON - Aroonaroonosc(self,timeperiod:int=14):#index_38 aroonosc
#AROONOSC - Aroon Oscillatorbop(self):#index_39 bop
#BOP - Balance Of Powercci(self,timeperiod:int = 14):#index_40 cci
#CCI - Commodity Channel Indexcmo(self,timeperiod:int=14):#index_41 cmo
#CMO - Chande Momentum Oscillatordx(self,timeperiod:int=14):#index_42 dx
#DX - Directional Movement Indexmacd_t(self,fastperiod:int=12,slowperiod:int=26,signalperiod:int=9):#index_43 macd
#MACD - Moving Average Convergence/Divergencemacdext(self,fastperiod:int=12,slowperiod:int=26,signalperiod:int=9):#index_44 macdext
#MACDEXT - MACD with controllable MA typemacdfix(self,signalperiod:int=9):#index_45 macdfix
#MACDFIX - Moving Average Convergence/Divergence Fix 12/26mfi(self,timeperiod:int=14):#index_46 mfi
#MFI - Money Flow Indexminus_di(self,timeperiod:int=14):#index_47 minus_di
#MINUS_DI - Minus Directional Indicatorminus_dm(self,timeperiod:int=14):#index_48 minus_dm
#MINUS_DM - Minus Directional Movementmom(self,timeperiod:int=10):#index_49 mom
#MOM - Momentumplus_di(self,timeperiod:int=14):#index_50 plus_di
#PLUS_DI - Plus Directional Indicatorplus_dm(self,timeperiod:int=14):#index_51 plus_dm
#PLUS_DM - Plus Directional Movementppo(self,fastperiod:int=12,slowperiod:int=26):#index_52 ppo
#PPO - Percentage Price Oscillatorroc(self,timeperiod:int=10):#index_53 roc
#ROC - Rate of change : ((price/prevPrice)-1)*100rocp(self,timeperiod:int=10):#index_54 rocp
#ROCP - Rate of change Percentage: (price-prevPrice)/prevPricerocr(self,timeperiod:int=10):#index_55 rocr
#ROCP - Rate of change Percentage: (price-prevPrice)/prevPricerocr100(self,timeperiod:int=10):#index_56 rocr100
#ROCR100 - Rate of change ratio 100 scale: (price/prevPrice)*100rsi(self,timeperiod:int=14):#index_57 rsistoch(self,fastk_period:int=5,slowk_period:int=3,slowd_period:int=3):#index_58 stoch
#STOCH - Stochasticstochf(self,fastk_period:int=5,fastd_period:int=3):#index_59 stochf
#STOCHF - Stochastic Faststochrsi(self,timeperiod:int=14,fastk_period:int=5,fastd_period:int=3):#index_60 stochrsi
#STOCHRSI - Stochastic Relative Strength Indextrix(self,timeperiod:int=30):#index_61 trix
#TRIX - 1-day Rate-Of-Change (ROC) of a Triple Smooth EMAultosc(self,timeperiod1:int=7,timeperiod2:int=14,timeperiod3:int=28):#index_62 stochf
#ULTOSC - Ultimate Oscillatorwillr(self,timeperiod:int=14):#index_63 stochf
#WILLR - Williams’ %Rad(self):#index_64 ad
#AD - Chaikin A/D Linead(self,fastperiod:int=3,slowperiod:int=10):#index_65 adosc
#ADOSC - Chaikin A/D Oscillatorobv_ta(self):#index_66 obv
#OBV - On Balance Volumeht_dcperiod(self):#index_67 ht_dcperiod
#HT_DCPERIOD - Hilbert Transform - Dominant Cycle Periodht_dcphase(self):#index_68 ht_dcphase    NNN
#HT_DCPHASE - Hilbert Transform - Dominant Cycle Phaseht_phasor(self):#index_69 ht_phasor  NNNN
#HT_PHASOR - Hilbert Transform - Phasor Componentsht_sine(self):#index_70 ht_sine  NNN
#HT_SINE - Hilbert Transform - SineWaveht_trendmode(self):#index_71 ht_trendmode
#HT_TRENDMODE - Hilbert Transform - Trend vs Cycle Modeavgprice(self):#index_72 AVGPRICE
#AVGPRICE - Average Pricemedprice(self):#index_73 MEDPRICE
#MEDPRICE - Median Pricetypprice(self):#index_74 TYPPRICE
#TYPPRICE - Typical Pricewclprice(self):#index_75 WCLPRICE
#WCLPRICE - Weighted Close Priceatr(self,timeperiod:int=14):#index_76 atr
#ATR - Average True Rangenatr(self,timeperiod:int=14):#index_77 aatr
#NATR - Normalized Average True Rangetrange(self):#index_78 trange
#TRANGE - True Rangecdl2crows(self):#index_79 cdl2crowscdl3blackcrows(self):#index_80 cdl3blackcrows
#CDL3BLACKCROWS - Three Black Crowscdl3inside(self):#index_81 cdl3blackcrows
#CDL3INSIDE - Three Inside Up/Downcdl3linestrike(self):#index_82 cdl3cdl3linestrike
#CDL3INSIDE - Three Inside Up/Downcdl3outside(self):#index_83 cdl3outsidecdl3starstinsouth(self):#index_84 CDL3STARSINSOUTH
#CDL3STARSINSOUTH - Three Stars In The Southcdl3whitesoldiers(self):#index_85  CDL3WHITESOLDIERS
#CDL3WHITESOLDIERS - Three Advancing White Soldierscdlabandonedbaby(self):#index_86  CDLABANDONEDBABY
#CDLABANDONEDBABY - Abandoned Babycdladvanceblock(self):#index_87 CDLADVANCEBLOCK
#CDLADVANCEBLOCK - Advance Blockcdlbelthold(self):#index_88 CDLBELTHOLD
#CDLBELTHOLD - Belt-holdcdlbreakaway(self):#index_89 CDLBREAKAWAY
#CDLBREAKAWAY - Breakawaycdlclosingmarubozu(self):#index_90 CDLCLOSINGMARUBOZU
#CDLCLOSINGMARUBOZU - Closing Marubozucdlconcealbabyswall(self):#index_91 CDLCLOSINGMARUBOZU
#CDLCONCEALBABYSWALL - Concealing Baby Swallowcdlcounterattack(self):#index_92 CDLCOUNTERATTACK
#CDLCOUNTERATTACK - Counterattackcdldarkcloundcover(self):#index_93 CDLDARKCLOUDCOVER
#CDLDARKCLOUDCOVER - Dark Cloud Covercdldoji(self):#index_94 CDLDOJI
#CDLDOJI - Dojicdldojistar(self):#index_95 CDLDOJI
#CDLDOJISTAR - Doji Starcdldragonflydoji(self):#index_96 CDLDRAGONFLYDOJI
#CDLDRAGONFLYDOJI - Dragonfly Dojicdlengulfing(self):#index_97 CDLDRAGONFLYDOJI
#CDLENGULFING - Engulfing Patterncdleveningdojistar(self):#index_98 CDLEVENINGDOJISTAR
#CDLEVENINGDOJISTAR - Evening Doji Starcdleveningstar(self):#index_99 CDLEVENINGSTAR
#CDLEVENINGSTAR - Evening Starcdlgapsidesidewhite(self):#index_100 CDLGAPSIDESIDEWHITE
#CDLGAPSIDESIDEWHITE - Up/Down-gap side-by-side white linescdlgravestonedoji(self):#index_101 CDLGRAVESTONEDOJI - Gravestone Doji
#CDLGRAVESTONEDOJI - Gravestone Dojicdlhammer(self):#index_102 CDLHAMMER
#CDLHAMMER - Hammercdlhangingman(self):#index_103 CDLHANGINGMAN
#CDLHANGINGMAN - Hanging Mancdlharami(self):#index_104 CDLHARAMI
#CDLHARAMI - Harami Patterncdlharamicross(self):#index_105 CDLHARAMICROSS
#CDLHARAMICROSS - Harami Cross Patterncdlhighwave(self):#index_106 CDLHIGHWAVE
#CDLHIGHWAVE - High-Wave Candlecdlhikkake(self):#index_107 CDLHIKKAKE
#CDLHIKKAKE - Hikkake Patterncdlhikkakemod(self):#index_108 CDLHIKKAKEMOD
#CDLHIKKAKEMOD - Modified Hikkake Patterncdlhomingpigeon(self):#index_109 CDLHOMINGPIGEON
#CDLHOMINGPIGEON - Homing Pigeoncdlidentical3crows(self):#index_110 CDLIDENTICAL3CROWS
#CDLIDENTICAL3CROWS - Identical Three Crowscdlinneck(self):#index_111 CDLINNECK
#CDLINNECK - In-Neck Patterncdlinvertedhammer(self):#index_112 CDLINVERTEDHAMMER
#CDLINVERTEDHAMMER - Inverted Hammercdlkicking(self):#index_113 CDLKICKING - Kicking
#CDLKICKING - Kickingcdlkickingbylegngth(self):#index_114 CDLKICKINGBYLENGTH
#CDLKICKINGBYLENGTH - Kicking - bull/bear determined by the longer marubozucdlladderbottom(self):#index_115 CDLLADDERBOTTOM
#CDLLADDERBOTTOM - Ladder Bottomcdllongleggeddoji(self):#index_116 CDLLONGLEGGEDDOJI
#CDLLONGLEGGEDDOJI - Long Legged Dojicdllongline(self):#index_117 CDLLONGLINE
#CDLLONGLINE - Long Line Candlecdlmarubozu(self):#index_118 CDLMARUBOZU
#CDLMARUBOZU - Marubozucdlmatchinglow(self):#index_119 CDLMATCHINGLOW - Matching Low
#CDLMARUBOZU - Marubozucdlmathold(self):#index_119 CDLMATCHINGLOW - Matching Low
#CDLMATHOLD - Mat Holdcdlmorningdojistar(self):#index_120 CDLMORNINGDOJISTAR
#CDLMORNINGDOJISTAR - Morning Doji Starcdlmorningstar(self):#index_121 CDLMORNINGSTAR
#CDLMORNINGSTAR - Morning Starcdlonneck(self):#index_122 CDLONNECK - On-Neck Pattern
#CDLONNECK - On-Neck Patterncdlpiercting(self):#index_123 CDLPIERCING - Piercing Pattern
#CDLPIERCING - Piercing Patterncdlrickshawman(self):#index_124 CDLRICKSHAWMAN
#CDLRICKSHAWMAN - Rickshaw Mancdlrisefall3methods(self):#index_125 CDLRISEFALL3METHODS
#CDLRISEFALL3METHODS - Rising/Falling Three Methodscdlseparatinglines(self):#index_126 CDLSEPARATINGLINES
#CDLSEPARATINGLINES - Separating Linescdlshootingstar(self):#index_127 CDLSHOOTINGSTAR
#CDLSHOOTINGSTAR - Shooting Starcdlshortline(self):#index_128 CDLSHORTLINE - Short Line Candle
#CDLSHORTLINE - Short Line Candlecdlspinningtop(self):#index_129 CDLSPINNINGTOP - Spinning Top
#CDLSPINNINGTOP - Spinning Topcdlstalledpattern(self):#index_130 CDLSTALLEDPATTERN - Stalled Pattern
#CDLSTALLEDPATTERN - Stalled Patterncdlsticksandwich(self):#index_131 CDLSTICKSANDWICH
#CDLSTICKSANDWICH - Stick Sandwichcdltakuri(self):#index_132 CDLTAKURI
#CDLTAKURI - Takuri (Dragonfly Doji with very long lower shadow)cdltasukigap(self):#index_132 CDLTASUKIGAP
#CDLTASUKIGAP - Tasuki Gapcdlthrusting(self):#index_133 CDLTHRUSTING
#CDLTHRUSTING - Thrusting Patterncdltristar(self):#index_134 CDLTRISTAR
#CDLTRISTAR - Tristar Patterncdlunique3river(self):#index_135 CDLUNIQUE3RIVER
#CDLUNIQUE3RIVER - Unique 3 Rivercdlupsidegap2crows(self):#index_136 CDLUPSIDEGAP2CROWS
#CDLUPSIDEGAP2CROWS - Upside Gap Two Crowscdlxsidegap3methods(self):#index_137 CDLXSIDEGAP3METHODS
#CDLXSIDEGAP3METHODS - Upside/Downside Gap Three Methodsbeta(self,timeperiod:int=5):#index_138 BETA
#BETA - Betacorrel(self,timeperiod:int=30):#index_139 CORREL
#CORREL - Pearson’s Correlation Coefficient (r)linearreg(self,timeperiod:int=14):#index_140 LINEARREG
#LINEARREG - Linear Regressionlinearreg_angle(self,timeperiod:int=14):#index_141 LINEARREG_ANGLE
#LINEARREG_ANGLE - Linear Regression Anglelinearreg_intercept(self,timeperiod:int=14):#index_142 LINEARREG_INTERCEPT
#LINEARREG_INTERCEPT - Linear Regression Interceptlinearreg_slope(self,timeperiod:int=14):#index_143 LINEARREG_SLOPE
#LINEARREG_SLOPE - Linear Regression Slopestddev(self,timeperiod:int=5,nbdev:int=1):#index_144 STDDEV
#STDDEV - Standard Deviationtsf(self,timeperiod:int=14):#index_145 TSF
#TSF - Time Series Forecastvar_ta(self,timeperiod:int=5,nbdev:int=1):#index_146 VAR
#VAR - Varianceacos(self):#index_147 ACOS
#ACOS - Vector Trigonometric ACosasin(self):#index_148 ASIN
#ASIN - Vector Trigonometric ASinatan(self):#index_149 ATAN
#ATAN - Vector Trigonometric ATanceil(self):#index_150 CEIL
#CEIL - Vector Ceilcos(self):#index_151 COS
#COS - Vector Trigonometric Coscosh(self):#index_152 COSH
#COSH - Vector Trigonometric Coshexp(self):#index_152 EXP
#EXPfloor(self):#index_153 FLOOR
#FLOOR - Vector Floorln(self):#index_154 LN
#LN - Vector Log Naturallog10(self):#index_155 LOG10
#LOG10 - Vector Log10sin(self):#index_156 SIN
#SIN - Vector Trigonometric Sinsinh(self):#index_157 SINH
#SINH - Vector Trigonometric Sinhsqrt(self):#index_158 SQRT
#SQRT - Vector Square Roottan(self):#index_159 TAN
#TAN - Vector Trigonometric Tantanh(self):#index_160 TANH
#TANH - Vector Trigonometric Tanhadd(self):#index_161  ADD
#ADD - Vector Arithmetic Adddiv(self):#index_162 DIV
#DIV - Vector Arithmetic Divmax(self,timeperiod:int=30):#index_163 MAXmaxindex(self,timeperiod:int=30):#index_164 MAXINDEX
#MAXINDEX - Index of highest value over a specified periodmin(self,timeperiod:int=30):#index_165 MIN
#MIN - Lowest value over a specified periodminindex(self,timeperiod:int=30):#index_166 MININDEX
#MININDEX - Index of lowest value over a specified periodminmax(self,timeperiod:int=30):#index_167 MINMAX
#MINMAX - Lowest and highest values over a specified periodminmaxindex(self,timeperiod:int=30):#index_168 MINMAXINDEX
#MINMAXINDEX - Indexes of lowest and highest values over a specified periodmult(self):#index_169 MULT - Vector Arithmetic Mult
#MULT - Vector Arithmetic Multsub(self):#index_170 SUB
#SUB - Vector Arithmetic Substractionsum(self,timeperiod:int=30):#index_171 SUM
#SUM - Summation## 应用##安装 pip install pgabc##使用举例##  import pgabc.indicator as pg_indicator
## pg = pg_indicator.Indicator(df,start_dt,end_dt)     #引入类  df 是数据pandas格式 ， 一般有 trade_date,ts_code,open,high,low,close,vol 等内容
## pg.ts_code = ‘600999.SH’                            #选定股票
## pg.given_dt = ‘20200701’                            #设定指定日期，默认是当前日期
## df = pg.ema(k=12)                                   #生成12日ema数据