NodeJS Bit4You Client

Usage no npm install needed!

<script type="module">
  import chainiusBit4youClient from 'https://cdn.skypack.dev/@chainius/bit4you-client';


Official bit4you NodeJS client

Connect and interact with our platform through NodeJS. Create your own flows or analyse our markets by using this library.


A minimal example can be found in the example folder.

API Credentials

Create API credentials at: https://www.bit4you.io/settings/security

These are needed to use our API and therefor this library.

Environment variables

Use your created API credentials by setting following environment variables:

|Variable|Description| |--|--| | B4Y_CLIENT_ID | Your CLIENT ID from your created credentials | B4Y_CLIENT_SECRET | Your API KEY from your created credentials

This is optional, as you may also provide your credentials in the constructor (See example). But it is recommended to setup your configuration through environment variables.


The client has several methods that you may call to get different information through your credentials.

|Method|Description| |--|--| | userinfo() | Info on the user that is authenticated through their API credentials. | scopes() | Scopes the authenticated user has through their API credentials. | setSimulation(Boolean) | (synchronous) Set the mode on simulation/real for your api calls. | setSimulation(Boolean) | (synchronous) Set the mode on simulation/real for your api calls. | markets() | Get all markets information and current value | summaries() | Get ticker/current information for all markets | ticks(market, interval) | Get historical information for a certain market | openOrders() | Get your current OPEN positions | portfolio() | Get your current FILLED positions | portfolioHistory() | Get a history for your portfolio | balances() | Get your balance for all assets | cancelOrder(id) | Close a position that is not completely filled. | closePosition(id) | Close a filled position seen in your portfolio (by its order ID) | buy(market, quantity, rate) | Create a buy position for a specific asset | transactions(iso) | Get a list of your transaction for a specific asset | withdraw(iso, quantity, address) | External withdraw of your fund of a certain asset