Skip to content

Latest commit

 

History

History
647 lines (528 loc) · 17.4 KB

notifications.adoc

File metadata and controls

647 lines (528 loc) · 17.4 KB

Notifications

Following notifications can be sent

  • ticker : notification containing ticker data for a single pair, on a given exchange

  • orderBook : notification containing full order book for a single pair, on a given exchange

  • orderBookUpdate : notification containing order book update for a single pair, on a given exchange

  • trades : notification containing last trades for a single pair, on a given exchange

  • kline : notification containing klines data for a single pair, on a given exchange

  • tickerMonitor : notification when some conditions regarding ticker fields are met

ticker notifications

Name Type Description

n

string

Notification type (will always be ticker)

d

object

Notification data

        pair

string

Pair name X-Y

        exchange

string

Exchange identifier

        data

object

Ticker data

                pair

string

Pair name X-Y

                last

float

Last trade’s price

                priceChangePercent

float

% Change of price in last 24H (0-100) (will be null if not supported by exchange)

                sell

float

Lowest sell price

                buy

float

Highest buy price

                high

float

Highest price (last 24H)

                low

float

Lowest price (last 24H)

                volume

float

Volume (last 24H)

                timestamp

float (unix timestamp sec.msec)

Unix timestamp

Examples
{
    "n":"ticker",
    "d":{
        "exchange":"bittrex",
        "pair":"USDT-BTC",
        "data":{
            "pair":"USDT-BTC",
            "last":7155,
            "priceChangePercent":-5.206677139913463,
            "sell":7155,
            "buy":7150,
            "high":7576,
            "low":7100.01,
            "volume":5357.92210528,
            "timestamp":1509986841.91
        }
    }
}

orderBook notification

Name Type Description

n

string

Notification type (will always be orderBook)

d

object

Notification data

        exchange

string

Exchange identifier

        pair

string

Pair name X-Y

        cseq

integer

Nounce / cseq (will be incremented for each event)

        data

object

Order book data

                buy

object[]

List of bid entries in the order book

                        rate

float

Buy rate

                        quantity

float

Quantity requested

                sell

object[]

List of ask entries in the order book

                        rate

float

Sell rate

                        quantity

float

Quantity offered

Examples
{
    "n":"orderBook",
    "d":{
        "exchange":"bittrex",
        "pair":"USDT-BTC",
        "cseq":54694,
        "data":{
            "buy":[
                {
                    "rate":7158,
                    "quantity":0.18125832
                },
                {
                    "rate":7147.84000102,
                    "quantity":0.33576833
                },
                {
                    "rate":7147.84000003,
                    "quantity":0.00037697
                }
            ],
            "sell":[
                {
                    "rate":7159.61768333,
                    "quantity":0.75758168
                },
                {
                    "rate":7159.62768333,
                    "quantity":0.00350054
                },
                {
                    "rate":7162.99999999,
                    "quantity":0.1648124
                },
                {
                    "rate":7167.99999999,
                    "quantity":0.59600039
                },
                {
                    "rate":7169.99999999,
                    "quantity":0.5333059
                }
            ]
        }
    }
}

orderBookUpdate notification

Name Type Description

n

string

Notification type (will always be orderBookUpdate)

d

object

Notification data

        exchange

string

Exchange identifier

        pair

string

Pair name X-Y

        cseq

integer

Nounce / cseq (will be incremented for each event)

        data

object

Order book data

                buy

object[]

List of bid entries in the order book

                        action

string (update,remove)

  • If value is update, it means that quantity for this rate should be updated

  • If value is remove, it means that there are no more order book entries for this rate

                        rate

float

Buy rate

                        quantity

float

Quantity requested

                sell

object[]

List of ask entries in the order book

                        action

string (update,remove)

  • If value is update, it means that quantity for this rate should be updated

  • If value is remove, it means that there are no more order book entries for this rate

                        rate

float

Sell rate

                        quantity

float

Quantity offered

Examples
{
    "n":"orderBookUpdate",
    "d":{
        "pair":"USDT-BTC",
        "cseq":85719,
        "data":{
            "buy":[
                {
                    "action":"update",
                    "rate":7131,
                    "quantity":0.72188827
                }
            ],
            "sell":[
                {
                    "action":"remove",
                    "rate":7221.71517258,
                    "quantity":0
                },
                {
                    "action":"update",
                    "rate":7226.99999999,
                    "quantity":0.61909178
                },
                {
                    "action":"update",
                    "rate":7265.72525,
                    "quantity":0.00709438
                }
            ]
        }
    }
}

trades notification

Name Type Description

n

string

Notification type (will always be trades)

d

object

Notification data

        exchange

string

Exchange identifier

        pair

string

Pair name X-Y

        data

object[]

Trades data

                id

integer

string

Unique identifier of the trade. Some exchanges do not always provide this property for so you should consider it as being optional

                quantity

float

Quantity bougth/sold during the trade

                rate

float

Per-unit price

                price

float

Total price (quantity * rate)

                orderType

string (buy,sell)

Whether market maker was buyer or seller

                timestamp

float (unix timestamp sec.msec)

Examples
{
    "n":"trades",
    "d":{
        "exchange":"bittrex",
        "pair":"USDT-BTC",
        "data":[
            {
                "id":23090089,
                "quantity":0.0288771,
                "rate":7149.99999999,
                "price":206.47126499,
                "orderType":"buy",
                "timestamp":1509986924.897
            },
            {
                "id":23090087,
                "quantity":0.00460101,
                "rate":7149.99999999,
                "price":32.89722149,
                "orderType":"buy",
                "timestamp":1509986924.553
            }
        ]
    }
}

kline notifications

Name Type Description

n

string

Notification type (will always be kline)

d

object

Notification data

        pair

string

Pair name X-Y

        exchange

string

Exchange identifier

        interval

string

Kline interval (ex: 5m)

        data

object

Kline data

                open

float

Open price

                close

float

Close price

                high

float

Highest price (last 24H)

                low

float

Lowest price (last 24H)

                volume

float

Volume

                timestamp

integer (unix timestamp sec)

Unix timestamp

                remainingTime

integer

Indicates how many seconds are remaining before the end of the kline interval

                closed

boolean

Indicates whether or not kline can be considered as closed

Note

remainingTimestamp is just an indication and volume can change even after remainingTimestamp has reached 0. This is because some exchanges will only update kline K1 once the first trade for kline K2 has occurred. closed will be true only once the kline has been finalized.

Examples
{
    "n":"ticker",
    "d":{
        "exchange":"binance",
        "pair":"USDT-ETH",
        "interval":"5m",
        "data":{
            "timestamp":1515410100,
            "remainingTime":0,
            "closed":true,
            "open":1135.5,
            "close":1131.76,
            "high":1136.3,
            "low":1130.13,
            "volume":74.30783
        }
    }
}

tickerMonitor notifications

Name Type Description

n

string

Notification type (will always be tickerMonitor)

d

object

Notification data

        id

integer

Unique indentifier of the Ticker Monitor entry

        name

string

Name of the entry

        any

boolean

If true, entry will become active as soon as one condition is active. Otherwise, entry will become active only if all conditions are active

        status

object

Entry status

                value

string

One of (active,inactive)

                timestamp

float (unix timestamp sec.msec)

Unix timestamp when entry became active or inactive

        conditions

object[]

List of conditions

                origin

object

                        type

string

One of (exchange,service)

                        id

string

Identifier of the exchange (ex: binance) or the service (ex: marketCap)

                condition

object

                        field

string

The field we want to compare value (ex: last for exchanges ticker)

                        operator

string

The operator used to compare (ex: lte)

                        value

float

The target value

                        pair

string

The ticker pair (ex: USDT-NEO). Only defined when type is exchange

                        symbol

string

MarketCap symbol (ex: NEO). Only defined when type is service and id is marketCap

                value

float

Last value for the field field retrieved from exchange or service

Examples

Below event will be emitted if all following conditions are met :

  • buy price for USDT-NEO pair is > 134 on Binance exchange

  • USD price of NEO in MarketCap module is in range [130,140]

{
    "n":"tickerMonitor",
    "d":{
        "id":1,
        "name":"Alert1",
        "any":false,
        "status":{
            "value":"active",
            "timestamp":1518907143.763
        },
        "conditions":[
            {
                "status":{
                    "value":"active",
                    "timestamp":1518907138.742
                },
                "origin":{
                    "type":"exchange",
                    "id":"binance"
                },
                "value":134.764,
                "condition":{
                    "field":"buy",
                    "operator":"gt",
                    "value":134,
                    "pair":"USDT-NEO"
                }
            },
            {
                "status":{
                    "value":"active",
                    "timestamp":1518907138.742
                },
                "origin":{
                    "type":"service",
                    "id":"marketCap"
                },
                "value":135.968,
                "condition":{
                    "field":"price_usd",
                    "operator":"in",
                    "value":[
                        130,
                        140
                    ],
                    "symbol":"NEO"
                }
            }
        ]
    }
}