121
General Discussion / (Python) latency sorted Bitshares nodes
« on: March 11, 2018, 05:53:11 pm »
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:
result:
usage:
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()