Skip to content

Latest commit

 

History

History
186 lines (164 loc) · 4.25 KB

kline-websocket.md

File metadata and controls

186 lines (164 loc) · 4.25 KB

K-Line

These are open data for public. It doesn't need an API key to call these methods. You can simple subscribe web socket request.

Table of Contents

General Web Socket Information

Connect web socket to URL below

wss://kline.indodax.com/ws/

Symbols

For $symbol you can use pair->id. To see available pairs, please see /api/pairs

Intervals

Periods
1m 1 Minutes
5m 5 Minutes
15m 15 Minutes
30m 30 Minutes
1h 1 Hours
1d 1 Days

Kline

You can get K-line data started at 00:00 AM with the following format {"req":"$symbol.kline.$interval", "id":"Generated By Client"}. Change $symbol with pair id and $interval with periods. i.e below

Subscribe

#Request
{"sub":"btcidr.kline.1m", "id":"1"}

#Response
{
    "ch":"btcidr.1m",
    "ts":1570086780,
    "tick": {
        "pair":"btcidr",
        "type":"1m",
        "c":145300000,
        "h":145300000,
        "l":143900000,
        "o":145300000,
        "t":1566468720,
        "v":421514329
    }
}

Unsubscribe

#Request
{"unsub":"btcidr.kline.1m", "id":"1"}

#Response
{
    "id":"1",
    "status":"ok",
    "ts":1570088533,
    "unsubbed":"btcidr.kline.1m"
}

Request

#Request
{"req":"btcidr.kline.1m", "id":"2"}
#it will automaticly get data started at 00:00 AM today

{"req":"btcidr.kline.1m", "from":1569607200, "to":1569842641, "id":"2"}
#it will get data started from 1569607200 to 1569842641 in unixtime

#Response
{
    "rep":"btcidr.kline.1m",
    "status":"ok",
    "tick":[
        {
            "c":145012000,
            "h":145012000,
            "l":145012000,
            "o":145012000,
            "pair":"btcidr",
            "t":1566406800,
            "type":"1m",
            "v":401148449
        },
        {
            "c":145012000,
            "h":145012000,
            "l":145012000,
            "o":145012000,
            "pair":"btcidr",
            "t":1566406860,
            "type":"1m",
            "v":401148449
        }
    ]
}

Trade Detail

You can get trade detail data started at 00:00 AM with the following format {"req":"$symbol.trade"}. Change $symbol with pair id. i.e below

Subscribe

#Request
{"sub":"btcidr.trade", "id":"3"}
 
#Response
{
    "ch":"btcidr.trade",
    "ts":1570088960,
    "data":{
        "amount":32236,
        "direction":1, //buy
        "price":118876000,
        "trade_time":1570088960
    }
}

Unsubscribe

#Request
{"unsub":"btcidr.trade", "id":"3"}
 
#Response
{
    "id":"id3",
    "status":"ok",
    "ts":1570091275,
    "unsubbed":"btcidr.trade"
}

Request

#Request
{"req":"btcidr.trade"}
#it will automaticly get data started at 00:00 AM today

{"req":"btcidr.trade", "from":1569607200, "to":1569842641}
#it will get data started from 1569607200 to 1569842641 in unixtime

#Response
{
    "rep":"btcidr.trade",
    "status":"ok",
    "trade":[
        {
            "amount":900000,
            "direction":2, #Sell
            "price":118079000,
            "trade_time":1570035698
        },
        {
            "amount":1164359,
            "direction":1, #Buy
            "price":118080000,
            "trade_time":1570035965
        }
    ]
}

Notes

For testing you can use these library