npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

biscoint-api-node

v1.4.3

Published

Library for interacting with Biscoint API

Downloads

11

Readme

Biscoint API Node

🌎 This documentation is also available in the following languages: PT-BR

TypeScript Mocha Node

NodeJS library for interacting with Biscoint's API. In order to call private methods, you'll need a Biscoint verified account to generate the API key and secret.

Biscoint is a cryptocurrency marketplace that allows trading BTC and another assets in multiple exchanges with a single account.

Example

Check out biscoint-arbitrage-bot, for it showcases the use of many of the methods in this library in an arbitrage bot application.

Install with NPM

  npm i biscoint-api-node

Install with Yarn

  yarn add biscoint-api-node

Instantiate Biscoint class

import Biscoint from 'biscoint-api-node';


// configure here with your keys for private calls, public calls don't need valid keys
const bc = new Biscoint({
  apiKey: 's4t0sh1n4k4m0t0',
  apiSecret: 's4t0sh1n4k4m0t0',
  // apiTimeout: 9000,
});

Optionally, you can uncomment the apiTimeout line to specify the request timeout in milliseconds you want. If not specified the default timeout will be 5000ms.

All methods return a Promise.

Public methods

Ticker


Get Biscoint ticker

bc.ticker();

Returns

{
  base: 'BTC',
  quote: 'BRL',
  vol: 0.00155952,
  low: 32061.15,
  high: 32061.15,
  last: 32061.15,
  ask: 32088.7,
  askQuoteAmountRef: 1000,
  askBaseAmountRef: 0.03116362,
  bid: 29961.9,
  bidQuoteAmountRef: 1000,
  bidBaseAmountRef: 0.03337572,
  timestamp: '2019-12-10T20:22:29.172Z'
}

Fees


Get Biscoint fees

bc.fees();

Returns

{
  withdrawal: {
    BTC: {
      rate: "0.0",
      fixed: {
        slow: "0.0001",
        normal: "0.0002",
        fast: "0.0004"
      }
    },
    BRL: {
      rate: "0.0",
      fixed: {
        ted: "14.90",
        sameBankTransfer: "14.90"
      }
    }
  }
}

Rate limits


Get Biscoint rate limit of your IP

bc.meta();

Returns

{
  version: "v1",
  endpoints: {
    ticker: {
      get: {
        type: "public",
        rateLimit: {
          windowMs: 60000,
          maxRequests: 6,
          rate: "6 per 1 minute"
        }
      }
    },
    fees: {
      get: {
        type: "public",
        rateLimit: {
          windowMs: 60000,
          maxRequests: 2,
          rate: "2 per 1 minute"
        }
      }
    },
    meta: {
      get: {
        type: "public",
        rateLimit: {
          windowMs: 60000,
          maxRequests: 2,
          rate: "2 per 1 minute"
        }
      }
    },
    balance: {
      get: {
        type: "private",
        rateLimit: {
          windowMs: 60000,
          maxRequests: 12,
          rate: "12 per 1 minute"
        }
      }
    },
    offer: {
      get: {
        type: "private",
        rateLimit: {
          windowMs: 60000,
          maxRequests: 24,
          rate: "24 per 1 minute"
        }
      },
      post: {
        type: "private",
        rateLimit: {
          windowMs: 60000,
          maxRequests: 24,
          rate: "24 per 1 minute"
        }
      }
    },
    trades: {
      get: {
        type: "private",
        rateLimit: {
          windowMs: 60000,
          maxRequests: 12,
          rate: "12 per 1 minute"
        }
      }
    }
  }
}

Private methods

Balance


Get your account balance

bc.balance();

Returns

{
  BRL: 5000.00,
  BTC: 0.001
}

Offer


Request a new offer for amount, and side that you specify.

bc.offer({ amount: 0.01, isQuote: false, op: "buy" });

Returns

{
  offerId: "hHaJuKF2m5aD8mZn4",
  base: "BTC",
  quote: "BRL",
  op: "buy",
  isQuote: false,
  baseAmount: "0.01000000",
  quoteAmount: "362.69",
  efPrice: "36269.00",
  createdAt: "2020-01-22T22:39:16.874Z",
  expiresAt: "2020-01-22T22:39:31.874Z",
  apiKeyId: "BdFABxNakZyxPwnRu"
}

Confirm Offer


Confirm offer passing an orderId

bc.confirmOffer({ offerId: "5d9s8w6d12"});

Returns

{
  offerId: "hHaJuKF2m5aD8mZn4",
  base: "BTC",
  quote: "BRL",
  op: "buy",
  isQuote: false,
  baseAmount: "0.01000000",
  quoteAmount: "362.69",
  efPrice: "36269.00",
  createdAt: "2020-01-22T22:39:16.874Z",
  confirmedAt: "2020-01-22T22:39:16.945Z",
  apiKeyId: "BdFABxNakZyxPwnRu"
}

Get last trades


Returns last 20 trades

bc.trades({ op: 'sell' });

Returns

[
  {
    "id": "D6x63B3q3Mec4tggY",
    "offerId": "aX2Bkd8MseB20Axbkba",
    "op": "buy",
    "base": "BTC",
    "quote": "BRL",
    "baseAmount": "0.01000000",
    "quoteAmount": "362.82",
    "apiKeyId": "BdFABxNakZyxPwnRu",
    "efPrice": "36282.00",
    "date": "2020-01-22T23:25:02.785Z"
  },
  ...
]

Get last trades paginated


Returns last 20 trades

bc.trades({ page: 0, limit: 20, base: 'BTC' });

Returns

{
  "page": 0,
  "totalPages": 2,
  "totalSize": 15,
  "limit": 20,
  "trades": [
    {
      "id": "D6x63B3q3Mec4tggY",
      "offerId": "aX2Bkd8MseB20Axbkba",
      "op": "buy",
      "base": "BTC",
      "quote": "BRL",
      "baseAmount": "0.01000000",
      "quoteAmount": "362.82",
      "apiKeyId": "BdFABxNakZyxPwnRu",
      "efPrice": "36282.00",
      "date": "2020-01-22T23:25:02.785Z"
    },
    ...
  ]
}

Testing

Simple do the following steps

  1. Add the following environment variables to your terminal (replace with your own api key and secret)
API_URL='https://api.biscoint.io/' # tip: this can be null
API_KEY='s4t0sh1n4k4m0t0'
API_SECRET='s4t0sh1n4k4m0t0'
  1. Run tests
npm run test

or

yarn test

PRs are welcome!

If you missed something and would like to see it here, don't be shy and create your first PR. Our recruiters are keeping an eye on those who contribute 👀.