@ex-master/core
Advanced tools
Comparing version 0.3.7 to 0.3.8
"use strict"; | ||
/* eslint-disable no-console */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.defaultDashboard = void 0; | ||
exports.defaultDashboard = { | ||
@@ -5,0 +6,0 @@ error: console.error, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Decimal = void 0; | ||
const tslib_1 = require("tslib"); | ||
const decimal_js_1 = require("decimal.js"); | ||
exports.Decimal = decimal_js_1.Decimal; | ||
Object.defineProperty(exports, "Decimal", { enumerable: true, get: function () { return decimal_js_1.Decimal; } }); | ||
decimal_js_1.Decimal.set({ precision: 24 }); | ||
@@ -10,2 +11,3 @@ tslib_1.__exportStar(require("./dashboard"), exports); | ||
tslib_1.__exportStar(require("./spot-client"), exports); | ||
tslib_1.__exportStar(require("./types"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -56,5 +56,10 @@ /// <reference types="node" /> | ||
} | ||
export interface SpotClientSyncOptions { | ||
balances?: boolean; | ||
orders?: boolean; | ||
} | ||
export interface SpotClientOptions { | ||
isPrivateness?: boolean; | ||
dashboard?: Dashboard; | ||
sync?: SpotClientSyncOptions; | ||
} | ||
@@ -66,3 +71,4 @@ export declare abstract class SpotClient extends EventEmitter { | ||
readonly dashboard: Dashboard; | ||
private isPrivateness; | ||
readonly isPrivateness: boolean; | ||
readonly syncOptions: SpotClientSyncOptions; | ||
protected subscription: Subscription; | ||
@@ -76,3 +82,3 @@ private _destroyed; | ||
get destroyed(): boolean; | ||
constructor({ dashboard, isPrivateness, }?: SpotClientOptions); | ||
constructor({ dashboard, isPrivateness, sync, }?: SpotClientOptions); | ||
abstract getMarkets(): Promise<SpotMarketData[]>; | ||
@@ -79,0 +85,0 @@ abstract getMarketQuotations(): Promise<MarketQuotation[]>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getMarketSymbol = exports.SpotClient = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -10,7 +11,6 @@ const events_1 = require("events"); | ||
class SpotClient extends events_1.EventEmitter { | ||
constructor({ dashboard = dashboard_1.defaultDashboard, isPrivateness, } = {}) { | ||
constructor({ dashboard = dashboard_1.defaultDashboard, isPrivateness, sync = {}, } = {}) { | ||
super(); | ||
this.balanceUpdate$ = new rxjs_1.Subject(); | ||
this.orderUpdate$ = new rxjs_1.Subject(); | ||
this.isPrivateness = false; | ||
this.subscription = new rxjs_1.Subscription(); | ||
@@ -22,2 +22,6 @@ this._destroyed = false; | ||
this.isPrivateness = !!isPrivateness; | ||
this.syncOptions = { | ||
balances: sync.balances === undefined ? true : sync.balances, | ||
orders: sync.orders === undefined ? true : sync.orders, | ||
}; | ||
this.ready = new Promise(nextTick => process.nextTick(nextTick)).then(() => this.initialize()); | ||
@@ -100,3 +104,3 @@ } | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
if (this.isPrivateness) { | ||
if (this.isPrivateness && this.syncOptions.balances) { | ||
let balances = yield this.getBalances(); | ||
@@ -103,0 +107,0 @@ this.balanceMap.clear(); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./factors"), exports); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BatchScheduler = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -4,0 +5,0 @@ const v = tslib_1.__importStar(require("villa")); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ensurePrecision = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -4,0 +5,0 @@ const decimal_js_1 = tslib_1.__importDefault(require("decimal.js")); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isEqual = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -4,0 +5,0 @@ const decimal_js_1 = require("decimal.js"); |
{ | ||
"name": "@ex-master/core", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"main": "bld/library/index.js", | ||
@@ -25,3 +25,3 @@ "types": "bld/library/index.d.ts", | ||
}, | ||
"gitHead": "e1855dbc4a0042b321d4401daabc95a682b6be62" | ||
"gitHead": "1b5584797f82a9f6f063341a3b3371c3ae7c87dd" | ||
} |
@@ -82,5 +82,11 @@ import {EventEmitter} from 'events'; | ||
export interface SpotClientSyncOptions { | ||
balances?: boolean; | ||
orders?: boolean; | ||
} | ||
export interface SpotClientOptions { | ||
isPrivateness?: boolean; | ||
dashboard?: Dashboard; | ||
sync?: SpotClientSyncOptions; | ||
} | ||
@@ -94,3 +100,5 @@ | ||
private isPrivateness = false; | ||
readonly isPrivateness: boolean; | ||
readonly syncOptions: SpotClientSyncOptions; | ||
protected subscription = new Subscription(); | ||
@@ -119,2 +127,3 @@ | ||
isPrivateness, | ||
sync = {}, | ||
}: SpotClientOptions = {}) { | ||
@@ -125,2 +134,6 @@ super(); | ||
this.isPrivateness = !!isPrivateness; | ||
this.syncOptions = { | ||
balances: sync.balances === undefined ? true : sync.balances, | ||
orders: sync.orders === undefined ? true : sync.orders, | ||
}; | ||
@@ -265,3 +278,3 @@ this.ready = new Promise(nextTick => process.nextTick(nextTick)).then(() => | ||
private async initialize(): Promise<void> { | ||
if (this.isPrivateness) { | ||
if (this.isPrivateness && this.syncOptions.balances) { | ||
let balances = await this.getBalances(); | ||
@@ -268,0 +281,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
37398
913