Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

how can i run command once and continue loop

I was searching in the Python forum and came across this script, a BTC Ticker and gave me the idea to do a BNB ticker to monitor volume and price. While the code is probably noobish and needs improvement (I tried implementing what I have learned thus far) I am calculating based on the volume if it increases or decreases, but what I really want to accomplish is to detect  jump in the volume by XXX percent might it be decreased in volume or increase (to try and keep an eye if they dumping ALTS) how can I implement such alert (a print for example) but that only happens once on every jump because I only know how to do it as persistent and I want to just trigger once per event.

source code: https://pastebin.com/raw/NDjfpUHQ
well first of all what is your resolution? is the percent_change_1h your most detailed view into the coin price? or can you just use the "volume" and get a minute by minute view?

also what will your XXX percent change be relative to? the last time there was an XXX percent change?
so you start off at volume A at time T1, and once volume B at time T2 is greater than Z percent in either direction relative to volume A, you spit our an alert,
and volume A at T1 becomes volume B at T2.
to do this you would just record the volume when you start, and run a while loop with an if sentence that is reading the new volume, and checks whether its greater than XXX percent or less than negative XXX percent relative to the currently recorded volume. you do know how to calculate percentages, when you have two numbers? if it is more than XXX percent, then you make the current volume the new volume, and spit out your message.
(Jul 2, 2018 05:10 AM)vegardagain Wrote:  well first of all what is your resolution? is the percent_change_1h your most detailed view into the coin price? or can you just use the "volume" and get a minute by minute view?

also what will your XXX percent change be relative to? the last time there was an XXX percent change?
so you start off at volume A at time T1, and once volume B at time T2 is greater than Z percent in either direction relative to volume A, you spit our an alert,
and volume A at T1 becomes volume B at T2.
to do this you would just record the volume when you start, and run a while loop with an if sentence that is reading the new volume, and checks whether its greater than XXX percent or less than negative XXX percent relative to the currently recorded volume. you do know how to calculate percentages, when you have two numbers? if it is more than XXX percent, then you make the current volume the new volume, and spit out your message.

cmc updates that API every 3 minutes so yes what I am trying to do is when running the script first time it would check for any changes say 5% difference either negative or positive. once that is triggered it will take current volume and check for another increase/decrease. I want it to update say "current" volume every time it finds a 5% difference. it will take current volume and check again for any difference.
do you wnat me to write the code for you? :s


Possibly Related Threads...
Thread / Author Replies Views Last Post
by EnigmatikkJun 22, 2025 08:59 AM 12 323 Jun 22, 2025 08:59 AM
Last Post: ʀ00ȶʐɨʟʟǟ
[C#] by randomvodkaloverAug 8, 2020 11:32 PM 8 245 Aug 8, 2020 11:32 PM
Last Post: randomvodkalover
[Shell] by ImDeepWithWindowsJul 4, 2020 06:19 PM 0 167 Jul 4, 2020 06:19 PM
Last Post: ImDeepWithWindows