Skip to content

Instantly share code, notes, and snippets.

@ssghost
Last active April 14, 2024 00:10
Show Gist options
  • Save ssghost/4d92b5797554c22dcdcf0758166d4db8 to your computer and use it in GitHub Desktop.
Save ssghost/4d92b5797554c22dcdcf0758166d4db8 to your computer and use it in GitHub Desktop.
from tradingview_ta import TA_Handler, Interval
import requests
import timeout_decorator
@timeout_decorator.timeout(300)
def tvta():
symbols = ["BTCUSDT", "ETHUSDT", "SOLUSDT", "BCHUSDT"]
for sym in symbols:
handler = TA_Handler(symbol=sym, screener='crypto', exchange='BINANCEUS', interval=Interval.INTERVAL_1_DAY)
indicator = handler.get_analysis().summary
print(sym+": "+str(indicator['RECOMMENDATION'])+", "+"{:.3f}".format((indicator['BUY']-indicator['SELL'])/(indicator['BUY']+indicator['SELL']+indicator['NEUTRAL'])))
print("--------")
data = requests.get("https://api.bitget.com/api/v2/mix/market/tickers?productType=USDT-FUTURES").json()["data"]
symbols_all = [d["symbol"] for d in data]
for sym in symbols_all:
handler = TA_Handler(symbol=sym, screener='crypto', exchange='BITGET', interval=Interval.INTERVAL_1_DAY)
indicator = handler.get_analysis().summary
if indicator['RECOMMENDATION'] == "STRONG_BUY" or indicator['RECOMMENDATION'] == "STRONG_SELL":
print(sym+": "+str(indicator['RECOMMENDATION'])+", "+"{:.3f}".format((indicator['BUY']-indicator['SELL'])/(indicator['BUY']+indicator['SELL']+indicator['NEUTRAL'])))
if __name__ == '__main__':
try:
tvta()
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment