Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Notify on value smaller/greater than x #2817

Open
nvllz opened this issue Dec 1, 2024 · 3 comments
Open

[feature] Notify on value smaller/greater than x #2817

nvllz opened this issue Dec 1, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@nvllz
Copy link

nvllz commented Dec 1, 2024

Version and OS
0.47.06 on linux/docker

Is your feature request related to a problem? Please describe.
When trying to monitor for prices (i find this price calculator thing not work most of the times), or let's say currency prices, I can't get set notifications to be sent only when bigger/lower than x. For example: notify when btc price is > 100000 when using this api output https://blockchain.info/ticker, or just use simpler tool for scraping prices as the solution you recently introduced doesn't work for Amazon and requires you to apply the service to other providers. This way users could handle things on their own.

Describe the solution you'd like
I'd like the "Trigger/wait for text" to be expanded with handling expressions such as greater, greater or equal, etc..

Describe the use-case and give concrete real-world examples
In this case users would be notified only when btc usd price is bigger for 100k USD. Now you can only get the current value, which fluctates every 15m, making value change notifications pointless.

@nvllz nvllz added the enhancement New feature or request label Dec 1, 2024
@dgtlmoon
Copy link
Owner

dgtlmoon commented Dec 3, 2024

Maybe also "when a new low number" or "when a new highest number" in history is reached

@drabgail
Copy link

drabgail commented Dec 6, 2024

Considering the link just returns json would it not be best to use something other than a full page render to identify the btc price. Would a better feature request here be to allow parsing and monitoring of json-like objects without using a full browser session to do it?

That said though, if you add this javascript to one of your steps after the page loads it will update the content of the page to show if the last USD price was over/under 100000:

fetch('https://blockchain.info/ticker').then(res => res.json()).then(data => document.body.innerText = data.USD?.last ? (data.USD.last > 100000 ? 'OVER' : 'UNDER') : 'UNKNOWN').catch(() => document.body.innerText = 'UNKNOWN');

I couldn't get this to work on https://blockchain.info/ticker as my CD gets a 403 when browsing to it but if I set my watch url to https://www.example.com/ and add the javascript as a browser step it works (example.com is very useful as a launch page to run hand written javascript).

image

@dgtlmoon
Copy link
Owner

dgtlmoon commented Dec 6, 2024

Guys, in this case (that you are parsing JSON directly) just use the jq: filter

( I actually just pasted the JSON into ChatGPT and asked it for a JQ filter, took 20 seconds )

image

jq:.USD | select(.["15m"] > 98000)| .["15m"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants