developing here:
https://github.com/litepresence/extinction-event/tree/master/EVworking under the assumption that any node can provide rogue price feeds at any given time,
I sort all nodes by latency every two minutes
then check last price on 5 low latency nodes to verify authenticity of the data every 30 seconds
5 NODE VERIFIED LAST PRICEnodes.py and last.py should be run in seperate terminals
nodes.py creates file nodes.txt
last.py creates file last.txt and appends to file blacklist.txt
nodes.txt is the top 10 latency sorted nodes of about 50 known nodes; updated approx every 2 minutes
last.py uses nodes.txt to get price from 5 nodes, then makes a list "prices", updated approx ever 30 seconds
then process that list of prices from 5 different nodes pseudocode:
if the spread of the prices is too wide:
append to file blacklist.txt the list of prices and the list of nodes used to gather them
if all prices are same:
last = latest price
elif latest price less than 2% different than mean(prices):
last = latest price
else:
try: last = mode(prices)
except: last = median(prices)
write last to last.txt
the good news:
I ran this all day on BTS/BTC and no set of 5 prices were more than 2% different... meaning I never encountered a rogue node.
the better news:this price feed can be used with confidence to feed bots with latest price data without risk of node going stale or going rogue
the best news:I work on bid/ask tomorrow
