Ejemplo n.º 1
0
def screen():
    client = Client("api-key", "api-secret", {"verify": False, "timeout": 20})
    positiveCoin = get_positive_coin.positiveCoin

    pbCoin = []
    for m in positiveCoin:
        candles = client.get_klines(symbol=m,
                                    interval=client.KLINE_INTERVAL_15MINUTE)
        close = []
        for n in candles:
            close.append(float(n[4]))
        pb = pbb(close, 20, 2.0, 2.0)
        if 50 > pb[-1] > 10:
            pbCoin.append(m)

    # bullishKScoin = []
    # for m in pbCoin:
    #     candles = client.get_klines(symbol=m, interval=client.KLINE_INTERVAL_30MINUTE)
    #     if candles[-2][1] < candles[-2][4] <= candles[-1][1] < candles[-1][4]:
    #         bullishKScoin.append(m)

    maxDemandRatio = 0
    buyingCoin = ''
    for m in pbCoin:
        depth = client.get_order_book(symbol=m)
        buyingVol = 0
        sellingVol = 0
        for n in depth['bids'][0:20]:
            buyingVol = buyingVol + float(n[1])
        for n in depth['asks'][0:20]:
            sellingVol = sellingVol + float(n[1])
        demandRatio = buyingVol / sellingVol
        print(demandRatio)
        print(maxDemandRatio)
        if demandRatio > maxDemandRatio:
            maxDemandRatio = demandRatio
            buyingCoin = m

    if maxDemandRatio < 1:
        buyingCoin = ''

    print(pbCoin)
    print(buyingCoin)
    return buyingCoin
Ejemplo n.º 2
0
def screen():
    client = Client("api-key", "api-secret", {"verify": False, "timeout": 20})
    positiveCoin = get_positive_coin.positiveCoin

    bollCoin = []
    for m in positiveCoin:
        candles = client.get_klines(symbol=m,
                                    interval=client.KLINE_INTERVAL_15MINUTE)
        close = []
        for n in candles:
            close.append(float(n[4]))
        pb = pbb(close, 20, 2.0, 2.0)
        lb = lbb(close, 20, 2.0)
        ub = ubb(close, 20, 0.2)
        if pb[-1] > 50 and ((ub[-1] - lb[-1]) / lb[-1]) > 0.03:
            if candles[-2][1] < candles[-2][4]:
                if candles[-2][4] <= candles[-1][1]:
                    if candles[-1][1] < candles[-1][4]:
                        bollCoin.append(m)

    buyingCoin = ''
    maxDemandRatio = 0
    for m in bollCoin:
        depth = client.get_order_book(symbol=m)
        buyingVol = 0
        sellingVol = 0
        for n in depth['bids'][0:20]:
            buyingVol = buyingVol + float(n[1])
        for n in depth['asks'][0:20]:
            sellingVol = sellingVol + float(n[1])
        demandRatio = buyingVol / sellingVol
        print(demandRatio)
        print(maxDemandRatio)
        if demandRatio > maxDemandRatio:
            maxDemandRatio = demandRatio
            buyingCoin = m

    if maxDemandRatio < 1.5:
        buyingCoin = ''

    print(bollCoin)
    print(buyingCoin)
    return buyingCoin
Ejemplo n.º 3
0
def screen():
    client = Client("api-key", "api-secret", {"verify": False, "timeout": 20})
    positiveCoin = get_positive_coin.coin

    bollCoin = []
    for m in positiveCoin:
        candles = client.get_klines(symbol=m,
                                    interval=client.KLINE_INTERVAL_15MINUTE)
        close = []
        for n in candles:
            close.append(float(n[4]))
        pb = pbb(close, 20, 2.0, 2.0)
        if pb[-1] < 10:
            bollCoin.append(m)

    macdCoin = []
    for m in bollCoin:
        candles = client.get_klines(symbol=m,
                                    interval=client.KLINE_INTERVAL_5MINUTE)
        close = []
        for n in candles:
            close.append(float(n[4]))
        mac = macd(close, 12, 26)
        macs = macds(mac)
        mach = macdh(mac, macs)
        if mach[-1] > 0 and (macs[-1] - macs[-2]) < 0 and (mac[-1] -
                                                           mac[-2]) > 0:
            macdCoin.append(m)

    rsiCoin = []
    for m in macdCoin:
        candles = client.get_klines(symbol=m,
                                    interval=client.KLINE_INTERVAL_15MINUTE)
        close = []
        for n in candles:
            close.append(float(n[4]))
        rs = rsi(close, 14)
        if rs[-1] < 30:
            rsiCoin.append(m)
    buyingCoin = ''
    maxDemandRatio = 0
    for m in rsiCoin:
        depth = client.get_order_book(symbol=m)
        buyingVol = 0
        sellingVol = 0
        for n in depth['bids'][0:20]:
            buyingVol = buyingVol + float(n[1])
        for n in depth['asks'][0:20]:
            sellingVol = sellingVol + float(n[1])
        demandRatio = buyingVol / sellingVol
        print(demandRatio)
        print(maxDemandRatio)
        if demandRatio > maxDemandRatio:
            maxDemandRatio = demandRatio
            buyingCoin = m

    if maxDemandRatio < 1.5:
        buyingCoin = ''

    print(bollCoin)
    print(macdCoin)
    print(rsiCoin)
    print(buyingCoin)
    return buyingCoin