Crypto-ML offers API access as part of the Crypto-ML Pro Solutions.

API Overview

Crypto-ML provides a WebSocket API. Once connected, you will receive output from our machine learning models.

The WebSocket connection is designed to stay open until your client terminates the connection. That means a ping or “keep-alive” mechanism is not required from the client in order to keep the connection up.

Using this method, each end client receives notifications immediately.

Crypto-ML API WebSocket Diagram - Multi-Connection

Account Provisioning

After registering for an API account, your organization will receive an API Key. This key will allow for a defined number of concurrent sessions.

API Details

Following are technical details for using the API.

API Access URL

 wss://<a href="http://api.crypto-ml.com/?apiKey=YOUR_API_KEY" target="_blank" rel="noreferrer noopener">api.crypto-ml.com?apiKey=YOUR_API_KEY</a>

Sample Payloads

Market Index

Every 24 hours, the client receives updated Market Index data, including the current value and the 7-day trend.

Market Index samples:

{"bullBear":"BULL 13.56","_7dayTrend":"Bull market weakening."}
{"bullBear":"BULL 19.62","_7dayTrend":"Bull market strengthening."}
{"bullBear":"BEAR -0.55","_7dayTrend":"Bear market strengthening."}
{"bullBear":"BEAR -6.07","_7dayTrend":"Bear market weakening."}

Trade Alerts

As real-time trade alerts are issued, the data will be instantly streamed.

With the Release 7 and onward, there may be multiple systems generating buy and sell signals. These systems may interpret the predictions in different manners.

These systems are identified by the bot field that is presented alongside any trade. All bots leverage the same machine learning foundation and underlying trading system.

The different bots are:

  • ML: This is the traditional trigger system as generated by Crypto-ML.
  • Manipulation: This is an additional trigger system that seeks to identify unusual variations in the market.
  • Matic: This trigger system leverages specific technical data to generate extremely high-probability trades.

Learn more about our Trade Strategies.

ML trade samples:

{"side":"sell", "productCode":"BTC-USD", "price":"9543.01", "time":"2020-02-24T18:38:01.6484377Z", "bot":"ML"}
{"side":"sell", "productCode":"ETH-USD", "price":"267.32", "time":"2020-02-24T09:23:25.7622456Z", "bot":"ML"}
{"side":"buy", "productCode":"BTC-USD", "price":"9891.77","time":"2020-02-23T05:37:39.2429824Z", "trailingStop": "-0.0391574244145524", "buyTrigger":"1.93027140343837", "tslAdjust":"-0.008", "nnValue":"2.28368686168124", "bot":"ML"}
{"side":"buy", "productCode":"ETH-USD", "price":"264.56", "time":"2020-02-22T01:22:42.2901814Z", "trailingStop":"-0.0397119140625", "buyTrigger":"3.07325747536978", "tslAdjust":"-0.00591409301757813", "nnValue":"5.20176589036058", "bot":"ML"}

Details as follows:

  • side: denotes the “open long” or “close long” trigger event as buy or sell
  • productCode: denotes the product pair the trigger is for as BTC-USD, ETH-USD, or BCH-USD.
  • price: the USD value at which the trigger was generated.
  • time: the time in UTC (Zulu) at which the trigger was generated.
  • trailingStop: the initial value of the Trailing Stop as set by Crypto-ML optimizers. If the value is -0.0397, then the Trailing Stop is 3.97% lower than the price. On the Crypto-ML backend, the Trailing Stop follows price up but never goes down.
  • buyTrigger: in order to trigger a buy signal, the Neural Network prediction must be higher than the buyTrigger. The buyTrigger is set by Crypto-ML optimizers. Additionally, once a position’s profit crosses the buyTrigger level, the trailingStop tightens (see tslAdjust) on the Crypto-ML backend.
  • tslAdjust: as open trades move into a sufficiently profitable position, the Trailing Stop will tighten in order to better protect profit. On the Crypto-ML backend, once the trade’s profit is greater than buyTrigger (expressed as a percentage), the trailingStop will be reduced by the value of the tslAdjust as set by the Crypto-ML optimizers.
  • nnValue: the price prediction from the Crypto-ML Neural Network at the time the trigger was generated. On the Crypto-ML backend, this value is the profit target. If the position’s profit hits this value, the trade will be closed.
  • bot: denotes the ML bot issued the trigger.

Manipulation trade samples:

{"side":"sell", "productCode":"BTC-USD", "price":"9543.01", "time":"2020-02-24T18:38:01.6484377Z", "bot":"Manipulation"}
{"side":"sell", "productCode":"ETH-USD", "price":"267.32", "time":"2020-02-24T09:23:25.7622456Z", "bot":"Manipulation"}
{"side":"buy", "productCode":"BTC-USD", "price":"9891.77","time":"2020-02-23T05:37:39.2429824Z", "bot":"Manipulation"}
{"side":"buy", "productCode":"ETH-USD", "price":"264.56", "time":"2020-02-22T01:22:42.2901814Z", "bot":"Manipulation"}
  • side: denotes the “open long” or “close long” trigger event as buy or sell
  • productCode: denotes the product pair the trigger is for as BTC-USDETH-USD, or BCH-USD.
  • price: the USD value at which the trigger was generated.
  • time: the time in UTC (Zulu) at which the trigger was generated.
  • bot: denotes the Manipulation bot issued the trigger.

*Note: The Manipulation bot does not currently publish stop and target figures as these mechanisms are all handled internally.

Price Prediction

At established intervals (hourly), the client receives the latest price prediction notification. This predicts price change 24 hours from now.

{"crypto":"BTC", "prediction_6hr":"-5.125331544688167", "prediction_12hr":"-6.503530925894259", "manip_value":"1"}
{"crypto":"ETH", "prediction_6hr":"-3.459357198412614", "prediction_12hr":"-4.6226615096171875", "manip_value":"-1"}
{"crypto":"USD-BTC", "prediction_6hr":"-1.7687265604505078", "prediction_12hr":"-3.964182570826924", "manip_value":"-1"}
{"crypto":"USD-ETH", "prediction_6hr":"0.10868181010881219", "prediction_12hr":"-2.6982040678439647", "manip_value":"1"}
  • prediction_6hr: the predicted percentage price change 6 hours into the future.
  • prediction_12hr: the predicted percentage price change 12 hours into the future.
  • manip_value: identifies anomalies in price behavior. For example, the market may be expected to drop but is instead going up. Bullish anomalies are flagged as 1 (buy signal). Bearish anomalies are flagged as -1 (sell signal). Learn more about manipulation anomalies.

JavaScript Client Sample

The following code creates a simple JavaScript client that opens the WebSocket connection and receives updates from Crypto-ML’s Streaming API.

Similar clients can be written in other languages.

It is recommended to write your WebSocket client so that if it disconnects for any reason, re-connection logic will initiate. The retry logic should keep running until the connection is reestablished.

socket = new WebSocket("wss://<a href="http://api.crypto-ml.com/?apiKey=YOUR_API_KEY" target="_blank" rel="noreferrer noopener">api.crypto-ml.com?apiKey=YOUR_API_KEY</a>");
socket.onopen = function(e) {
  console.log("Connection established");  
};
socket.onmessage = function(event) {
  console.log("Data received from server:"+ event.data);
};
socket.onclose = function(event) {
  if (event.wasClean) {
    console.log("Connection closed cleanly, code="+event.code+",reason="+event.reason);
  } else {  
    console.log("Connection died");
  }
};
socket.onerror = function(error) {
  console.log("error:"+ error.message);
};

Ready to Get Started?

Learn more and sign up now at Crypto-ML Pro Solutions.