Skip to content

Instantly share code, notes, and snippets.

@yordanoweb
Last active September 12, 2024 15:58
Show Gist options
  • Save yordanoweb/4914b4f0c95f9a2d1d3a45ed1a788fdf to your computer and use it in GitHub Desktop.
Save yordanoweb/4914b4f0c95f9a2d1d3a45ed1a788fdf to your computer and use it in GitHub Desktop.
TradingView Technical Analysis JSON
#!/bin/sh
# Pass one and only one symbol, ok?
symbol=$(echo $1 | tr '[:lower:]' '[:upper:]')
base_url="https://scanner.tradingview.com/symbol"
indicators=""
headers="-H 'accept: application/json' -H 'accept-language: en-US,en;q=0.6' -H 'cookie: _sp_ses.cf1a=*; _sp_id.cf1a=.1724704210.1.1724774007.1724704210.47da4b49-9fe0-4f61-80a6-e7a712d23368' -H 'dnt: 1' -H 'origin: https://www.tradingview.com' -H 'priority: u=1, i' -H 'referer: https://www.tradingview.com/' -H 'sec-ch-ua-platform: "Linux"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' -H 'sec-gpc: 1' -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36'"
for i in "ADX+DI[1]|60" "ADX+DI|60" "ADX-DI[1]|60" "ADX-DI|60" "ADX|60" "AO[1]|60" "AO[2]|60" "AO|60" "BBPower|60" "CCI20[1]|60" "CCI20|60" "EMA100|60" "EMA10|60" "EMA200|60" "EMA20|60" "EMA30|60" "EMA50|60" "HullMA9|60" "Ichimoku.BLine|60" "MACD.macd|60" "MACD.signal|60" "Mom[1]|60" "Mom|60" "Pivot.M.Camarilla.Middle|60" "Pivot.M.Camarilla.R1|60" "Pivot.M.Camarilla.R2|60" "Pivot.M.Camarilla.R3|60" "Pivot.M.Camarilla.S1|60" "Pivot.M.Camarilla.S2|60" "Pivot.M.Camarilla.S3|60" "Pivot.M.Classic.Middle|60" "Pivot.M.Classic.R1|60" "Pivot.M.Classic.R2|60" "Pivot.M.Classic.R3|60" "Pivot.M.Classic.S1|60" "Pivot.M.Classic.S2|60" "Pivot.M.Classic.S3|60" "Pivot.M.Demark.Middle|60" "Pivot.M.Demark.R1|60" "Pivot.M.Demark.S1|60" "Pivot.M.Fibonacci.Middle|60" "Pivot.M.Fibonacci.R1|60" "Pivot.M.Fibonacci.R2|60" "Pivot.M.Fibonacci.R3|60" "Pivot.M.Fibonacci.S1|60" "Pivot.M.Fibonacci.S2|60" "Pivot.M.Fibonacci.S3|60" "Pivot.M.Woodie.Middle|60" "Pivot.M.Woodie.R1|60" "Pivot.M.Woodie.R2|60" "Pivot.M.Woodie.R3|60" "Pivot.M.Woodie.S1|60" "Pivot.M.Woodie.S2|60" "Pivot.M.Woodie.S3|60" "RSI[1]|60" "RSI|60" "Rec.BBPower|60" "Rec.HullMA9|60" "Rec.Ichimoku|60" "Rec.Stoch.RSI|60" "Rec.UO|60" "Rec.VWMA|60" "Rec.WR|60" "Recommend.All|60" "Recommend.MA|60" "Recommend.Other|60" "SMA100|60" "SMA10|60" "SMA200|60" "SMA20|60" "SMA30|60" "SMA50|60" "Stoch.D[1]|60" "Stoch.D|60" "Stoch.K[1]|60" "Stoch.K|60" "Stoch.RSI.K|60" "UO|60" "VWMA|60" "W.R|60" "close|60"
do
if [ -n "$indicators" ]
then
indicators="$indicators,$i"
else
indicators="$i"
fi
done
encoded_indicators=$(python -c "import urllib.parse; print(urllib.parse.quote('$indicators'))")
curl -s "$base_url?symbol=BINANCE%3A$symbol&fields=$encoded_indicators&no_404=true&label-product=popup-technicals" "$headers"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment