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


Python BasicData.getTechDataInPeriod方法代码示例

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


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

示例1: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import getTechDataInPeriod [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

示例2: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import getTechDataInPeriod [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

示例3: calcROCMA

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import getTechDataInPeriod [as 别名]
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)
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:11,代码来源:ROC.py

示例4: analyze

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import getTechDataInPeriod [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

示例5: getCCIs

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import getTechDataInPeriod [as 别名]
def getCCIs(stock_code, date, period):
    return bd.getTechDataInPeriod("CCI", stock_code, date, period)
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:4,代码来源:CCI.py

示例6: getROCs

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import getTechDataInPeriod [as 别名]
def getROCs(stock_code, date, period):
    return bd.getTechDataInPeriod("ROC", stock_code, date, period)
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:4,代码来源:ROC.py

示例7: getARs

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import getTechDataInPeriod [as 别名]
def getARs(stock_code, date, period):
    return bd.getTechDataInPeriod("BRAR_AR", stock_code, date, period)
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:4,代码来源:BRAR.py

示例8: getAMAs

# 需要导入模块: import BasicData [as 别名]
# 或者: from BasicData import getTechDataInPeriod [as 别名]
def getAMAs(stock_code, date, period):
    return bd.getTechDataInPeriod("AMA", stock_code, date, period)
开发者ID:A1eXFei,项目名称:StockMarket,代码行数:4,代码来源:DMA.py


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