prices.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:RaiWalletBot 作者: SergiySW 项目源码 文件源码
def mercatox():
    http = urllib3.PoolManager(cert_reqs='CERT_REQUIRED',ca_certs=certifi.where())
    url = 'https://mercatox.com/public/json24'
    #response = http.request('GET', url, headers=header, timeout=20.0)
    response = http.request('GET', url, timeout=20.0)
    json_mercatox = json.loads(response.data)
    json_array = json_mercatox['pairs']['XRB_BTC']
    try:
        last_price = int(float(json_array['last']) * (10 ** 8))
    except KeyError:
        last_price = 0
    high_price = int(float(json_array['high24hr']) * (10 ** 8))
    low_price = int(float(json_array['low24hr']) * (10 ** 8))
    ask_price = int(float(json_array['lowestAsk']) * (10 ** 8))
    bid_price = int(float(json_array['highestBid']) * (10 ** 8))
    volume = int(float(json_array['baseVolume']))
    btc_volume = int(float(json_array['quoteVolume']) * (10 ** 8))

    mysql_set_price(1, last_price, high_price, low_price, ask_price, bid_price, volume, btc_volume)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号