Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
bmino committed Aug 9, 2020
2 parents b5c42ae + 75b6cf0 commit a9a7c1b
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 80 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,4 @@ $RECYCLE.BIN/
!*.example

src/sandbox/
**/Sandbox*.js
11 changes: 6 additions & 5 deletions config/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"INVESTMENT": {
"BASE": "BTC",
"MIN": 0.015,
"MAX": 0.035,
"MAX": 0.030,
"STEP": 0.005
},

Expand All @@ -17,9 +17,9 @@
"EXECUTION_STRATEGY": "linear",
"EXECUTION_TEMPLATE": ["BUY", "SELL", "SELL"],
"EXECUTION_CAP": 1,
"TAKER_FEE": 0.00,
"PROFIT_THRESHOLD": 0.30,
"AGE_THRESHOLD": 300,
"TAKER_FEE": 0.10,
"PROFIT_THRESHOLD": 0.00,
"AGE_THRESHOLD": 100,
"WHITELIST": []
},

Expand All @@ -30,12 +30,13 @@

"LOG": {
"LEVEL": "debug",
"VERBOSE": true,
"PRETTY_PRINT": true
},

"DEPTH": {
"SIZE": 50,
"PRUNE": false,
"PRUNE": true,
"INITIALIZATION_INTERVAL": 75
},

Expand Down
24 changes: 14 additions & 10 deletions config/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Upon each version update you should copy the new syntax from `config.json.exampl
* Description: Minimum investment amount of the base currency to consider

#### `INVESTMENT.MAX` (Number)
* Default: `0.035`
* Default: `0.030`
* Description: Maximum investment amount of the base currency to consider

#### `INVESTMENT.STEP` (Number)
Expand Down Expand Up @@ -72,18 +72,18 @@ Upon each version update you should copy the new syntax from `config.json.exampl
* `0` - No limit on executions

#### `TRADING.TAKER_FEE` (Number)
* Default: `0.00`
* Default: `0.10`
* Description: Market taker fee (percent)
* Example: 0.015% would be entered as 0.015

#### `TRADING.PROFIT_THRESHOLD` (Number)
* Default: `0.30`
* Default: `0.00`
* Description: Minimum profit (percent) required to consider executing a position
* Example: 0.30% would be entered as 0.30
* Example: 0.50% would be entered as 0.50

#### `TRADING.AGE_THRESHOLD` (Number)
* Default: `300`
* Description: Maximum time (ms) since the oldest depth tick involved in the position
* Default: `100`
* Description: Maximum time (ms) since the oldest depth tick involved in the position required to consider executing a position

#### `TRADING.WHITELIST` (Array | String)
* Default: `[]`
Expand All @@ -101,7 +101,7 @@ Upon each version update you should copy the new syntax from `config.json.exampl

#### `HUD.ARB_COUNT` (Number)
* Default: `10`
* Description: Number of arbs shown on the HUD
* Description: Number of triangular arbitrage positions shown on the HUD


---
Expand All @@ -111,7 +111,7 @@ Upon each version update you should copy the new syntax from `config.json.exampl

#### `LOG.LEVEL` (String)
* Default: `"debug"`
* Description: Log level to configure how verbose logging messages are
* Description: Log level to configure how verbose logging messages are. Output can be found in the /log directory
* Values:
* `"fatal"`
* `"error"`
Expand All @@ -121,6 +121,10 @@ Upon each version update you should copy the new syntax from `config.json.exampl
* `"trace"`
* `"silent"`

### `LOG.VERBOSE` (Boolean)
* Default: `true`
* Description: Enables more detailed log messages from the Binance api wrapper

#### `LOG.PRETTY_PRINT` (Boolean)
* Default: `true`
* Description: Format the logs with pino-pretty. Read the logs via a terminal for best results
Expand All @@ -144,7 +148,7 @@ Upon each version update you should copy the new syntax from `config.json.exampl
* `500`

#### `DEPTH.PRUNE` (Boolean)
* Default: `false`
* Default: `true`
* Description: Remove depth cache entries with a depth greater than `DEPTH.SIZE` before each calculation cycle

#### `DEPTH.INITIALIZATION_INTERVAL` (Number)
Expand All @@ -157,4 +161,4 @@ Upon each version update you should copy the new syntax from `config.json.exampl

#### `CALCULATION_COOLDOWN` (Number)
* Default: `250`
* Description: Delay (ms) after calculations are performed before starting another cycle
* Description: Delay (ms) between completing calculations and starting another cycle
74 changes: 37 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "binance-triangle-arbitrage",
"version": "5.3.0",
"version": "5.4.0",
"repository": {
"type": "git",
"url": "https://github.com/bmino/binance-triangle-arbitrage.git"
Expand All @@ -9,17 +9,17 @@
"name": "Brandon Mino"
},
"engines": {
"node": "12.16.3",
"node": "12.18.3",
"npm": "6.14.5"
},
"scripts": {
"start": "node src/main/Main.js"
},
"dependencies": {
"blessed": "^0.1.81",
"node-binance-api": "^0.11.4",
"pino": "^6.2.1",
"pino-pretty": "^4.0.0"
"node-binance-api": "^0.11.11",
"pino": "^6.5.0",
"pino-pretty": "^4.1.0"
},
"license": "MIT"
}
7 changes: 0 additions & 7 deletions src/main/ArbitrageExecution.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const ArbitrageExecution = {
inProgressIds: new Set(),
inProgressSymbols: new Set(),
attemptedPositions: {},
balances: {},

executeCalculatedPosition(calculated) {
const startTime = new Date().getTime();
Expand Down Expand Up @@ -82,7 +81,6 @@ const ArbitrageExecution = {
logger.execution.info();
})
.catch((err) => logger.execution.error(err.message))
.then(ArbitrageExecution.refreshBalances)
.then(() => {
ArbitrageExecution.inProgressIds.delete(calculated.id);
ArbitrageExecution.inProgressSymbols.delete(symbol.a);
Expand Down Expand Up @@ -135,11 +133,6 @@ const ArbitrageExecution = {
return true;
},

refreshBalances() {
return BinanceApi.getBalances()
.then(balances => ArbitrageExecution.balances = balances);
},

getAttemptedPositionsCount() {
return Object.keys(ArbitrageExecution.attemptedPositions).length;
},
Expand Down
4 changes: 3 additions & 1 deletion src/main/BinanceApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const logger = require('./Loggers');
const binance = require('node-binance-api')({
APIKEY: CONFIG.KEYS.API,
APISECRET: CONFIG.KEYS.SECRET,
test: !CONFIG.TRADING.ENABLED
test: !CONFIG.TRADING.ENABLED,
log: (msg) => logger.binance.info(msg),
verbose: CONFIG.LOG.VERBOSE,
});

const BinanceApi = {
Expand Down
3 changes: 2 additions & 1 deletion src/main/Loggers.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ if (!fs.existsSync(LOG_DIR)){
const Loggers = {
LINE: '-'.repeat(50),
'performance': pino(PINO_OPTS, pino.destination(`${LOG_DIR}/performance.log`)),
'execution': pino(PINO_OPTS, pino.destination(`${LOG_DIR}/execution.log`))
'execution': pino(PINO_OPTS, pino.destination(`${LOG_DIR}/execution.log`)),
'binance': pino(PINO_OPTS, pino.destination(`${LOG_DIR}/binance.log`)),
};

module.exports = Loggers;
Loading

0 comments on commit a9a7c1b

Please sign in to comment.