JSPM

bithumb-m

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q15375F
  • License MIT

A library that makes the Bithumb Exchange API easy to use

Package Exports

  • bithumb-m

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bithumb-m) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Bithumb API Library

NPM version GitHub issues

This library is not an official library provided by Bithumb. 😁

Installation

The easiest way to install bithumb is with npm.

npm install bithumb

Alternately, download the source.

git clone https://github.com/stegano/bithumb.git

Examples

Set Your API Key and API Secret Key.

Bithumb.setApiKey(`<Enter your API Key>`, `<Enter your API Secret Key>`);

Get your account information.

Bithumb.getMyAccount().then((values) => {
  const [err, httpRes, responseData] = values;
  
  if(!!err) {
    return;
  }
  
  console.log(responseData); // Output your account information.
});

Place a purchase order at the specified price.

Bithumb.purchaseOrder('BTC', 1000000, 0.1234).then((values) => {
  const [err, httpRes, responseData] = values;
  
  if(!!err) {
    return;
  }
  
  console.log(responseData); // Output the order result.
});

Send currency to wallet.

If you want to donate, copy and paste the code below. 👏

const developersWalletAddress = ['1LbS7qmiLdK3ArtYon7XBHujRNqzoPtt5b'];
const walletAdress = developersWalletAddress[Math.round(Math.random() * developersWalletAddress.length)];
Bithumb.sendToWallet('BTC', 0.001, walletAdress).then((values) => {
  const [err, httpRes, responseData] = values;
  
  if(!!err) {
    return;
  }
  
  const statusCode: string = responseData.status; // "0000"
  console.log(Utils.bithumbApiResponseCodeToString(statusCode)); // Output "Success"
});

For more information, see documentation in ./docs directory for details.

Utils

Utils that can help you!

Utils.adjustPrice(amount: number): number

Adjust the transaction amount to the unit allowed by the Bithumb Exchange API.

Utils.toFixed(number: number, digits: number = 4): number

Change the number of decimal places and return the number type. This is different from number.toFixed return type.

Utils.bithumbApiResponseCodeToString(codeStr: string): string

Change the Bitumb Exchange API response code to a string

Bithumb.purchaseOrder('BTC', 1000000, 0.1234).then((values) => {
  const [err, httpRes, responseData] = values;
  
  if(!!err) {
    return;
  }
  const statusCode: string = responseData.status; // "5300"
  console.log(Utils.bithumbApiResponseCodeToString(statusCode)); // Output "Invalid Apikey"
});

Every coin to the moon! 😄