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

coinbase-exchange

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coinbase-exchange - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

tests/public_client.js

19

lib/clients/authenticated.js

@@ -33,3 +33,3 @@ var util = require('util');

opts = opts || {};
if (!callback && (opts instanceof Function)) {
if (!callback && (typeof opts === 'function')) {
callback = opts;

@@ -96,3 +96,3 @@ opts = {};

args = args || {}
if (!callback && (args instanceof Function)) {
if (!callback && (typeof args === 'function')) {
callback = args;

@@ -110,3 +110,3 @@ args = {};

args = args || {}
if (!callback && (args instanceof Function)) {
if (!callback && (typeof args === 'function')) {
callback = args;

@@ -122,3 +122,10 @@ args = {};

var self = this;
_.forEach(['price', 'size', 'side', 'product_id'], function(param) {
var requiredParams = ['size', 'side', 'product_id'];
if (params.type !== 'market') {
requiredParams.push('price');
}
_.forEach(requiredParams, function(param) {
if (params[param] === undefined) {

@@ -153,3 +160,3 @@ throw "`opts` must include param `" + param + "`";

args = args || {}
if (!callback && (args instanceof Function)) {
if (!callback && (typeof args === 'function')) {
callback = args;

@@ -172,3 +179,3 @@ args = {};

args = args || {}
if (!callback && (args instanceof Function)) {
if (!callback && (typeof args === 'function')) {
callback = args;

@@ -175,0 +182,0 @@ args = {};

@@ -49,3 +49,3 @@ var request = require('request');

opts = opts || {};
if (!callback && (opts instanceof Function)) {
if (!callback && (typeof opts === 'function')) {
callback = opts;

@@ -78,3 +78,3 @@ opts = {};

args = args || {}
if (!callback && (args instanceof Function)) {
if (!callback && (typeof args === 'function')) {
callback = args;

@@ -104,3 +104,3 @@ args = {};

args = args || {}
if (!callback && (args instanceof Function)) {
if (!callback && (typeof args === 'function')) {
callback = args;

@@ -107,0 +107,0 @@ args = {};

@@ -41,3 +41,2 @@ var EventEmitter = require('events').EventEmitter;

self.socket.close();
self.onClose();
};

@@ -55,3 +54,3 @@

// Set a 30 second ping to keep connection alive
setInterval(function(){
self.pinger = setInterval(function(){
self.socket.ping("keepalive");

@@ -64,2 +63,4 @@ }, 30000);

var self = this;
clearInterval(self.pinger);
self.socket = null;
self.emit('close');

@@ -66,0 +67,0 @@ };

@@ -11,6 +11,8 @@ var WebsocketClient = require('./clients/websocket.js');

// Orderbook syncing
var OrderbookSync = function(productID) {
var OrderbookSync = function(productID, apiURI, websocketURI) {
var self = this;
self.productID = productID || 'BTC-USD';
self.apiURI = apiURI || 'https://api.exchange.coinbase.com';
self.websocketURI = websocketURI || 'wss://ws-feed.exchange.coinbase.com';

@@ -20,3 +22,3 @@ self._queue = [];

WebsocketClient.call(self, self.productID);
WebsocketClient.call(self, self.productID, self.websocketURI);
self.loadOrderbook();

@@ -49,3 +51,3 @@ };

if (!self.publicClient) {
self.publicClient = new PublicClient();
self.publicClient = new PublicClient(self.productID, self.apiURI);
}

@@ -52,0 +54,0 @@

@@ -157,6 +157,14 @@ var RBTree = require('bintrees').RBTree;

var node = tree.find({price: price});
assert(node);
if (!node || node.orders.indexOf(order) < 0) {
return;
}
var nodeOrder = node.orders[node.orders.indexOf(order)];
assert.equal(order.size, change.old_size);
var newSize = parseFloat(order.size);
var oldSize = parseFloat(change.old_size);
assert.equal(oldSize, newSize);
nodeOrder.size = size;

@@ -163,0 +171,0 @@ self._ordersByID[nodeOrder.id] = nodeOrder;

{
"name": "coinbase-exchange",
"version": "0.2.0",
"version": "0.2.1",
"author": "Coinbase",

@@ -5,0 +5,0 @@ "bugs": "https://github.com/coinbase/coinbase-exchange-node/issues",

@@ -172,3 +172,3 @@ var assert = require('assert');

order_id: 'super-duper-id-2',
old_size: 10,
old_size: '10.0',
new_size: 3,

@@ -175,0 +175,0 @@ price: 201,

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