Logger Explained - LabMazurokCom/Blockchain GitHub Wiki

Introduction

Our logger monitors and saves data about current arbitrage opportunities on several exchanges.

Use GET request 'https://logger-mongo.azurewebsites.net/get_pairs' to get alphabetically sorted list of currently monitored pairs. Here's an example of response to this request:

["bch_btc", "bch_usd", "dash_btc", "eth_btc", "btc_usd", "xrp_btc", "dash_usd", "eth_usd", "xrp_usd"]

Our API supports two GET requests:

  1. with two parameters:
  • pair
  • top (how many latest orders to return)

pair is a mandatory parameter and it must be equal to one of the pairs mentioned above.

top is optional parameter and it must be an integer between 0 (excluding) and 100 (including). If this parameter is omitted then one latest entry will be returned. If top is greater than the total number of entries in the database then all entries will be returned.

The base url is https://logger-mongo.azurewebsites.net/

Request returns an array of top last entries in order of decreasing timestamps (so the first element of this array is the latest entry).

Request examples

Wrong request Response Status
https://logger-mongo.azurewebsites.net/?pair=btc_usd One last entry will be returned 200
https://logger-mongo.azurewebsites.net/?pair=btc_usd&top=1 One last entry will be returned 200
https://logger-mongo.azurewebsites.net/?pair=btc_usd&top=10 Ten last entries will be returned 200
https://logger-mongo.azurewebsites.net/ {"error": "Mandatory parameter 'pair' is absent"} 400
https://logger-mongo.azurewebsites.net/?pair=btc_usd&top=1o {"error": "Parameter 'top' must be non-negative integer"} 400
https://logger-mongo.azurewebsites.net/?pair=btc_usd&top=0 {"error": "Parameter 'top' must satisfy inequality 0 < 'top' <= 100"} 400
https://logger-mongo.azurewebsites.net/?pair=btc_usd&top=120 {"error": "Parameter 'top' must satisfy inequality 0 < 'top' <= 100"} 400
https://logger-mongo.azurewebsites.net/?pair=btc_u {"error": "Not supported currency pair"} 400

If the request is correct but the server wasn't able to fetch data from database then response

{"error": "Some problems with database occurred"}

with status 500 will be sent.

Example of response to correct request

[{
    "amount": 55670.26150390919,
    "amount_points": [123.2925, 174.0607, 1501.561, 7687.776674844, 8742.039388119, 8749.299288118998, 8756.559188118998, 8761.460999999998, 8763.819120599997, 8771.079120599998, 9148.599120599998, 14717.019120599998, 14724.279120599998, 15399.192896399998, 15626.703654599998, 15652.663672199998, 16608.079599599998, 17621.575526999997, 17669.175136199996, 18795.200990999994, 19905.980990999993, 20909.31291839999, 20916.57291839999, 26361.57291839999, 26491.15760219999, 27292.84201319999, 28193.45917019999, 30309.74895239999, 30317.00895239999, 31368.982807199987, 32461.61266199999, 32519.09124359999, 37801.460999999996, 37903.115, 45164.615, 48472.64813198699, 48835.743131986994, 52426.515, 52448.3025, 52491.8805, 52579.0533, 52789.23453843039, 53045.0612652032, 55622.53074766419, 55670.26150390919],
    "optimal_point": {
        "amount": 52426.515,
        "profit": 193.27129174958074
    },
    "profit": 195.11199908812418,
    "profit_points": [1.1475000000000002, 1.6192999999999977, 13.678999999999931, 64.89066435600024, 72.83404793100036, 72.88826309037036, 72.94124317435036, 72.97618102751787, 72.99295591050037, 73.04336646934037, 75.60572413838038, 113.32379977206006, 113.37297588107006, 117.63355090662913, 118.82469194232914, 118.96057082232915, 123.8166104533291, 128.60489011032914, 128.81989423573253, 133.56595362373258, 137.76445058965265, 141.17799034265263, 141.20128197193264, 156.75675822943265, 157.11374082943266, 159.10138812943265, 161.14824530443266, 165.89969481543272, 165.91478081543272, 168.03032052343278, 169.71592029943275, 169.79746704743275, 177.07345844743276, 177.19945844743276, 185.69945844743276, 189.3892735604329, 189.79427356043294, 193.27129174958074, 193.29058729058073, 193.32617837258073, 193.38056053658073, 193.50936462383305, 193.6660763133331, 195.0958553900333, 195.11199908812418],
    "ticker": [{
        "ask": 0,
        "bid": 0,
        "exchange": "bitfinex"
    }, {
        "ask": "7271.60",
        "bid": "7270.00",
        "exchange": "bitstamp"
    }, {
        "ask": 0,
        "bid": 0,
        "exchange": "cex"
    }, {
        "ask": "7333.99999988",
        "bid": "7320",
        "exchange": "exmo"
    }, {
        "ask": "7264.48",
        "bid": "7264.47",
        "exchange": "gdax"
    }, {
        "ask": "7252.50000",
        "bid": "7250.10000",
        "exchange": "kraken"
    }],
    "orders": {
        "bids": {
            "exmo": [7268.931847, 4.999868130000001],
            "bitstamp": [7270.0, 2.19713187]
        },
        "asks": {
            "kraken": [7261.9, 7.197000000000002]
        }
    },
    "trade_cnt": 45,
    "timestamp": 1527514873375
}]

Response Fields

Field Description
amount sum of all ask orders for current arbitrage opportunities
amount_points are generated during arbitrage estimation, used for plotting
optimal point "smart" estimation of profit to volume estimation
orders which orders should be put on which exchanges
profit maximum profit which can be obtained with current arbitrage opportunities
profit_points are generated during arbitrage estimation, used for plotting
ticker best prices on each exchange
timestamp time in milliseconds when data was fetched
trade_cnt number of matching pairs in united order book, needn't be equal to length of "orders" array