Since there aren't really good apps for instant crypt price alert, I'm doing it by myself. I'm struggling when comes to send the alert to my phone because I want the timer to fire just once for every value I choose. I'm sending the alerts through Pushbullet API to my phone and I don't want to flood it.
I'm parsing the "price" through an online API by timer1 in real time. Everything works perfectly, but the timer2. Obviously timer 1 is ticking every 5 second to check if price is above the value I choosen, but then if the price rises above that choosen value then it's sending the alert through PushBullet every time it ticks. How can I let the timer1 check if the price is above the values and if yes tick just one? The closest idea i got is :
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick If CInt(price) > 0.05060 Then timer2.start ElseIf CInt(price) > 0.05080 Then timer2.start ElseIf CInt(price) < 0.04960 Then timer2.start End If Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick Pushbullet("Price above 0.05060") '[....] '[....] Timer2.Stop() End Sub Obviously Its important not to stop timer1, but instead timer2. But how can I manage this? I'm quite stucked on it. Any idea? Thanks
https://stackoverflow.com/questions/66728459/how-to-fire-timer-only-once-for-specific-values March 21, 2021 at 11:06AM
没有评论:
发表评论