Author Topic: (Python) latency sorted Bitshares nodes  (Read 2637 times)

0 Members and 1 Guest are viewing this topic.

Offline litepresence

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"

Code: [Select]
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
« Last Edit: March 17, 2018, 02:16:58 am by litepresence »

Offline litepresence

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

Code: [Select]
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.
« Last Edit: March 17, 2018, 12:07:50 am by litepresence »

Offline Bangzi

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • Steemit: Bangzi
  • BitShares: bangzi
Bitshares DEX - Over 1000 Coins, Buy, Sell, Transfer & List Any Coins |Free Signup Today: https://wallet.bitshares.org/?r=bangzi

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
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

Offline litepresence

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:
Code: [Select]
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:
Code: [Select]
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:
Code: [Select]
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()
« Last Edit: March 15, 2018, 06:40:32 pm by litepresence »