예제 #1
0
     """ Today is a doji candlestick """
     ch = datetime.now().strftime("%H")
     if int(ch) < 14:
         continue
     history_ticker_data = stockHistory.getStockHistoryData(ticker)
     htd = jModel.convertToJapanCandle(history_ticker_data)
     _close = htd.Close.to_numpy()
     isDownTrend = jModel.isDownTrendV2ByRSI(_close)
     if isDownTrend is True:
         selectedTickers.append(ticker)
         message += ticker + "(" + str(price) + ")\n"
 elif open < close:
     """ Today is a white candlestick """
     go_pass = False
     # ----------------------------------------------------------------------------------------------
     isHammer = jModel.isHammer(body, total_height, head, tail)
     isSpinningTopCandlestick = jModel.isSpinningTopCandlestick(
         body, total_height, head, tail)
     isShavenHead = jModel.isShavenHead(total_height, head)
     isShavenBottom = jModel.isShavenBottom(total_height, tail)
     isBigBody = jModel.isBigBody(body, total_height, open, close)
     isLongTail = True if tail > 0.65 * total_height else False
     # ----------------------------------------------------------------------------------------------
     if isBigBody is True:
         if isShavenHead is True or isShavenBottom is True:
             go_pass = True
     else:
         if isLongTail is True:
             if total_height > 0.05 * close:
                 """ Oscillation amplitude must be bigger than 5%"""
                 go_pass = True
예제 #2
0
    condition = jModel.isWhiteCandlestick(ticker_data['openPrice'],
                                          ticker_data['matchedPrice'])
    # today is a white candlestick
    if condition is True:
        # print(ticker)
        history_ticker_data = stockHistory.getStockHistoryData(
            ticker)  # not include today data
        # print(history_ticker_data)
        htd = jModel.convertToJapanCandle(history_ticker_data)
        _open = htd.Open.to_numpy()
        _close = htd.Close.to_numpy()
        _highest = htd.High.to_numpy()
        _lowest = htd.Low.to_numpy()
        _height = htd.Height.to_numpy()
        _body = htd.Body.to_numpy()
        _up = htd.UpShadow.to_numpy()
        _bot = htd.LowerShadow.to_numpy()
        # isDownTrend = jModel.isDownTrendV1(_open, _close, _highest, _lowest, _body, _height, _up, _bot)
        isDownTrend = jModel.isDownTrendV2ByRSI(_close)
        _iuc = jModel.isHammer(_body[-1], _height[-1], _up[-1], _bot[-1])

        if isDownTrend is True:
            if _iuc is True:
                print(ticker)
                file_object.write(ticker + '---Buy---\n')
            else:
                # Append 'hello' at the end of file
                file_object.write(ticker + '---None---\n')
                # Close the file
        time.sleep(2)
file_object.close()