Skip to content
This repository has been archived by the owner on Jun 6, 2021. It is now read-only.

Commit

Permalink
交易代码更新、重构数据库结构
Browse files Browse the repository at this point in the history
  • Loading branch information
zlq4863947 committed Mar 8, 2018
1 parent 818df69 commit 768e984
Show file tree
Hide file tree
Showing 13 changed files with 328 additions and 317 deletions.
3 changes: 3 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"env": {
"NODE_ENV": "test"
},
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"internalConsoleOptions": "openOnSessionStart"
},
{
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"db:clie": "node dist/test/pouchdb/clie.js",
"test": "cross-env NODE_ENV=test mocha dist/**/*.test.js --timeout 5000 --require intelli-espower-loader",
"test:m": "cross-env NODE_ENV=test mocha dist/**/trading.test.js --timeout 5000 --require intelli-espower-loader",
"test:db": "cross-env NODE_ENV=test mocha dist/**/storage.test.js --timeout 5000 --require intelli-espower-loader",
"prepare": "npm run rm && tsc -p tsconfig.json"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/arbitrage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class TriangularArbitrage extends Event {
}
}

private async initExchange(exchangeId: types.ExchangeId) {
public async initExchange(exchangeId: types.ExchangeId) {
const timer = Helper.getTimer();
logger.debug('初始化交易所[启动]');
try {
Expand Down
5 changes: 3 additions & 2 deletions src/lib/common/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ export class Helper {
timer.start();
return timer;
}

static endTimer(timer: any) {
return timer.stop().words;
}
Expand All @@ -199,9 +200,9 @@ export class Helper {
}

/**
* 获取交易额度
* 获取基础货币交易额度
*/
static getTradeAmount(tradeAmount: BigNumber, feeAmount: BigNumber) {
static getBaseTradeAmount(tradeAmount: BigNumber, feeAmount: BigNumber) {
// 如果A点交易额 x 50% < 该资产可用额度
if (tradeAmount.times(0.5).isLessThan(feeAmount)) {
// 返回交易额 x 50%
Expand Down
2 changes: 1 addition & 1 deletion src/lib/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class Event extends EventEmitter {

async onUpdateArbitage(ranks: types.IRank[]) {
if (ranks.length > 0) {
await this.storage.putRanks(ranks);
await this.storage.rank.putRanks(ranks);
}
}
}
132 changes: 0 additions & 132 deletions src/lib/storage.ts

This file was deleted.

Loading

0 comments on commit 768e984

Please sign in to comment.