Use Python to get price data from the Poly currency API

Source: Internet
Author: User

The official website API does not show examples, quite nonsense

#-*-coding=utf-8-*-' function: Get all kinds of information from poly currency 1, bitcoin (BTC) 2, Ether Square (ETH) 6, other ' import requests ' function: Real_time_ticker function: Get a currency Real-time Price return value content: high-highest price low-lowest price buy-one price sell-sell a price last-most recent transaction Price Vol.-Turnover volume-turnover ' Def real_time_ticker (coin)
    : url = ' https://www.jubi.com/api/v1/ticker/' try:data = requests.post (url,data = {' Coin ': coin}). JSON ()  Except:print ("No way to get to the currency price ticker") return data ' function name; real_time_depth feature: Get Purchase and sale order price and quantity of a certain currency returned value content: asks-pay [price,
    Committee order Quantity], the price from high to low sort bids-sell single [price, committee order quantity], price from high to low sort ' def real_time_depth (coin): url = ' https://www.jubi.com/api/v1/depth/'  data = Requests.post (Url,data = {' Coin ': coin}). JSON () Data_bids = data[' bids '] data_asks = data[' asks '] for
        I in Data_bids:print (I[0]) print ("") print (I[1]) to J in Data_asks:print (J[0))  Print ("") print (j[1]) ' function name: Real_time_order function: Returns the last 100 transactions, in reverse order return content: Date-Timestamp price-transaction prices Amount- Number of transactions tid-transaction ID Type-Transaction type ' Def real_time_order (coin): url = ' https://www.jubi.com/api/v1/orders/' try:request = requests.ge T (url,params = {' Coin ': coin}) Except:print ("Failed to get order") data = Request.json () return data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.