bfx-api-node-models
Advanced tools
Comparing version 1.6.1 to 1.6.2
@@ -11,2 +11,3 @@ 'use strict' | ||
const _includes = require('lodash/includes') | ||
const _isBoolean = require('lodash/isBoolean') | ||
const _isUndefined = require('lodash/isUndefined') | ||
@@ -105,2 +106,3 @@ const { prepareAmount, preparePrice } = require('bfx-api-node-util') | ||
if (!_isUndefined(data.hidden)) this.setHidden(data.hidden) | ||
if (!_isUndefined(data.visibleOnHit)) this.setVisibleOnHit(data.visibleOnHit) | ||
if (!_isUndefined(data.postonly)) this.setPostOnly(data.postonly) | ||
@@ -164,2 +166,3 @@ if (!_isUndefined(data.reduceonly)) this.setReduceOnly(data.reduceonly) | ||
this.isHidden() && 'hidden', | ||
this.isVisibleOnHit() && 'visible-on-hit', | ||
this.isPostOnly() && 'post-only', | ||
@@ -189,2 +192,9 @@ this.isReduceOnly() && 'reduce-only', | ||
/** | ||
* @returns {boolean} visibleOnHit | ||
*/ | ||
isVisibleOnHit () { | ||
return !!(this.isHidden() && this.meta && this.meta.make_visible) | ||
} | ||
/** | ||
* @returns {boolean} postonly | ||
@@ -243,2 +253,5 @@ */ | ||
setHidden (v) { | ||
if (!v && this.meta) { | ||
delete this.meta.make_visible | ||
} | ||
return this.modifyFlag(Order.flags.HIDDEN, v) | ||
@@ -248,2 +261,22 @@ } | ||
/** | ||
* Update the meta object. The rest part of the hidden order will be visible | ||
* after first hit(partial execution). | ||
* | ||
* @param {boolean} v - visibleOnHit value | ||
* @returns {number} meta | ||
*/ | ||
setVisibleOnHit (v) { | ||
if (!this.isHidden() || !_isBoolean(v)) { | ||
return | ||
} | ||
this.meta = { | ||
...(this.meta || {}), | ||
make_visible: +v | ||
} | ||
return this.meta | ||
} | ||
/** | ||
* Update the post-only flag value. If post-only and the order would | ||
@@ -250,0 +283,0 @@ * immediately fill, the order is automatically cancelled. |
{ | ||
"name": "bfx-api-node-models", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"description": "Object models for usage with the Bitfinex node API", | ||
@@ -5,0 +5,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
140910
4307