@ex-master/core
Advanced tools
Comparing version 0.1.45 to 0.1.46
@@ -53,2 +53,3 @@ /// <reference types="node" /> | ||
initialize(): Promise<void>; | ||
updateMarkets(): Promise<void>; | ||
getBalance(key: string): AccountBalance; | ||
@@ -74,4 +75,3 @@ getActiveOrders(group?: string): ActiveOrder[]; | ||
private cancelActiveOrders(); | ||
private updateMarkets(); | ||
private subtractBalanceWithOrder(market, type, price, size); | ||
} |
@@ -36,3 +36,2 @@ "use strict"; | ||
this.tickLockObject = {}; | ||
this.stockMoneyToMarketDataMap = new multikey_map_1.MultikeyMap(); | ||
this.pendingUpdatesPriorityScale = pendingUpdatesPriorityScale; | ||
@@ -48,2 +47,12 @@ } | ||
} | ||
async updateMarkets() { | ||
this.dashboard.info('update markets...'); | ||
let marketDataItems = await this.client.getMarkets(); | ||
this._markets = marketDataItems.map(item => item.market); | ||
let map = (this.stockMoneyToMarketDataMap = new multikey_map_1.MultikeyMap()); | ||
for (let item of marketDataItems) { | ||
let { market: { stock, money } } = item; | ||
map.set([stock, money], item); | ||
} | ||
} | ||
getBalance(key) { | ||
@@ -393,12 +402,2 @@ return (this.balanceDict[key] || { | ||
} | ||
async updateMarkets() { | ||
this.dashboard.info('update markets...'); | ||
let marketDataItems = await this.client.getMarkets(); | ||
let map = this.stockMoneyToMarketDataMap; | ||
this._markets = marketDataItems.map(item => item.market); | ||
for (let item of marketDataItems) { | ||
let { market: { stock, money } } = item; | ||
map.set([stock, money], item); | ||
} | ||
} | ||
subtractBalanceWithOrder(market, type, price, size) { | ||
@@ -405,0 +404,0 @@ let balanceDict = { ...this.balanceDict }; |
{ | ||
"name": "@ex-master/core", | ||
"version": "0.1.45", | ||
"version": "0.1.46", | ||
"main": "bld/index.js", | ||
@@ -5,0 +5,0 @@ "types": "bld/index.d.ts", |
57386
1614