Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

btc-china

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

btc-china

Node.js API wrapper to BTC China bitcoin exchange

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

BTC China Node.js wrapper to BTC China API

A node.js wrapper for the Trading and Market APIs exposed by bitcoin exchange BTC China. You will need have a registered account with BTC China and generated API keys to access the private methods.

Please contact support@btcchina.com if you are having trouble opening and account or generating an API key.

Install

`npm install btc-china

Error handling

The first parameter to each API function is a callback function which is passed error and data objects. The error object is an instance of VError which is an extension of the standard Error object. The error message property will try and capture call the available information so problems in production can be diagnosed.

Examples

var BTCChina = require('btc-china');

// Test public data APIs
var publicClient = new BTCChina();

publicClient.getTicker(console.log, 'BTCCNY');

publicClient.getOrderBook(console.log, 'BTCCNY');

// get 2 trades since 1 minute ago
var since1Minute = new Date().getTime() / 1000 -  60;
//publicClient.getHistoryData(console.log, {limit: 2, since: since1Minute, sincetype: 'time' });

// WARNING never commit your API keys into a public repository.
var key = 'your-api-key';
var secret = 'your-api-secret';

var privateClient = new BTCChina(key, secret);

privateClient.getAccountInfo(console.log, 'all');

// add limit orders
privateClient.createOrder2(console.log, 'buy', 999, 0.0001, 'BTCCNY');
privateClient.createOrder2(console.log, 'sell', 8888, 0.0002, 'BTCCNY');

// add market order
privateClient.createOrder2(console.log, 'buy', null, 0.0001, 'BTCCNY');

// cancel an order
privateClient.cancelOrder(console.log, 1);

// get your open orders
privateClient.getOrders(console.log);

Please see exmaples.js for more examples

Keywords

FAQs

Package last updated on 07 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc