Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
bmino committed Jun 22, 2019
2 parents 0dae169 + ab9fe04 commit 1f0a53b
Show file tree
Hide file tree
Showing 9 changed files with 253 additions and 170 deletions.
5 changes: 3 additions & 2 deletions config/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@

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

"CALCULATION_COOLDOWN": 100
"CALCULATION_COOLDOWN": 250

}
16 changes: 11 additions & 5 deletions config/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Upon each version update you should copy the new syntax from `config.json.exampl
* `"linear"` - each trade of the triangle arbitrage is executed sequentially
* `"parallel"` - all three trades of the triangle arbitrage are executed at the same time

#### `EXECUTION_TEMPLATE` (Array | String)
#### `TRADING.EXECUTION_TEMPLATE` (Array | String)
* Default: `["BUY", "SELL", "SELL"]`
* Description: Restricts the order type of each leg in the position
* Special Values:
Expand All @@ -71,13 +71,15 @@ Upon each version update you should copy the new syntax from `config.json.exampl
* Special Values:
* `0` - No limit on executions

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

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

#### `TRADING.AGE_THRESHOLD` (Number)
* Default: `300`
Expand Down Expand Up @@ -121,7 +123,7 @@ Upon each version update you should copy the new syntax from `config.json.exampl

#### `LOG.PRETTY_PRINT` (Boolean)
* Default: `true`
* Description: Format the logs with pino-pretty
* Description: Format the logs with pino-pretty. Read the logs via a terminal for best results


---
Expand All @@ -142,6 +144,10 @@ Upon each version update you should copy the new syntax from `config.json.exampl
* `500`
* `1000`

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

#### `DEPTH.INITIALIZATION_INTERVAL` (Number)
* Default: `50`
* Description: Delay (ms) between the initialization of each depth websocket
Expand All @@ -150,6 +156,6 @@ Upon each version update you should copy the new syntax from `config.json.exampl
---


#### `CALCULATION_DELAY` (Number)
* Default: `100`
#### `CALCULATION_COOLDOWN` (Number)
* Default: `500`
* Description: Delay (ms) after calculations are performed before starting another cycle
110 changes: 60 additions & 50 deletions package-lock.json

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

16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{
"name": "binance-triangle-arbitrage",
"version": "5.1.2",
"private": true,
"version": "5.2.0",
"repository": {
"type": "git",
"url": "https://github.com/bmino/binance-triangle-arbitrage.git"
},
"author": {
"name": "Brandon Mino"
},
"engines": {
"node": "11.10.1",
"npm": "6.9.0"
Expand All @@ -11,8 +17,8 @@
},
"dependencies": {
"blessed": "^0.1.81",
"node-binance-api": "^0.9.1",
"pino": "^5.12.2",
"pino-pretty": "^2.6.0"
"node-binance-api": "^0.9.3",
"pino": "^5.12.6",
"pino-pretty": "^3.2.0"
}
}
4 changes: 2 additions & 2 deletions src/main/ArbitrageExecution.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ const ArbitrageExecution = {
if (results.orderId) {
[actual.a.spent, actual.b.earned, fees] = ArbitrageExecution.parseActualResults(calculated.trade.ab.method, results);
actual.fees += fees;
recalculated.bc = CalculationNode.recalculateTradeLeg(calculated.trade.bc, actual.b.earned);
recalculated.bc = CalculationNode.recalculateTradeLeg(calculated.trade.bc, actual.b.earned, BinanceApi.cloneDepth(calculated.trade.bc.ticker, CONFIG.DEPTH.SIZE));
}
return BinanceApi.marketBuyOrSell(calculated.trade.bc.method)(calculated.trade.bc.ticker, recalculated.bc);
})
.then((results) => {
if (results.orderId) {
[actual.b.spent, actual.c.earned, fees] = ArbitrageExecution.parseActualResults(calculated.trade.bc.method, results);
actual.fees += fees;
recalculated.ca = CalculationNode.recalculateTradeLeg(calculated.trade.ca, actual.c.earned);
recalculated.ca = CalculationNode.recalculateTradeLeg(calculated.trade.ca, actual.c.earned, BinanceApi.cloneDepth(calculated.trade.ca.ticker, CONFIG.DEPTH.SIZE));
}
return BinanceApi.marketBuyOrSell(calculated.trade.ca.method)(calculated.trade.ca.ticker, recalculated.ca);
})
Expand Down
Loading

0 comments on commit 1f0a53b

Please sign in to comment.