python计算macd等技术指标,有什么包吗

Python013

python计算macd等技术指标,有什么包吗,第1张

有的,包的链接如下:

https://github.com/lovelylain/pyctp/tree/master/example/ctp/talib

 a = 2/13

Prices = [0.0] #prices of everyday

EMAs = [0.0] # ems of everyday

def ema ( N , Price) :

    Prices.append(Price)

    if N<=1:

        EMAs.append(Price)

    else :

        EMAs.append((1-a)*EMAs[N-1] + a*Price)

ema(1,1)

ema(2,3)

print (EMAs[1])

print (EMAs[2])