(Python) latency sorted Bitshares nodes

Started by litepresence, March 11, 2018, 05:53:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

litepresence

#5
I've made considerable progress on this script check the github in OP

I've live tested it in a while loop 24 hours and it maintains an output file of latency tested "nodes.txt"

def nodes(timeout=20, pings=999999, crop=99, noprint=False, write=False,
          include=False, exclude=False, suffix=True, master=False):

    # timeout : seconds to ping until abort per node
    # pings   : number of good nodes to find until satisfied (0 none, 999 all)
    # suffix  : checks each node for no suffix plus with /ws or /wss
    # noprint : disables printing, only returns list of good nodes
    # master  : check only nodes listed in bitshares/ui/master
    # crop    : return only best nodes
    # write   : maintains an output file nodes.txt with list of best nodes

litepresence

Quote from: abit on March 11, 2018, 06:52:03 PM
Perhaps it's good tool for pybitshares. Can you make a PR in github? Or even create your own tool set.

I've decided to maintain my own tool set.

licence.txt

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                   Version 0, March 1765

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION, AND MODIFICATION:

1) If it bears an official stamp, prepare to throw it overboard.

Bangzi

Bitshares DEX - Over 1000 Coins, Buy, Sell, Transfer & List Any Coins |Free Signup Today: [url="https://wallet.bitshares.org/?r=bangzi"]https://wallet.bitshares.org/?r=bangzi[/url]

abit

Perhaps it's good tool for pybitshares. Can you make a PR in github? Or even create your own tool set.
BitShares committee member: abit
BitShares witness: in.abit

litepresence

#1
Update:  Developing here:
https://github.com/litepresence/extinction-event/blob/master/bitshares-node-latency.py







An "official" list of public nodes is here:

https://github.com/bitshares/bitshares-ui/blob/master/app/api/apiConfig.js

you can fetch it like this:
def nodes():  # Public Nodes List

    uri = 'https://raw.githubusercontent.com'
    url = uri+'/bitshares/bitshares-ui/master/app/api/apiConfig.js'
    raw = requests.get(url).text
    clean = ((raw.replace('"',"")).replace("'","")).replace(',','')
    parsed = [ t for t in clean.split() if t.startswith('wss') ]
    validated = [i for i in parsed if (('test' not in i) and ('fake' not in i))]

    return validated



result:

print (nodes())

>>>
['wss://bitshares.openledger.info/ws', 'wss://eu.openledger.info/ws', 'wss://bit.btsabc.org/ws', 'wss://bts.ai.la/ws', 'wss://bitshares.apasia.tech/ws', 'wss://japan.bitshares.apasia.tech/ws', 'wss://bitshares.dacplay.org/ws', 'wss://bitshares-api.wancloud.io/ws', 'wss://openledger.hk/ws', 'wss://bitshares.crypto.fans/ws', 'wss://ws.gdex.top', 'wss://dex.rnglab.org', 'wss://dexnode.net/ws', 'wss://kc-us-dex.xeldal.com/ws', 'wss://btsza.co.za:8091/ws', 'wss://api.bts.blckchnd.com', 'wss://eu.nodes.bitshares.ws', 'wss://us.nodes.bitshares.ws', 'wss://sg.nodes.bitshares.ws', 'wss://ws.winex.pro']




usage:

from bitshares.market import Market
from bitshares import BitShares

BitCURRENCY = 'OPEN.BTC'
BitASSET = 'BTS'
BitPAIR = BitASSET + ":" + BitCURRENCY
MARKET = Market(BitPAIR, bitshares_instance=BitShares(nodes()))

MARKET.buy()