• 07-02-2019, 11:49:57
    #1
    Binance borsasında api,websocketle verileri alıp indikatör hesaplama yardım edecek birini arıyorum.coin,periodu değiştiirnce değerinde değişmesi lazım.tradingview üzerinden kontrol edileiblir.


    from binance.client import Client
    import pandas as pd
    
    
    client = Client('api-key', 'api-secret')
    
    orders=client.get_order_book(symbol='BTCUSDT')
    candles = client.get_klines(symbol='BTCUSDT', interval=Client.KLINE_INTERVAL_30MINUTE)
    prices = pd.DataFrame(prices)

    RSI için formul

    RSI = 100 - 100 / (1 + RS)

    RS = Average gain of last 14 trading days / Average loss of last 14 trading days



    def RSI(series, period):
     delta = series.diff().dropna()
     u = delta * 0
     d = u.copy()
     u[delta > 0] = delta[delta > 0]
     d[delta < 0] = -delta[delta < 0]
     u[u.index[period-1]] = np.mean( u[:period] ) #first value is sum of avg gains
     u = u.drop(u.index[:(period-1)])
     d[d.index[period-1]] = np.mean( d[:period] ) #first value is sum of avg losses
     d = d.drop(d.index[:(period-1)])
     rs = pd.stats.moments.ewma(u, com=period-1, adjust=False) / \
     pd.stats.moments.ewma(d, com=period-1, adjust=False)
     return 100 - 100 / (1 + rs)
    **bana sadece cmd için değer lazım. matplot ile çizdirmeyeceğim . o değeri alım satım değerinde kullanacağım.
  • 21-02-2019, 21:36:26
    #2
    Çözümü buldum. Bu sayfaya bakıp çözüm işine yarayacaklar için kısaca yazayım.



    import ta
    import pandas as pd
    
    client.get_historical_klines(symbol="BTCUSDT" , Client.KLINE_INTERVAL_5MINUTE, start_str="2hours ago UTC")
    
    
    
    ta.momentum.rsi(close, n=14, fillna=False)
    sorusu olan varsa çözüme yardımcı olabiirim.