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

@ex-master/core

Package Overview
Dependencies
Maintainers
1
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ex-master/core - npm Package Compare versions

Comparing version 0.1.16 to 0.1.17

1

bld/exchange/exchange.d.ts

@@ -57,2 +57,3 @@ import { Decimal } from 'decimal.js';

private freeAndOrder(market, descriptor, nextUpdates);
private isBalanceSufficient(market, {type, price, size});
private freeMoney(key, target, updates);

@@ -59,0 +60,0 @@ private freeStock(key, target, updates);

31

bld/exchange/exchange.js

@@ -210,7 +210,17 @@ "use strict";

let { active, descriptor } = updates[i];
if (active) {
await this.cancelOrder(active);
if (active &&
descriptor &&
this.isBalanceSufficient(market, descriptor)) {
let promises = [];
promises.push(this.cancelOrder(active));
promises.push(this.order(market, descriptor));
await Promise.all(promises);
}
if (descriptor) {
await this.freeAndOrder(market, descriptor, updates.slice(i + 1));
else {
if (active) {
await this.cancelOrder(active);
}
if (descriptor) {
await this.freeAndOrder(market, descriptor, updates.slice(i + 1));
}
}

@@ -246,10 +256,7 @@ }

}
// private isBalanceSufficient(
// market: Market,
// {type, price, size}: InternalOrderDescriptor,
// ): boolean {
// let target = type === 'ask' ? size : price.mul(size);
// let key = type === 'ask' ? market.stock : market.money;
// return this.account.getBalance(key).available.greaterThanOrEqualTo(target);
// }
isBalanceSufficient(market, { type, price, size }) {
let target = type === 'ask' ? size : price.mul(size);
let key = type === 'ask' ? market.stock : market.money;
return this.account.getBalance(key).available.greaterThanOrEqualTo(target);
}
async freeMoney(key, target, updates) {

@@ -256,0 +263,0 @@ let available;

{
"name": "@ex-master/core",
"version": "0.1.16",
"version": "0.1.17",
"main": "bld/index.js",

@@ -5,0 +5,0 @@ "types": "bld/index.d.ts",

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