Bitcoin and other real-time prices, coincap API instructions, digital currency price acquisition, K-line access, real-time price access free

Time:2020-7-3

Coincap API instructions, digital currency price acquisition, K line acquisition, real-time price acquisition, free of charge

Coincap is a foreign API, providing price information of almost all digital currencies, K-line data, WS real-time price interface

Coincap API documentation address: https://docs.coincap.io/?vers…

Official website address of coincap: https://coincap.io

Data screenshot

K line data

Bitcoin and other real-time prices, coincap API instructions, digital currency price acquisition, K-line access, real-time price access free

Real time price data of websocket

Bitcoin and other real-time prices, coincap API instructions, digital currency price acquisition, K-line access, real-time price access free

According to these data, we can make our own products

Bitcoin and other real-time prices, coincap API instructions, digital currency price acquisition, K-line access, real-time price access free

Get k line data in time period

What you need to know before you start:

Currency abbreviation English name Currency ID
BTC Bitcoin bitcoin
ETH Ethereum ethereum
EOS EOS eos
USDT Tether tether
LTC Litecoin litecoin
USD Dollor united-states-dollar

https://api.coincap.io/v2/can…

When data is requested, the interface parameters are described as follows:

let queryData = {
    exchange:bitstamp , // exchange ID
    interval:m15 , // K line unit 15 minutes
    baseId:bitcoin , // currency to buy
    quoteId:united-states-dollar , // in what currency
    start:1565280000000 , // K line start timestamp
    end:1565336472965 , // K line end timestamp
}

The returned data is as follows:

{
    "data": [
        {
            "Open": "11672.790 million", // opening price: unit time
            "High": "11743.2700000000000", // highest price
            "Low": "11641.8600000000", // lowest price
            "Close": "11735.890000000000", // closing price: unit time
            "Volume": "180.0047796500000000", // transaction volume
            "Period": 156528 million // time point
        },
        {
            "open": "11720.0100000000000000",
            "high": "11764.6600000000000000",
            "low": "11720.0100000000000000",
            "close": "11764.2800000000000000",
            "volume": "43.2922002100000000",
            "period": 1565280900000
        },
        {
            "open": "11752.2200000000000000",
            "high": "11764.5400000000000000",
            "low": "11699.9200000000000000",
            "close": "11717.8400000000000000",
            "volume": "86.6521894000000000",
            "period": 1565281800000
        }
        
        //... n pieces of data are omitted here
    ],
    "timestamp": 1566886196502
}

Get the right exchange

When getting data, sometimes there may be no data, because the exchange you choose does not provide the data of the trading pair you set.

such asUSDT/USDThis combination, in thebitstampThe exchange does not

At this point, you need another interface to find out which transactions are available for the currency you want to exchange

USDT/USDYou need to find itunited-states-dollarExchange information for this currency:

https://api.coincap.io/v2/ass…

In the obtained data, find out whether the target currency exists and which exchanges are available.

Bitcoin and other real-time prices, coincap API instructions, digital currency price acquisition, K-line access, real-time price access free

So we can find out what bitrex providesUSDT/USDData for

You can write request data in this way when requesting K line data

USDTThe currency ID of istether
USDThe corresponding isunited-states-dollar

let requestData = {
    exchange:bittrex , // exchange ID
    interval:m15 , // K line unit 15 minutes
    baseId:tether , // currency to buy
    quoteId:united-states-dollar , // in what currency
    start:1565280000000 , // K line start timestamp
    end:1565336472965 , // K line end timestamp
}

Recommended Today

Comparison and analysis of Py = > redis and python operation redis syntax

preface R: For redis cli P: Redis for Python get ready pip install redis pool = redis.ConnectionPool(host=’39.107.86.223′, port=6379, db=1) redis = redis.Redis(connection_pool=pool) Redis. All commands I have omitted all the following commands. If there are conflicts with Python built-in functions, I will add redis Global command Dbsize (number of returned keys) R: dbsize P: print(redis.dbsize()) […]