Getting Started

Overview

BlinkTrade provides a simple and robust WebSocket API to integrate our platform,
we strongly recommend you to use it over the REST API.

BlinkTrade SDK

We provide a simple WebSocket and REST JavaScript SDK that enables you runs in either Node.js or in a browser.
You can easily send and cancel orders, request deposits and withdrawals, and get real time market data through our WebSocket API.

All SDK supports either promises and callbacks.
If a callback is provided as the last argument, it will be called as callback(error, result),
otherwise it will just return the original promise. We also provide event emitters that you can
use to get realtime updates through our WebSocket API.

We aimed to design a concise API by returning a JSON format that can be slightly different from the original WebSocket response.
These returns aims to increase readability and avoid complexity of the JSON, some returns such arrays of arrays and a `Columns`
field that describes each array position, are already formatted for you.

BlinkTrade Endpoints

NOTE

We impose cross origin policy (cors), even though our SDK can work on the browser,
it won’t work due our origin policy, so and we recommend you use on server side instead.
Only the public rest is available on the browser, and other environments only works on testnet
and you won’t be able use to use production environment on the browser, this might change in the future.

There are two working environments: prod for production purporses and testnet for testing purporses.

Some features are accessed publicly and others require an API Key based authentication.
All data messages and responses are in JSON format.

Trade API

On our RESTful API, we provide a trade endpoint that you’re allowed to send and cancel orders,
request deposits and withdrawals. You need to create an API Key through our platform and set their respective permission that gives you access to it.

The Trade endpoint is internaly a bridge to our WebSocket API, so you can access it both on REST and WebSocket API.
On REST it can be accessed under /tapi/v1/message, e.g, production is https://api.blinktrade.com/tapi/v1/message,
and API Key is needed in order to authenticate your access.

NOTE

Be aware that our Restful trade endpoint can be changed at any time,
we strongly recommend using the WebSocket API over the Restful API.

NOTE
that when generate the API Key and the API Secret, it will be only shown once, you should save it securely,
the API Password is only used in the WebSocket API

An HTTP POST request method should be used to send a RESTful HTTP message.

Send Order

Converting Floats to Integers can be dangerous. Different programming languages can get weird rounding errors and imprecisions,
so all API returns prices and bitcoin values as Integers and in “satoshis” format. We also expect Integers as input,
make sure that you’re formatting the values properly to avoid precision issues.

Rejected orders with reason ‘3’ (Order exceeds limit), means that you don’t have enough balance or may have open orders,
orders with amount below 0.0001 BTC exceeds limits as well, therefore, will also be rejected.

Response

Returns an array of Withdrawals Model Objects.

Request Withdrawal

To request withdrawals, you need to pass a “data” information, which represents the information to your withdrawal. It’s related to bank accounts, numbers, or a bitcoin address, this information is dynamically and is different for each broker.

Paramenters

bitcoin for BTC. Check with the exchange all available withdrawal methods

Amount

number

Amount in satoshis

Currency

string

Currency code

Data

object

Data object containing the withdraws required fields

Events

Event

Description

WITHDRAW_REFRESH

Callback when withdraw refresh

Confirm Withdraws

After request a withdraw, you might get a error asking for two factor authentication,
you should call confirmWithdraw passing the confirmationToken that was sent to your email,
or secondFactor if needed.

Response

Authentication

Most of WebSocket calls requires authentication, once you login with your username and password on the WebSocket connection,
you will be able to access your account. You can also login with your API Key and API Password and you’ll only be
allowed to send messages that your API Key has permission to send.

FingerPrint

If you’re not using the JavaScript SDK, You will need to pass a fingerprint from your browser,
there’s some finger prints implementations that you can use.

That these events will only be called to the current deposit / withdraw created,
if you want to listen to any deposit / withdraw updates, you should use onDepositRefresh(callback)
and onWithdrawRefresh(callback) instead.