New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

btcchina

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

btcchina - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

45

btcchina.js
var querystring = require("querystring");
var https = require('https');
var http = require('http');
var _ = require('underscore');
var _ = require('lodash');
var crypto = require('crypto');

@@ -26,2 +26,5 @@

if(_.isEmpty(buffer))
return callback('BTCChina returned empty response');
try {

@@ -58,3 +61,3 @@ var json = JSON.parse(buffer);

this._request(http, options, null, callback);
this._request(https, options, null, callback);
}

@@ -66,20 +69,22 @@

//
BTCChina.prototype.ticker = function(callback) {
this._marketRequest('ticker', null, callback);
BTCChina.prototype.ticker = function(market, callback) {
if(!market)
market = 'all';
this._marketRequest('ticker', {market: market}, callback);
}
BTCChina.prototype.trades = function(callback) {
this._marketRequest('trades', null, callback);
BTCChina.prototype.trades = function(market, callback) {
this._marketRequest('trades', {market: market}, callback);
}
BTCChina.prototype.historydata = function(since, callback) {
if(!callback) {
callback = since;
this._marketRequest('historydata', null, callback);
} else
this._marketRequest('historydata', {since: since}, callback);
BTCChina.prototype.historydata = function(market, since, limit, callback) {
this._marketRequest('historydata', {
market: market,
since: since,
limit: limit
}, callback);
}
BTCChina.prototype.orderbook = function(callback) {
this._marketRequest('orderbook', null, callback);
BTCChina.prototype.orderbook = function(market, limit, callback) {
this._marketRequest('orderbook', {market: market, limit: limit}, callback);
}

@@ -142,5 +147,9 @@

BTCChina.prototype.buyOrder = function(price, amount, callback) {
this._tradeRequest('buyOrder', [price, amount], callback);
throw 'This method is deprecated. Please use buyOrder2.';
}
BTCChina.prototype.buyOrder2 = function(price, amount, callback) {
this._tradeRequest('buyOrder2', [price, amount], callback);
}
BTCChina.prototype.cancelOrder = function(id, callback) {

@@ -209,5 +218,9 @@ this._tradeRequest('cancelOrder', [id], callback);

BTCChina.prototype.sellOrder = function(currency, amount, callback) {
this._tradeRequest('sellOrder', [currency, amount], callback);
throw 'This method is deprecated. Please use sellOrder2.';
}
BTCChina.prototype.sellOrder2 = function(currency, amount, callback) {
this._tradeRequest('sellOrder2', [currency, amount], callback);
}
module.exports = BTCChina;

@@ -5,6 +5,6 @@ var BTCChina = require('./btcchina.js');

publicBtcchina.ticker(console.log);
// btcchina.trades(console.log);
// btcchina.historydata(5000, console.log);
// btcchina.orderbook(console.log);
publicBtcchina.ticker('all', console.log);
// publicBtcchina.trades('btccny', console.log);
// publicBtcchina.historydata('ltccny', false, 1000, console.log);
// publicBtcchina.orderbook('btccny', 100, console.log);

@@ -18,3 +18,3 @@ var key = 'your-api-key';

// privateBtcchina.buyOrder(9000, 1, console.log);
// privateBtcchina.buyOrder2(9000, 1, console.log);
// privateBtcchina.cancelOrder(1, console.log);

@@ -26,3 +26,2 @@ // privateBtcchina.getAccountInfo(console.log);

// privateBtcchina.getOrders(true, console.log);
// privateBtcchina.getAccountInfo(true, console.log);
// privateBtcchina.getTransactions('all', 10, console.log);

@@ -32,2 +31,2 @@ // privateBtcchina.getWithdrawal(1, console.log);

// privateBtcchina.requestWithdrawal('BTC', 1, console.log);
// privateBtcchina.sellOrder(9000, 1, console.log);
// privateBtcchina.sellOrder2(9000, 1, console.log);
{
"name": "btcchina",
"version": "0.0.2",
"version": "0.1.0",
"description": "BTCchina REST API wrapper",

@@ -16,3 +16,3 @@ "keywords": [

"dependencies": {
"underscore": "1.4.4"
"lodash": "4.x.x"
},

@@ -19,0 +19,0 @@ "repository": {

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