docs.bloxcross-dev.com Open in urlscan Pro
44.199.132.241  Public Scan

Submitted URL: http://docs.bloxcross-dev.com/
Effective URL: https://docs.bloxcross-dev.com/
Submission Tags: phish.gg anti.fish automated Search All
Submission: On September 09 via api from DE — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

Public


Documentation Settings

ENVIRONMENT
No Environment

LAYOUT
Double Column

LANGUAGE
cURL - cURL



BLOX-PAYMENTS API
Introduction
WEBSOCKETS
REST API
USER REGISTRATION
REFERENCE
VENDORS
CLIENTS
DEPOSIT
WITHDRAW
SEND
REQUEST
SWAP
REFERENTIAL DATA
MY CONFIGURATION
PORTFOLIO
DEVELOPMENT
WALLETS
POST
Test Headers


BLOX-PAYMENTS API

API to use Blox Payments API

Components to the integration to the Bloxcross API

   
 * REST API for Requests
   
 * Socket API for Streaming Data & Alerts
   

REST API

• For requests which require an immediate response
• Synchronous Execution
• Success or Failure response with Data

Socket API:

   
 * Used to subscribe to streaming Data
   
 * Events are pushed to the Client socket
   
 * Two base channels: market data & alerts
   

Client Journey

Clients can Register with only basic information:

   
 * Fname, lname, email, phone, pwd, domicile, language
   
 * Account is created but PENDING_VERIFICATION
   
 * Main Portfolio is created but in HOLD state
   



Client must pass the following checks to be enables to do
any monetary transactions – deposit/withdraw/buy/sell:

   
 * ID Verification
   
 * Verify Phone
   
 * Verify Email
   
 * Have their ID Verified, validated & do a liveness teat to make sure it is a
   human
   Pass KYC /AML
   




Rest API Considerations

   
 * Request Data in JSON Format
   
 * Reply Data in JSON Format
   
 * All data via HTTPS
   
 * GET requests to return Data
   
 * POST if any data needs to be sent to backend
   
 * A client can have multiple sessions open at the same time
   
 * If a client has more than one session open, then all sessions will receive
   notifications (socket)
   

Socket Interface

• Use the same token generated by login to connect
• Session are verified to be valid
• Sessions are verified for token expiration or blocked clients
• Session are subscription based
• Two separate Channels: Market-data & Alerts
• Market-Data is high volume low latency perishable data with no guaranteed
delivery
• Alerts channel is ordered (FIFO) guaranteed delivery to all active sessions
• Market Data channel data pushes based on subscription commands
• Alerts channel is single session created by default, but all sessions get the
data

URLS

   
 * Development URL is: https://api.bloxcross-dev.com
   
 * Websocket Alerts Endpoint: wss://api.bloxcross-dev.com/subscribe
   
 * Websocket market Data Endpoint: wss://api.bloxcross-dev.com/tickerplant
   


WEBSOCKETS


ALERTS

The alerts arrive via push over the Alerts websocket connection. All messages
have the same structure:

   
 * A header with information about the Message
   
 * The Data for the message
   

Here is a Alert example in Java:

View More
Plain Text


{
  "header": {
    "msg_type": "ORDER_NEW",
    "level": "ALERT",
    "notes": ""
  },
  "data": {
    "oid": "eb94cd38-ad12-417d-befe-2a62c3f2bfda",
    "reserve_id": 33370227094893060,
    "user_oid": "880062851073121",
    "client_id": "3619f00d-32d4-4983-92f8-ebfd3a68898b",
    "symbol": "ETH-USD",
    "side": "SELL",
    "amount": 1,
    "quantity": 0,
    "order_state": "NEW",
    "order_action": "NEW",
    "type": "MARKET_BY_AMOUNT",
    "price": 0,
    "time_in_force": null,
    "valid_until": null,
    "stop_type": null,
    "data": null,
    "created_on": "2023-07-21T20:14:16.046382948",
    "portfolio_id": "5e85cab3-2745-43cb-9358-1fd2e81acd8c",
    "executed_quantity": 0,
    "fee_rate": 100,
    "spread": 100,
    "fee": null,
    "held_qty": 0.0005,
    "reserve_currency": "ETH"
  }
}

The header contains two key pieces of data:

   
 * msg_type: the type of message
   
 * level: the importance of the message
   

msg_type can be one of:

View More
Plain Text


ORDER_NEW,
ORDER_CANCEL,
ORDER_REJECTED,
ORDER_UPDATE,
ORDER_ERROR,
EXECUTION,
TRACKING_EXECUTION,
DEPOSIT_INITIATED,
DEPOSIT,
DEPOSIT_REVERSED,
WITHDRAW_INITIATED,
WITHDRAW,
WITHDRAW_REVERSED,
INFO,
ROBBIE,
KYC,
AML,
DISPLAY_TO_USER

level can be one of:

Plain Text


INFO,
WARN,
ALERT

Here is an example in Java to connect to Alerts Websocket:

View More
Plain Text


import org.java_websocket.client.WebSocketClient;
import org.java_websocket.drafts.Draft;
import org.java_websocket.handshake.ServerHandshake;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import static java.lang.System.exit;
public class TestClient
        extends WebSocketClient {
    private static Logger log = LoggerFactory.getLogger(TestClient.class);
    private final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
    public TestClient(
            URI serverUri,
            Draft draft
    ) {
        super(
                serverUri,
                draft
        );
    }
    public TestClient(URI serverURI) {
        super(serverURI);
    }
    public TestClient(
            URI serverUri,
            Map httpHeaders
    ) {
        super(
                serverUri,
                httpHeaders
        );
    }
    public static void main(String[] args)
            throws
            URISyntaxException,
            IOException,
            NoSuchAlgorithmException,
            KeyManagementException,
            InterruptedException {
        String host = "api.bloxcross-dev.com";;
        log.info(">>> Connecting to: [wss://" + host + "/subscribe]");
        TestClient c = new TestClient(new URI(
                "wss://" + host + "/subscribe"));
        c.connect();
        c.setConnectionLostTimeout(30);
        Thread.sleep(5000);
        c.send("{\"token\": \"yJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJtepdlSdXN0NjhAZ21haWwuY29tIiwibGFzdF9sb2dpbiI6IntcInRpbWVcIjpcIjIwMjMtMDctMjFUMTM6MDc6NTQuMjY4MDI4XCIsXCJjaXR5XCI6XCJTYW4gTWFyY29zXCIsXCJyZWdpb25cIjpcIkNhbGlmb3JuaWFcIixcImNvdW50cnlcIjpcIlVuaXRlZCBTdGF0ZXNcIixcImxvY2FsZVwiOlwiQW1lcmljYS9Mb3NfQW5nZWxlc1wifSIsInJvbGVzIjpbXSwiaXNzIjoic2VjdXJpdHkiLCJzZXNzaW9uX2lkIjoiMDIyY2Q4ODUtYjA5MS00YWFhLWI4ZDgtMTkxZmE2NTM3ZjA4IiwiY2xpZW50X2lkIjoiMzYxOWYwMGQtMzJkNC00OTgzLTkyZjgtZWJmZDNhNjg4OThiIiwicmVxdWlyZWRfMmZhXzJwcm9jZWVkIjoiU01TIiwibmJmIjoxNjg5OTcwMDc0LCJkb21pY2lsZSI6IkNPIiwiY3VycmVuY3kiOiJNWE4iLCJhdXRoX2Nob2ljZSI6ImF1dGhfZGVjbGluZWQiLCJleHAiOjE2OTUxNTQwNzQsImxhbmciOiJwb3IiLCJpYXQiOjE2ODk5NzAwNzQsImVtYWlsIjoibXhfdGVzdDY4QGdtYWlsLmNvbSJ9.h4_7MLtNiiymQnANJf6RhReoFdj_HmZl3vW9gAc2SA\"}");
    }
    @Override
    public void onOpen(ServerHandshake handshakedata) {
        log.info("opened connection: " + handshakedata.getHttpStatusMessage());
    }
    @Override
    public void onMessage(String message) {
        log.info("received: " + message);
    }
    @Override
    public void onClose(
            int code,
            String reason,
            boolean remote
    ) {
        // The close codes are documented in class org.java_websocket.framing.CloseFrame
        log.info(
                "Connection closed by " + (remote ? "remote peer" : "us") + " Code: " + code + " Reason: "
                        + reason);
        exit(-1);
    }
    @Override
    public void onError(Exception ex) {
        ex.printStackTrace();
        // if the error is fatal then onClose will be called additionally
        System.err.println("Error: " + ex.getMessage());
    }
}


MARKET DATA

The Market Data Ticker Plant publishes real time market data via Websocket Push.
Once you connect to the Ticker Plant, you must send a subscription request for
subscribing tp market data as follows:

Plain Text


{
  "type": "subscribe",
  "channels": [
    {
      "name": "inside_market",
      "product_ids": [
        "BTC-USD"
      ]
    }
  ]
}

Here is an example for connecting to Market Data Websocket in Java:

View More
Plain Text


import org.java_websocket.client.WebSocketClient;
import org.java_websocket.drafts.Draft;
import org.java_websocket.handshake.ServerHandshake;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.ByteBuffer;
public class TestClient
        extends WebSocketClient {
    public TestClient(
            URI serverUri,
            Draft draft
    ) {
        super(
                serverUri,
                draft
        );
    }
    public TestClient(URI serverURI) {
        super(serverURI);
    }
    public static void main(String[] args)
            throws
            URISyntaxException,
            InterruptedException {
        System.out.println("...Starting Client");
        WebSocketClient client = new TestClient(new URI("wss://api.bloxcross-dev.com/tickerplant"));
        client.connect();
        client.setConnectionLostTimeout(30);
        Thread.sleep(5000);
        client.send(" {\"type\": \"subscribe\",\"channels\": [{\"name\": \"inside_market\",\"product_ids\": "
                            + "[\"BTC-USD\"]}]}");
    }
    @Override
    public void onOpen(ServerHandshake handshakedata) {
        System.out.println("new connection opened");
    }
    @Override
    public void onClose(
            int code,
            String reason,
            boolean remote
    ) {
        System.out.println("closed with exit code " + code + " additional info: " + reason);
    }
    @Override
    public void onMessage(String message) {
        System.out.println("received message: " + message);
    }
    @Override
    public void onMessage(ByteBuffer message) {
        System.out.println("received ByteBuffer");
    }
    @Override
    public void onError(Exception ex) {
        System.err.println("an error occurred:" + ex);
    }
}


REST API