当前位置: 首页>>代码示例>>Python>>正文


Python BasicData.updateAnalysisData方法代码示例

本文整理汇总了Python中BasicData.updateAnalysisData方法的典型用法代码示例。如果您正苦于以下问题:Python BasicData.updateAnalysisData方法的具体用法?Python BasicData.updateAnalysisData怎么用?Python BasicData.updateAnalysisData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BasicData的用法示例。


在下文中一共展示了BasicData.updateAnalysisData方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import updateAnalysisData [as 别名]
def analyze(stock_code, date, period1, period2):
    signal = ""
    score = 0.0
    recent_high_price = bd.getHighPriceInPeriod("CLOSE_TODAY", stock_code, date, period1)
    recent_low_price = bd.getLowPriceInPeriod("CLOSE_TODAY", stock_code, date, period1)
    close_today = bd.getBasicData("CLOSE_TODAY", stock_code, date)
    BBI = getBBI(stock_code, date)

    if (abs(close_today - recent_high_price) / recent_high_price <= HIGH_OFFSET / 100) and (BBI > close_today):
        score = score - 1
        signal = signal + "[-1]股价在高价区以收市价跌破多空线为卖出信号;"

    if (abs(close_today - recent_low_price) / recent_low_price <= LOW_OFFSET / 100) and (BBI < close_today):
        score = score + 1
        signal = signal + "[1]股价在低价区以收市价突破多空线为买入信号;"

    BBIs = getBBIs(stock_code, date, period2)
    K = mu.getPoly(BBIs, 1)[0]

    if (K > 0) and (BBI > close_today):
        score += 1
        signal += "[1]多空指数由下向上递增,股价在多空线上方,表明多头势强,可以继续持股;"

    if (K < 0) and (BBI < close_today):
        score -= 1
        signal += "[-1]多空指数由上向下递减,股价在多空线下方,表明空头势强,一般不宜买入;"

    print score
    print signal.decode("utf-8").encode("gbk")
    bd.updateAnalysisData("BBI", str(score) + ";" + signal, stock_code, date)
    return [score, signal]
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:33,代码来源:BBI.py

示例2: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import updateAnalysisData [as 别名]
def analyze(stock_code, date, period):
    signal = ""
    score = 0.0
    BR = getBR(stock_code, date)
    AR = getAR(stock_code, date)

    if (BR < AR) and (BR < 100):
        score += 1
        signal += "[1]BR<AR,且BR<100,可考虑逢低买进;"

    if (BR < AR) and (AR < 50):
        score += 1
        signal += "[1]BR<AR,而AR<50时,是买进信号;"

    BRs = getBRs(stock_code, date, period)
    ARs = getARs(stock_code, date, period)
    BR_K = mu.getPoly(BRs, 1)[0]
    AR_K = mu.getPoly(ARs, 1)[0]

    if (BR_K >= UP_RATIO_THREHOLD) and (AR_K >= UP_RATIO_THREHOLD):
        score -= 1
        signal += "[-1]AR和BR同时急速上升,意味着股价已近顶部,持股者应逢高卖出;"

    print score
    print signal.decode("utf-8").encode("gbk")
    bd.updateAnalysisData("BRAR", str(score) + ";" + signal, stock_code, date)
    return [score, signal]
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:29,代码来源:BRAR.py

示例3: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import updateAnalysisData [as 别名]
def analyze(stock_code, date, period):
    score = 0
    signal = ""
    WR = getWR(stock_code, date)
    if WR >= 80:
        score += 1
        signal += "[1]当%R线达到80时,市场处于超卖状况,股价走势随时可能见底。因此,80的横线一般称为买进线,投资者在此可以伺机买入;"
    if WR <= 20:
        score -= 1
        signal += "[-1]当%R线达到20时,市场处于超买状况,走势可能即将见顶,20的横线被称为卖出线;"

    WRs = bd.getTechDataInPeriod("WR", stock_code, date, period)
    WR_K = mu.getPoly(WRs, 1)[0]

    if WR > 50 and WR_K > 0:
        score += 1
        signal += "[1]当%R向下跌破50中轴线时,市场由弱转强,是买进信号;"

    if WR < 50 and WR_K < 0:
        score -= 1
        signal += "[-1]当%R从超买区向上爬升,突破50中轴线后,可以确认强势转弱,是卖出信号;"

    print score
    print signal.decode("utf-8").encode("gbk")
    bd.updateAnalysisData("WR", str(score) + ";" + signal, stock_code, date)
    return [score, signal]
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:28,代码来源:WR.py

示例4: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import updateAnalysisData [as 别名]
def analyze(stock_code, date, period):
    score = 0.0
    signal = ""
    RSI = getRSI(stock_code, date)
    if 90 > RSI > 80:
        score -= 1
        signal += "[-1]当六日指标上升到达80时,表示股市已有超买现象;"
    if RSI > 90:
        score -= -1
        signal += "[-1]超过90以上时,则表示已到严重超买的警戒区,股价已形成头部,极可能在短期内反转回转;"
    if 10 < RSI < 20:
        score += 1
        signal += "[1]六日强弱指标下降至20时,表示股市有超卖现象;"
    if RSI < 10:
        score += 1
        signal += "[1]一旦继续下降至10以下时则表示已到严重超卖区域,股价极可能有止跌回升的机会;"

    close_in_period = bd.getBasicDataInPeriod("CLOSE_TODAY", stock_code, date, period)
    RSI_in_period = bd.getTechDataInPeriod("CCI", stock_code, date, period)
    close_k = mu.getPoly(close_in_period, 1)[0]
    RSI_k = mu.getPoly(RSI_in_period, 1)[0]

    if close_k > 0 and RSI_k < 0:
        signal += "强弱指标下降而股价反趋上涨,产生的背离现象;"
    if close_k < 0 and RSI_k > 0:
        signal += "强弱指标上升而股价反而下跌, 产生的背离现象;"
    print score
    print signal.decode("utf-8").encode("gbk")
    bd.updateAnalysisData("RSI", str(score) + ";" + signal, stock_code, date)
    return [score, signal]
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:32,代码来源:RSI.py

示例5: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import updateAnalysisData [as 别名]
def analyze(stock_code, date, period):
    score = 0
    signal = ""

    print score
    print signal.decode("utf-8").encode("gbk")
    bd.updateAnalysisData("DMI", str(score) + ";" + signal, stock_code, date)
    return [score, signal]
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:10,代码来源:DMI.py

示例6: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import updateAnalysisData [as 别名]
def analyze(stock_code, date):
    score = 0
    signal = ""
    pday = bd.getStockDate(stock_code, date, 1)
    KDJ_K, KDJ_D, KDJ_J = getKDJ(stock_code, date)
    KDJ_K_pday, KDJ_D_pday, KDJ_J_pday = getKDJ(stock_code, pday)

    if KDJ_K >= 90:
        score -= 1
        signal += "[-1]K线是快速确认线——数值在90以上为超买;"
    if KDJ_K <= 10:
        score += 1
        signal += "[1]K线是快速确认线——数值在10以下为超卖;"

    if KDJ_D >= 80:
        score -= 1
        signal += "[-1]D线是慢速主干线——数值在80以上为超买;"
    if KDJ_D <= 20:
        score += 1
        signal += "[1]D线是慢速主干线——数值在20以下为超卖;"

    if KDJ_J >= 90:
        score -= 1
        signal += "[-1]J线为方向敏感线,当J值大于90,特别是连续5天以上,股价至少会形成短期头部;"
    if KDJ_J <= 10:
        score += 1
        signal += "[1]J线为方向敏感线,当J值小于10,特别是连续数天以上,股价至少会形成短期底部;"

    if KDJ_K_pday < KDJ_D_pday and KDJ_K > KDJ_D:
        score += 1
        signal += "[1]K线从下方上穿D线,所以在图形上K线向上突破D线时,俗称金叉,即为买进的讯号;"
        if KDJ_K < 20 and KDJ_D < 20:
            score += 1
            signal += "[1]当K,D线在20以下交叉向上,此时的短期买入的信号较为准确;"
        # TODO 如果K值在50以下,由下往上接连两次上穿D值,形成右底比左底高的“W底”形态时,后市股价可能会有相当的涨幅。

    if KDJ_K_pday > KDJ_D_pday and KDJ_K < KDJ_D:
        score -= 1
        signal += "[-1]K线从上方下穿D线,显示趋势是向下的,所以在图形上K线向下突破D线时,俗称死叉,即为卖出的讯号;"
        if KDJ_K > 20 and KDJ_D > 20:
            score -= 1
            signal += "[-1]当K,D线在80以上交叉向下,此时的短期卖出的信号较为准确;"
        # TODO 如果K值在50以上,由上往下接连两次下穿D值,形成右头比左头低的“M头”形态时,后市股价可能会有相当的跌幅。。

    # TODO 4. 通过KDJ与股价背离的走势,判断股价顶底也是颇为实用的方法:4.1股价创新高,而KD值没有创新高,为顶背离,应卖出;4.2股价创新低,而KD值没有创新低,为底背离,应买入
    '''
    print KDJ_K
    print KDJ_D
    print KDJ_J

    print KDJ_K_pday
    print KDJ_D_pday
    print KDJ_J_pday
    '''
    print score
    print signal.decode("utf-8").encode("gbk")
    bd.updateAnalysisData("KDJ", str(score) + ";" + signal, stock_code, date)
    return [score, signal]
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:60,代码来源:KDJ.py

示例7: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import updateAnalysisData [as 别名]
def analyze(stock_code, date, period):
    score = 0.0
    signal = ""
    pday = bd.getStockDate(stock_code, date, 1)

    CCI = getCCI(stock_code, date)
    CCI_pday = getCCI(stock_code, pday)
    CCIs = getCCIs(stock_code, date, period)
    CCI_K1 = mu.getPoly(CCIs, 1)[0]
    CCI_K2 = mu.getPoly(CCIs, 2)[0]

    print CCI
    print CCI_pday
    print CCIs
    print CCI_K1
    print CCI_K2


    if CCI > 100:
        score -= 0.5
        signal += "[-0.5]当CCI>﹢100时,表明股价已经进入非常态区间—超买区间;"
        if CCI_K1 > 0:
            score += 1
            signal += "[1]CCI曲线向上突破﹢100线而进入非常态区间后,只要CCI曲线一直朝上运行,就表明股价强势依旧,中短线应及时买入,如果有比较大的成交量配合,买入信号则更为可靠;"
        if CCI_K2 < 0 and (CCI -100) >= CCI_THREHOLD:
            score -= 1
            signal += "[-1]当CCI曲线在﹢100线以上的非常态区间,在远离﹢100线的地方开始掉头向下时,表明股价的强势状态将难以维持,是股价比较强的转势信号。如果前期的短期涨幅过高时,更可确认。此时,投资者应及时逢高卖出股票;"

    if CCI < -100:
        score += 0.5
        signal += "[0.5]当CCI<﹣100时,表明股价已经进入另一个非常态区间—超卖区间;"
        if CCI_K1 < 0:
            score -= 1
            signal += "[-1]当CCI曲线向下突破﹣100线而进入另一个非常态区间后,只要CCI曲线一路朝下运行,就表明股价弱势依旧,投资者可一路观望;"
        if CCI_K2 > 0:
            score += 0.5
            signal += "[0.5]当CCI曲线向下突破﹣100线而进入另一个非常态区间,如果CCI曲线在超卖区运行了相当长的一段时间后开始掉头向上,表明股价的短期底部初步找到,投资者可少量建仓。CCI曲线在超卖区运行的时间越长,越可以确认短期的底部;"

    if CCI_pday >= 100 and CCI < 100:
        score -= 1
        signal += "[-1]当CCI指标从上向下突破﹢100线而重新进入常态区间时,表明股价的上涨阶段可能结束,将进入一个比较长时间的盘整阶段。投资者应及时逢高卖出股票;"

    if CCI_pday <= -100 and CCI > -100:
        score += 0.5
        signal += "[0.5]当CCI指标从下向上突破﹣100线而重新进入常态区间时,表明股价的探底阶段可能结束,又将进入一个盘整阶段。投资者可以逢低少量买入股票;"

    print score
    print signal.decode("utf-8").encode("gbk")
    bd.updateAnalysisData("CCI", str(score) + ";" + signal, stock_code, date)
    return [score, signal]
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:52,代码来源:CCI.py

示例8: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import updateAnalysisData [as 别名]
def analyze(stock_code, date):
    total_score = 0.0
    total_score += BBI.analyze(stock_code, date, BBI_PARM_PERIOD_TRACE_FOR_HIGH, BBI_PARM_PERIOD_TRACE_HIS)[0]
    total_score += BIAS.analyze(stock_code, date)[0]
    total_score += BOLL.analyze(stock_code, date, BOLL_PARM_PERIOD)[0]
    total_score += BRAR.analyze(stock_code, date, BRAR_PARM_PERIOD_HIS)[0]
    total_score += CCI.analyze(stock_code, date, CCI_PARM_PERIOD)[0]
    total_score += DMA.analyze(stock_code, date, DMA_PARM_PERIOD)[0]
    total_score += DMI.analyze(stock_code, date, DMI_PARM_PERIOD)[0]
    total_score += KDJ.analyze(stock_code, date)[0]
    total_score += MA.analyze(stock_code, date, MA_PARM_PERIOD)[0]
    total_score += OBV.analyze(stock_code, date, OBV_PARM_PERIOD_TRACE_HIS)[0]
    total_score += PSY.analyze(stock_code, date)[0]
    total_score += ROC.analyze(stock_code, date, ROC_PARM_PERIOD_TRACE_HIS)[0]
    total_score += RSI.analyze(stock_code, date, RSI_PARM_PERIOD_TRACE_HIS)[0]
    total_score += VR.analyze(stock_code, date)[0]
    total_score += WR.analyze(stock_code, date, WR_PARM_PERIOD_TRACE_HIS)[0]

    bd.updateAnalysisData("TOTAL_SCORE", str(total_score), stock_code, date)
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:21,代码来源:StockAnalyst.py

示例9: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import updateAnalysisData [as 别名]
def analyze(stock_code, date):
    score = 0.0
    signal = ""
    PSY = getPSY(stock_code, date)
    if PSY > 75:
        score -= 1
        signal += "[-1]心理线公式计算出来的百分比值,超过75时为超买,但在涨升行情时,应将卖点提高到75之上;"

    if PSY < 25:
        score += 1
        signal += "[1]心理线公式计算出来的百分比值,低于25时为超卖,但在跌落行情时,应将买点降低至45以下;"

    if PSY < 10:
        score += 1
        signal += "[1]当百分比值降低至10或10以下时,是真正的超买,此时是一个短期抢反弹的机会,应立即买进;"

    print score
    print signal.decode("utf-8").encode("gbk")
    bd.updateAnalysisData("PSY", str(score) + ";" + signal, stock_code, date)
    return [score, signal]
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:22,代码来源:PSY.py

示例10: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import updateAnalysisData [as 别名]
def analyze(stock_code, date):
    score = 0.0
    signal = ""
    VR = getVR(stock_code, date)
    if 40 < VR < 70:
        score += 1
        signal += "[1]低价区域40-70可以买进;"
    if 80 < VR < 150:
        score += 1
        signal += "[1]安全区域80-150持有股票;"
    if 160 < VR < 450:
        score -= 1
        signal += "[-1]获利区域160-450根据情况获利了结;"
    if VR > 450:
        score -= 1
        signal += "[-1]警戒区域450以上伺机卖出;"
    print score
    print signal.decode("utf-8").encode("gbk")
    bd.updateAnalysisData("VR", str(score) + ";" + signal, stock_code, date)
    return [score, signal]
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:22,代码来源:VR.py

示例11: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import updateAnalysisData [as 别名]
def analyze(stock_code, date, period):
    score = 0
    signal = ""
    pday = bd.getStockDate(stock_code, date, 1)

    ROC = getROC(stock_code, date)
    ROCMA = calcROCMA(stock_code, date, ROCMA_PARAM)
    ROCEMA = calcROCEMA(stock_code, date, ROCEMA_PARAM)

    ROC_pday = getROC(stock_code, pday)
    ROCMA_pday = calcROCMA(stock_code, pday, ROCMA_PARAM)
    ROCEMA_pday = calcROCEMA(stock_code, pday, ROCEMA_PARAM)

    ROCs = getROCs(stock_code, date, period)
    ROCMAs = getROCMAs(stock_code, date, period)
    ROCEMAs = getROCEMAs(stock_code, date, period)

    ROC_K = mu.getPoly(ROCs, 1)[0]
    ROCMA_K = mu.getPoly(ROCMAs, 1)[0]
    ROCEMA_K = mu.getPoly(ROCEMAs, 1)[0]

    if ROC < 0 and ROCEMA < 0 and ROCMA < 0:
        if ROC > ROC_pday:
            if ROC > ROCEMA and ROC > ROCEMA and ROC_pday < ROCEMA_pday and ROC_pday < ROCMA_pday:
                if (ROC - ROC_pday)/ROC_pday >= ROC_RAISE_RATE and (ROCMA - ROCMA_pday)/ROCMA_pday >= ROCMA_RAISE_RATE \
                        and (ROCEMA - ROCEMA_pday)/ROCEMA_pday >= ROCEMA_RAISE_RATE:
                    score += 1
                    signal += "[1]当ROC,ROCMA,ROCEMA三条线均小于零轴时,ROC迅速同时上穿ROCMA和ROCEMA两条线,而且ROCMA和ROCEMA两条线也处于缓缓上行中,为短线黑马买入信号;"

    if ROC > ROCMA > ROCEMA and ROC_K > ROCMA_K > ROCEMA_K:
        score += 1
        signal += "[1]当ROC,ROCMA,ROCEMA三条线是处于多头排列中,成交量处于间隙式放大或温和放大过程时,表明股价正运行于上升趋势中,仍有继续上涨趋势;"

    if ROC < ROCMA < ROCEMA and ROC_K < ROCMA_K < ROCEMA_K:
        score -= 1
        signal += "[-1]当ROC,ROCMA,ROCEMA三条线是处于空头排列中,表明股价正运行于下行趋势中,仍有继续下跌趋势;"
    print score
    print signal.decode("utf-8").encode("gbk")
    bd.updateAnalysisData("ROC", str(score) + ";" + signal, stock_code, date)
    return [score, signal]
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:42,代码来源:ROC.py

示例12: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import updateAnalysisData [as 别名]
def analyze(stock_code, date, period):
    score = 0
    signal = ""
    OBVs = bd.getTechDataInPeriod("OBV", stock_code, date, period)
    close_in_period = bd.getBasicDataInPeriod("CLOSE_TODAY", stock_code, date, period)
    OBV_K = mu.getPoly(OBVs, 1)[0]
    CLOSE_K = mu.getPoly(close_in_period, 1)[0]

    # 1.OBV线下降,而此时股价上升,是卖出股票的信号。
    if OBV_K < 0 and CLOSE_K > 0:
        score -= 1
        signal += "[-1]OBV线下降,而此时股价上升,是卖出股票的信号;"
    # 2.OBV线上升,而此时股价下跌,是买进股票的信号。
    if OBV_K > 0 and CLOSE_K < 0:
        score += 1
        signal += "[1]OBV线上升,而此时股价下跌,是买进股票的信号;"

    # 3.OBV线从正的累积数转为负数时,为下跌趋势,应该卖出持有股票;反之,OBV线从负的累积数转为正数,应该买进股票。
    OBV_today = OBVs[0]
    OBV_pday = OBVs[1]
    if OBV_today > 0 and OBV_pday < 0:
        score += 1
        signal += "[1]OBV线从负的累积数转为正数,应该买进股票;"
    if OBV_today < 0 and OBV_pday > 0:
        score -= 1
        signal += "[-1]OBV线从正的累积数转为负数时,为下跌趋势,应该卖出持有股票;"

    # 4.OBV线呈缓慢上升时,为买进信号,但是若OBV线急速上升,隐含着能量不可能长久维持大成交量,非但不是买进信号,尚是卖出时机。
    if OBV_K > 0:
        if OBV_K > UP_RATIO_THREHOLD:
            score -= 1
            signal += "[-1]若OBV线急速上升,隐含着能量不可能长久维持大成交量,非但不是买进信号,尚是卖出时机;"
        else:
            score += 1
            signal += "[1]OBV线呈缓慢上升时,为买进信号;"
    print score
    print signal.decode("utf-8").encode("gbk")
    bd.updateAnalysisData("OBV", str(score) + ";" + signal, stock_code, date)
    return [score, signal]
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:41,代码来源:OBV.py

示例13: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import updateAnalysisData [as 别名]
def analyze(stock_code, date, period):
    score = 0.0
    signal = ""

    DMA = getDMA(stock_code, date)
    AMA = getAMA(stock_code, date)
    DMAs = getDMAs(stock_code, date, period)
    AMAs = getAMAs(stock_code, date, period)

    DMA_K1 = mu.getPoly(DMAs, 1)[0]
    AMA_K1 = mu.getPoly(AMAs, 1)[0]

    DMA_K2 = mu.getPoly(DMAs, 2)[0]
    AMA_K2 = mu.getPoly(AMAs, 2)[0]

    #1. DMA和AMA的值及线的运动方向
    if AMA > 0 and DMA > 0 and AMA_K1 > 0 and DMA_K1 > 0:
        score += 1
        signal += "[1]当DMA和AMA均大于0,并向上移动时,一般表示为股市处于多头行情中,可以买入或持股;"

    if AMA < 0 and DMA < 0 and AMA_K1 < 0 and DMA_K1 < 0:
        score -= 1
        signal += "[-1]当DMA和AMA均小于0, 并向下移动时,一般表示为股市处于空头行情中,可以卖出股票或观望;"

    if AMA > 0 and DMA > 0 and AMA_K2 > 0 and DMA_K2 > 0:
        score -= 1
        signal += "[-1]当DMA和AMA均大于0,但在经过一段比较长时间的向上运动后,如果两者同时从高位向下移动时,一般表示为股票行情处于退潮阶段,股票将下跌,可以卖出股票和观望;"

    if AMA < 0 and DMA < 0 and AMA_K1 < 0 and DMA_K1 < 0:
        score += 1
        signal += "[1]当DMA和AMA均小于0时,但在经过一段比较长时间的的向下运动后,如果两者同时从低位向上移动时,一般表示为短期行情即将启动,股票将上涨,可以短期买进股票或持股待涨;"

    close_in_period = bd.getBasicDataInPeriod("CLOSE_TODAY",stock_code, date, period)
    volumn_in_period = bd.getBasicDataInPeriod("VOLUMN", stock_code, date, period)
    close_K1 = mu.getPoly(close_in_period, 1)[0]
    volumn_K1 = mu.getPoly(volumn_in_period, 1)[0]

    #2. DMA曲线和股价曲线的配合使用
    if AMA < 0 and DMA < 0 and AMA_K1 > 0 and DMA_K1 > 0 and close_in_period > 0:
        score += 1
        signal += "[1]当DMA曲线与股价曲线从低位同步上升,表明空头力量已经衰弱、多头力量开始积聚,短期内股价有望止跌企稳,投资者应可以开始少量逢低买入;"

    if -1 <= AMA <= 1 and -1 <= DMA <= 1 and AMA_K1 > 0 and DMA_K1 > 0 and volumn_K1 > 0:
        score += 1
        signal += "[1]当DMA曲线与股价曲线从0值附近向上攀升时,表明多头力量开始大于空头力量,股价将在成交量的配合下,走出一波向上扬升的上涨行情。此时,投资者应逢低买入或坚决持股待涨;"

    pday = bd.getStockDate(stock_code, date, 1)
    DMA_pday = getDMA(stock_code, pday)
    AMA_pday = getAMA(stock_code, pday)

    #3. DMA线和AMA线的几次交叉情况
    if close_K1 < 0 and DMA_pday < AMA_pday and DMA > AMA:
        score += 1
        signal += "[1]当股价经过一段很长时间的下跌行情后,DMA线开始向上突破AMA线时,表明股市即将转强,股价跌势已经结束,将止跌朝上,可以开始买进股票,进行中长线建仓;"
    if close_K1 > 0 and DMA_pday > AMA_pday and DMA < AMA:
        score -= 1
        signal += "[-1]当股价经过前期一段很长时间的上升行情后,股价涨幅已经很大的情况下,一旦DMA线向下突破AMA时,表明股市即将由强势转为弱势,股价将大跌,这时应卖出大部分股票而不能买股票;"

    print DMA
    print DMA_pday
    print AMA
    print AMA_pday
    print score
    print signal.decode("utf-8").encode("gbk")
    bd.updateAnalysisData("DMA", str(score) + ";" + signal, stock_code, date)
    return [score, signal]
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:68,代码来源:DMA.py


注:本文中的BasicData.updateAnalysisData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。