Checks your crypto watchlist every hour and sends a Telegram alert for each coin that moved more than your threshold.
Uses
CoinMarketCap
Telegram
Alert me in Telegram when a coin moves sharply
Every hour, the coins on your watchlist are checked against CoinMarketCap and a Telegram message is sent for each one whose price moved further in the last hour than the percentage you chose. Each run looks at a window the previous one did not.
Each alert names the coin and gives the hourly change that set it off, the threshold it passed, the current price in US dollars and the change over 24 hours, ending with a note that this is observed market data, not financial advice. A reading CoinMarketCap does not return raises nothing at all, because an alert fired on a value that was never read is worse than silence. Alerts per run are capped, so a swing across the whole market cannot flood the chat, and they carry no view on what a move means or what you should do.
You need a Telegram chat for the alerts and a list of ticker symbols to watch; a coin has to be large enough by market cap to appear in the listing that is searched.
watchlist to blank.Set watchlist to blank.alertChatId to blank.Set alertChatId to blank.movePercent to blank.Set movePercent to blank.maxAlertsPerRun to 10.Set maxAlertsPerRun to 10.coinsSearched to 300.Set coinsSearched to 300.alertThreshold to 0.Set alertThreshold to 0.thresholdErrorIf a step below fails, save the error as thresholdErrormovePercent multiplied by 1 to 2 decimal places and save it as alertThreshold.Round movePercent multiplied by 1 to 2 decimal places and save it as alertThreshold.The move percentage is not a number..Show in the output: The move percentage is not a number..alertThreshold is less than or equal to 0If alertThreshold is less than or equal to 0alertCap to 0.Set alertCap to 0.capErrorIf a step below fails, save the error as capErrormaxAlertsPerRun multiplied by 1 to the nearest integer and save it as alertCap.Round maxAlertsPerRun multiplied by 1 to the nearest integer and save it as alertCap.The alert cap is not a number..Show in the output: The alert cap is not a number..alertCap is less than or equal to 0If alertCap is less than or equal to 0watchedSymbols to an empty list.Set watchedSymbols to an empty list.watchlistEntry in watchlist split by ,:For each watchlistEntry in watchlist split by ,:watchlistEntry uppercase and save it as cleanedSymbol.Make watchlistEntry uppercase and save it as cleanedSymbol.cleanedSymbol isn't emptyIf cleanedSymbol isn't emptycleanedSymbol to the end of watchedSymbols and save it as watchedSymbols.Add cleanedSymbol to the end of watchedSymbols and save it as watchedSymbols.watchedSymbols is emptyIf watchedSymbols is emptylistings.Get top CoinMarketCap cryptocurrencies. Save it as listings.rows to listings.listings.data.Set rows to listings.listings.data.alertsSent to 0.Set alertsSent to 0.row in rows:For each row in rows:alertsSent is greater than or equal to alertCapIf alertsSent is greater than or equal to alertCapsymbol to row.symbol.Set symbol to row.symbol.shouldAlert to false.Set shouldAlert to false.alertText to blank.Set alertText to blank.rowErrorIf a step below fails, save the error as rowErrorsymbol isn't empty and watchedSymbols contains symbolIf symbol isn't empty and watchedSymbols contains symbolusdQuote to row.quote.USD.Set usdQuote to row.quote.USD.hourChangeRaw to usdQuote.percent_change_1h.Set hourChangeRaw to usdQuote.percent_change_1h.hourChange to 0.Set hourChange to 0.moveSize to -1.Set moveSize to -1.hourChangeRaw isn't emptyIf hourChangeRaw isn't emptyhourChange to hourChangeRaw multiplied by 1.Change hourChange to hourChangeRaw multiplied by 1.hourChange and save it as moveSize.Calculate the absolute value of hourChange and save it as moveSize.moveSize is greater than or equal to alertThresholdIf moveSize is greater than or equal to alertThresholdalertLines to an empty list.Set alertLines to an empty list.heading to symbol.Set heading to symbol.row.name isn't emptyIf row.name isn't emptyheading to row.name (symbol).Change heading to row.name (symbol).heading to the end of alertLines and save it as alertLines.Add heading to the end of alertLines and save it as alertLines.hourChange formatted as a plain number with 2 decimal places% to the end of alertLines and save it as alertLines.Add 1h change: hourChange formatted as a plain number with 2 decimal places% to the end of alertLines and save it as alertLines.alertThreshold formatted as a plain number with 2 decimal places% in an hour to the end of alertLines and save it as alertLines.Add Your alert threshold: alertThreshold formatted as a plain number with 2 decimal places% in an hour to the end of alertLines and save it as alertLines.priceLine to Price: not reported by CoinMarketCap.Set priceLine to Price: not reported by CoinMarketCap.priceRaw to usdQuote.price.Set priceRaw to usdQuote.price.priceRaw isn't emptyIf priceRaw isn't emptypriceErrorIf a step below fails, save the error as priceErrorpriceNumber to priceRaw multiplied by 1.Set priceNumber to priceRaw multiplied by 1.priceNumber is less than 1If priceNumber is less than 1priceLine to Price: priceNumber formatted as US dollars with 8 decimal places.Change priceLine to Price: priceNumber formatted as US dollars with 8 decimal places.priceLine to Price: priceNumber formatted as US dollars with 2 decimal places.Change priceLine to Price: priceNumber formatted as US dollars with 2 decimal places.The price came back in a form that is not a number, so it was left out..Show in the output: The price came back in a form that is not a number, so it was left out..priceLine to the end of alertLines and save it as alertLines.Add priceLine to the end of alertLines and save it as alertLines.dayChangeRaw to usdQuote.percent_change_24h.Set dayChangeRaw to usdQuote.percent_change_24h.dayChangeRaw isn't emptyIf dayChangeRaw isn't emptydayChangeRawErrorIf a step below fails, save the error as dayChangeRawErrordayChangeRaw multiplied by 1 formatted as a plain number with 2 decimal places% to the end of alertLines and save it as alertLines.Add 24h change: dayChangeRaw multiplied by 1 formatted as a plain number with 2 decimal places% to the end of alertLines and save it as alertLines.A percentage came back in a form that is not a number, so it was left out..Show in the output: A percentage came back in a form that is not a number, so it was left out..Observed market data from CoinMarketCap. Not financial advice. to the end of alertLines and save it as alertLines.Add Observed market data from CoinMarketCap. Not financial advice. to the end of alertLines and save it as alertLines.alertLines with a new line and save it as alertText.Join alertLines with a new line and save it as alertText.shouldAlert to true.Change shouldAlert to true.rowError as text.Show in the output: Skipped one coin while checking for moves: rowError as text.shouldAlert is yesIf shouldAlert is yesalertChatId.Send a message to chat alertChatId.alertTextalertsSent.Add 1 to alertsSent.