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

coinpit-common

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coinpit-common - npm Package Compare versions

Comparing version 0.0.1 to 0.1.1

5

instruments/inverse.js

@@ -28,3 +28,6 @@ var affirm = require('affirm.js')

if (order.orderType === 'STP') {
return Math.abs(sinful.sub(order.entryAmount, sinful.mul(quantity, order.normalizedMaxStop)))
var exitAmount = sinful.mul(quantity, order.normalizedMaxStop)
var diff = sinful.sub(order.entryAmount, exitAmount)
var signedDiff = sinful.multiply(instrument.positionSide[order.side], diff)
return Math.max(0, signedDiff)
}

@@ -31,0 +34,0 @@ if (order.marginPerQty) {

6

package.json
{
"name": "coinpit-common",
"version": "0.0.1",
"version": "0.1.1",
"description": "common utils for coinpit",
"main": "index.js",
"scripts": {
"test": "gulp test"
"test": "gulp coverage"
},

@@ -33,3 +33,3 @@ "repository": {

"gulp-jshint-html-reporter": "^0.1.3",
"gulp-mocha": "^4.3.0",
"gulp-mocha": "^3.0.1",
"gulp-nsp": "^2.4.2",

@@ -36,0 +36,0 @@ "jshint": "^2.9.4",

@@ -92,4 +92,26 @@ {

"stopPrice" : 10
},
"maxStopTightenBeyondEntryBuy": {
"instrument": "BTCUSD7F27",
"side": "buy",
"orderType": "STP",
"quantity": 1,
"entryPrice": 1200,
"entryAmount": 41666667,
"price": 1190,
"maxStop": 1188,
"normalizedMaxStop":42087542
},
"maxStopTightenBeyondEntrySell": {
"instrument": "BTCUSD7F27",
"side": "sell",
"orderType": "STP",
"quantity": 1,
"entryPrice": 1200,
"entryAmount": 41666667,
"price": 1210,
"maxStop": 1212,
"normalizedMaxStop":41254125
}
}
}

@@ -248,2 +248,16 @@ var expect = require('expect.js')

it("should return 0 margin required if max stop is tighten beyond entry price for buy stop order.", function(){
var order = orders.inverse.maxStopTightenBeyondEntryBuy
var inverse = Inverse(instruments[order.instrument])
var value = inverse.calculateMarginRequiredByOrder(order, {}, true)
expect(value).to.be.eql(0)
})
it("should return 0 margin required if max stop is tighten beyond entry price for sell stop order.", function(){
var order = orders.inverse.maxStopTightenBeyondEntrySell
var inverse = Inverse(instruments[order.instrument])
var value = inverse.calculateMarginRequiredByOrder(order, {}, true)
expect(value).to.be.eql(0)
})
})

@@ -250,0 +264,0 @@

Sorry, the diff of this file is not supported yet

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