$TUT
import time
import pandas as pd
import ta
from binance.client import Client
# 1. Kunci API
api_key = "TUMHARA_API_KEY"
api_secret = "TUMHARA_API_SECRET"
client = Client(api_key, api_secret)
symbol = "TUTUSDT"
quantity = 10 # Mau beli TUT berapa banyak
def get_rsi():
klines = client.get_klines(symbol=symbol, interval=Client.KLINE_INTERVAL_5MINUTE, limit=50)
df = pd.DataFrame(klines, columns=['time','open','high','low','close','vol','c1','c2','c3','c4','c5','c6'])
df['close'] = df['close'].astype(float)
rsi = ta.momentum.RSIIndicator(df['close']).rsi().iloc[-1]
price = df['close'].iloc[-1]
return float(price), float(rsi)
while True:
price, rsi = get_rsi()
print(f"Harga: {price} USDT | RSI: {rsi}")
# 2. Logika: RSI < 30 = Oversold = Beli | RSI > 70 = Overbought = Jual
if rsi < 30:
print("Sinyal Beli")
# order = client.order_market_buy(symbol=symbol, quantity=quantity)
elif rsi > 70:
print("Sinyal Jual")
# order = client.order_market_sell(symbol=symbol, quantity=quantity)
time.sleep(300) # Cek lagi setelah 5 menit
import time
import pandas as pd
import ta
from binance.client import Client
# 1. Kunci API
api_key = "TUMHARA_API_KEY"
api_secret = "TUMHARA_API_SECRET"
client = Client(api_key, api_secret)
symbol = "TUTUSDT"
quantity = 10 # Mau beli TUT berapa banyak
def get_rsi():
klines = client.get_klines(symbol=symbol, interval=Client.KLINE_INTERVAL_5MINUTE, limit=50)
df = pd.DataFrame(klines, columns=['time','open','high','low','close','vol','c1','c2','c3','c4','c5','c6'])
df['close'] = df['close'].astype(float)
rsi = ta.momentum.RSIIndicator(df['close']).rsi().iloc[-1]
price = df['close'].iloc[-1]
return float(price), float(rsi)
while True:
price, rsi = get_rsi()
print(f"Harga: {price} USDT | RSI: {rsi}")
# 2. Logika: RSI < 30 = Oversold = Beli | RSI > 70 = Overbought = Jual
if rsi < 30:
print("Sinyal Beli")
# order = client.order_market_buy(symbol=symbol, quantity=quantity)
elif rsi > 70:
print("Sinyal Jual")
# order = client.order_market_sell(symbol=symbol, quantity=quantity)
time.sleep(300) # Cek lagi setelah 5 menit