Пример #1
0
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]
Пример #2
0
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]
Пример #3
0
def calcROCMA(stock_code, date, period):
    ROCs = bd.getTechDataInPeriod("ROC", stock_code, date, period)
    ROCMA = 0.0

    for ROC in ROCs:
        ROCMA += ROC[0]

    ROCMA = ROCMA / period
    return round(ROCMA, 3)
Пример #4
0
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]
Пример #5
0
def getCCIs(stock_code, date, period):
    return bd.getTechDataInPeriod("CCI", stock_code, date, period)
Пример #6
0
def getROCs(stock_code, date, period):
    return bd.getTechDataInPeriod("ROC", stock_code, date, period)
Пример #7
0
def getARs(stock_code, date, period):
    return bd.getTechDataInPeriod("BRAR_AR", stock_code, date, period)
Пример #8
0
def getAMAs(stock_code, date, period):
    return bd.getTechDataInPeriod("AMA", stock_code, date, period)