elog | API Documentation
Standard API using REST and JSON

Overview

This API is essentially a suite of methods that can be called over HTTP.
  • The URL is:  https://api.elog.com/MethodNameHere
  • The HTTP header contains the necessary authentication.
  • The HTTP method is POST and the body contains JSON.
  • The HTTP result contains JSON.
  • The HTTP status code is always 200.

Methods

Setup
**Description**  
Set up your trading.  
  
**URL**  
https://api.elog.com/Setup  
  
**Argument**  
exchange:     id of the cryptocurrency trading exchange, as one of:  
              "binance.us", "coinbase", ... (more coming soon)  
keys:         2-element array of exchange authentication keys  
risk:         level of risk to apply to your portfolio each time trading  
              occurs. This is on the domain [0,1].  
              Default: 0.5  
tickers:      array of tickers to trade  
              Default: all that are offered on the exchange.  
cash-ticker:  ticker to use as your cash to buy from and to sell back into,  
              i.e. "USD", "USDT", "USDC", "BUSD". Default: "USD"  
cash-target:  minimum amount of cash to keep in the portfolio, specified as  
              a dollar amount or as a fraction of the portfolio, e.g. 0.05.  
              Default: 0  
trading-auto: boolean for whether to perform auto-trading. Default: 1  
trading-interval:  how often to trade, in days. Default: 1  
trading-time:      time of day to trade, as one of: 'before' 'during' 'after',  
                   relative to 9:30AM - 4:00PM (ET). Default: 'during'  
drift-threshold:   at trading time, if the drift is at least this percentage,  
                   trading will be performed. Default: 1  
market-protection: email address to be alerted at if you want  
                   "market protection".  
                   If empty, market protection is not activated.  
  
**Result**  
authenticated:  
 boolean as to whether you are completely authenticated and your trading  
 exchange keys are valid/working  
  
**Example**  
*REQUEST:*  
{  
  (coming soon)  
}  
  
*RESPONSE:*  
{  
  "success": true,  
  "result":  
  {  
    "authenticated": true  
  }  
}  
CreateAlgorithm
**Description**  
Create your own custom algorithm to fit into the elog trading infrastructure.  
  
**URL**  
https://api.elog.com/CreateAlgorithm  
  
**Argument**  
(coming soon)  
  
**Result**  
(coming soon)  
  
**Example**  
*REQUEST:*  
{  
  (coming soon)  
}  
  
*RESPONSE:*  
{  
  "success": true,  
  "result":  
  {  
    "quality-estimation": 0.9  
  }  
}  

Asynchronous Calls

Any method above can be called with "asynchronous_mode" set to true to mean that the result should contain a unique token that looks something like this:   {"asynchronous_token": "aZ..."}

The result above can then later be passed as the argument to method Asynchronous.GetResultForToken to get the final/real result. If the result is not ready yet, an appropriate error result is returned.

Also, when "asynchronous_mode" is set to true, the property "asynchronous_callback" can be set to a URL to callback when the result is ready (so that you don't have to perform any polling). The call to the URL is an HTTP POST and the body is just the same JSON that is returned in the initial call (the JSON shown above that includes the token).

Authentication

"Basic Access Authentication" is used for all API calls. You will be issued a user name and a password, which should be used when forming the required HTTP header.
So, for example, if your user name is "UserA" and your password is "ZbJ058gm", the appropriate HTTP header for authorization is the following:
  Authorization: Basic VXNlckE6WmJKMDU4Z20=

Error Handling

When some type of error occurs with your call, an error result is returned.
In each call that you make, the first thing you should do is check the success bit and behave accordingly.
HTTP status codes are not mixed in at all with the API itself.
You will generally just receive a status code of 200. It is always possible that the communication over HTTP could fail or some very unexpected result could occur, but all of that is outside the scope of the API.
A successful result looks something like this:
{
   "success": true,
   "result": {...}
}
An error result has the same structure and looks something like this:
{
   "success": false,
   "result":
   {
      "code": "property.missing",
      "message": "A required property is missing.",
      "detail": "dataset"
   }
}