本文整理匯總了Python中MA.calcMA方法的典型用法代碼示例。如果您正苦於以下問題:Python MA.calcMA方法的具體用法?Python MA.calcMA怎麽用?Python MA.calcMA使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MA
的用法示例。
在下文中一共展示了MA.calcMA方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: calcEMA
# 需要導入模塊: import MA [as 別名]
# 或者: from MA import calcMA [as 別名]
def calcEMA(stock_code, date, period):
if ITERATOR_COUNT >= MAX_ITERATOR:
EXPMA = MA.calcMA(stock_code, date, period)
# print "MIN Date: " +date+ " MA:"+ str(EXPMA)
return EXPMA
else:
global ITERATOR_COUNT
ITERATOR_COUNT = ITERATOR_COUNT + 1
close_today = bd.getBasicData("CLOSE_TODAY", stock_code, date)
pday = du.convertDateToString(bd.getStockDate(stock_code, date, 1), "%Y-%m-%d")
EXPMA_pday = calcEMA(stock_code, pday, period)
EXPMA = 2 * (close_today - EXPMA_pday) / (period + 1) + EXPMA_pday
# print date + ": EXPMA: "+str(EXPMA_PDAY)+" CLOSE: " + str(CLOSE_TODAY) + " EXPMA = " +str(EXPMA)
return round(EXPMA, 3)
示例2: calcBBI
# 需要導入模塊: import MA [as 別名]
# 或者: from MA import calcMA [as 別名]
def calcBBI(stock_code, date, period1, period2, period3, period4):
MA1 = MA.calcMA(stock_code, date, period1)
MA2 = MA.calcMA(stock_code, date, period2)
MA3 = MA.calcMA(stock_code, date, period3)
MA4 = MA.calcMA(stock_code, date, period4)
return round((MA1 + MA2 + MA3 + MA4) / 4, 3)
示例3: calcDMA
# 需要導入模塊: import MA [as 別名]
# 或者: from MA import calcMA [as 別名]
def calcDMA(stock_code, date, period1, period2):
MA1 = MA.calcMA(stock_code, date, period1)
MA2 = MA.calcMA(stock_code, date, period2)
DMA = MA1 - MA2
return round(DMA, 3)