Monitor Witness Price Feed Script

surprised-1184889_960_720.png

I've noticed a few witness have been having stale price feeds. They usually get around to fixing it, but sometimes it takes a few days.

I run a simple script that monitors my price feed and alerts me if it is stale by over 8 hours.

There are a lot of reasons why a price feed may be stale, sometimes the script trips up and needs to be restarted, or node issues prevent the your feed from broadcasting. Whatever the reason, knowing when your feed is stale is extremely helpful and responsible as a witness.

Below you will find the script I use to monitor my feed and use Pushover to send me a Push notification when it is stale. Feel free to use it and change out the notification service for something you prefer.

You will need python, Beem, and a Pushover account to use this script. You are free to use it as you please. I recommend using something like PM2 to keep it running.

import requests
import time

from beem import Hive
from beem.witness import Witness
from datetime import datetime, timedelta, timezone

witnesses = []
feed_time_threshold = 8 * 60 * 60
delay = 60 * 60

pushover_endpoint = 'https://api.pushover.net/1/messages.json'
pushover_app_key = ''
pushover_key = ''


def send_pushover_notification(message):
  requests.post(pushover_endpoint, data={"token": pushover_app_key,
     "user": pushover_key, "message": message})


def get_witness_feed_update_time(witness):
        return Witness(witness)['last_hbd_exchange_update']


def check_witness_feed(witness, date):
        print(witness, datetime.now(timezone.utc) - date)
        if (datetime.now(timezone.utc) - date).total_seconds() > feed_time_threshold:
                send_pushover_notification(f"{witness} feed is stale")


while(True):
        for witness in witnesses:
                check_witness_feed(witness, get_witness_feed_update_time(witness))
        time.sleep(delay)


0
0
0.000
20 comments
avatar

What does it mean for the witness or everybody else if the price stales?

0
0
0.000
avatar

Any one witness feed isn't a major problem as all the top 20 feeds are used. However it isn't uncommon to have one or two or more feeds to break. When you start looking at backup witnesses, it is even worse.

0
0
0.000
avatar

Is it a problem when a price doesn't update or stales? Like what happens? :D

I am not that techy regarding hive stuff, just curious :D

0
0
0.000
avatar

Yes, it will affect anything on the blockchain that depends on the price feed like payouts and internal market.

0
0
0.000
avatar

Ohh shit, thats important then :D
I never understood it!

Thanks!

0
0
0.000
avatar

I told you to burn your Blurts DH... You downvote people promoting Blurt here, then go over there and claim Blurt rewards for yourself???

Don't have enough money for a cup of coffee buddy?
I thought you don't need those 1380 Blurts? What a friggin loser! xD

Read the details here people:
https: // hive.blog/hive/@networkallstar/scummy-themarkymark-claims-1380-in-blurt-rewards-downvotes-anybody-promoting-blurt-on-hive

of the original on Blurt here:
https: // blurt.blog/witness/@outofthematrix/themarkymark-claims-1380-in-blurt-rewards-downvotes-anybody-promoting-blurt-on-hive

0
0
0.000
avatar

Ah... is this why sometimes things don't load and a message pops up to say try a new node?

0
0
0.000
avatar

Now I understand why no one sees my content. Thank God I took a break from my blog. Thanks a lot for the informative post. Good luck sir.

0
0
0.000
avatar

This shouldn't affect who sees your content.

0
0
0.000
avatar

I know sir. It was the cry of the soul. Thanks for responding to my comment 🙏

0
0
0.000
avatar

I took a quick peek at your profile @cherepin, and my guess is that no one sees your content because you barely interact with anyone else. And when you do, more often than not, you're complaining that no one "sees" your content (which most people would interpret to be a complaint about the lack of upvotes).

You're also only posting in the general "GEMS" community, instead of specific communities related to your content (where it would have a higher chance of being seen).

Try joining communities you find interesting, and genuinely engage with people under their posts (not just in a "great post" sort of way), and I'm sure you'll develop a following soon.

0
0
0.000
avatar

Expected response. I would say the standard answer. I could show you 20 accounts whose content you '' don't see. I think it's useless, a waste of time. God is your judge. As for the ,, complaint ‘’, I won’t do this here, it’s just an exchange of information. Thanks for responding to my comment.

0
0
0.000
avatar

Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support. 
 

0
0
0.000
avatar

Gotdang I can sort of understand the script you got there.

I guess my 100 day code challenge is kind of doing its work on me. Of course I am more inclined to say it is a 1000 day challenge.

I don't have a witness so I will just thank you for everyone's behalf.

Thank you!

0
0
0.000