View difference between Paste ID: nx52PQ7x and V6BGd94s
SHOW: | | - or go back to the newest paste.
1
import requests
2
3
r=requests.get("https://bittrex.com/api/v1.1/public/getmarkets")
4
data = r.json()
5
# print (len(data ["result"]))
6
for i in range (len (data["result"])):
7
    uri_end = (data["result"] [i] ["MarketName"])
8
    uri_beg = "https://bittrex.com/api/v1.1/public/getmarketsummary?market="
9
    uri = uri_beg + uri_end
10
   # print (uri)
11
    r2=requests.get(uri)
12
13
14
    data2 = r2.json()
15
16
    res = data2["result"]
17
  #  print (i)
18
19
    ask = data2 ["result"] [0] ["Ask"]
20
    bid = data2 ["result"] [0]  ["Bid"]
21
    vol = data2  ["result"] [0] ["BaseVolume"]
22
    rank = ((ask-bid)/bid)*vol
23
   # print(uri)
24
    print (uri_end,":", rank,":", vol)