本文整理汇总了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)