Skip to content

Commit

Permalink
Display "age" in terms of milliseconds
Browse files Browse the repository at this point in the history
Consistency across the app
  • Loading branch information
bmino committed Feb 17, 2021
1 parent 74e482a commit e3f2474
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ arbitrage opportunities. To disable the HUD, set `HUD.ENABLED` to false.
### Reading the HUD
* **Trade** - Three symbols related by exchange rates that are involved in the triangle arbitrage.
* **Profit** - Percent profit or loss from executing the triangle arbitrage. This includes trading fees specified via `EXECUTION.FEE` config.
* **AB Age** - Time in seconds since the most recent update of the market ticker relating the first and second symbols in the arbitrage.
* **BC Age** - Time in seconds since the most recent update of the market ticker relating the second and third symbols in the arbitrage.
* **CA Age** - Time in seconds since the most recent update of the market ticker relating the third and first symbols in the arbitrage.
* **Age** - Time in seconds since the least recently updated market ticker involved in the triangle arbitrage.
* **AB Age** - Time in milliseconds since the most recent update of the market ticker relating the first and second symbols in the arbitrage.
* **BC Age** - Time in milliseconds since the most recent update of the market ticker relating the second and third symbols in the arbitrage.
* **CA Age** - Time in milliseconds since the most recent update of the market ticker relating the third and first symbols in the arbitrage.
* **Age** - Time in milliseconds since the least recently updated market ticker involved in the triangle arbitrage.


## Getting Started
Expand Down
14 changes: 7 additions & 7 deletions src/main/HUD.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ const HUD = {
.filter(({depth: {ab, bc, ca}}) => ab.eventTime && bc.eventTime && ca.eventTime)
.sort((a, b) => a.percent > b.percent ? -1 : 1)
.slice(0, rowCount)
.forEach(calculation => {
.forEach(({ trade, percent, depth }) => {
tableData.push([
`${calculation.trade.symbol.a}-${calculation.trade.symbol.b}-${calculation.trade.symbol.c}`,
`${calculation.percent.toFixed(4)}%`,
`${((now - calculation.depth.ab.eventTime)/1000).toFixed(2)}`,
`${((now - calculation.depth.bc.eventTime)/1000).toFixed(2)}`,
`${((now - calculation.depth.ca.eventTime)/1000).toFixed(2)}`,
`${((now - Math.min(calculation.depth.ab.eventTime, calculation.depth.bc.eventTime, calculation.depth.ca.eventTime))/1000).toFixed(2)}`
`${trade.symbol.a}-${trade.symbol.b}-${trade.symbol.c}`,
`${percent.toFixed(4)}%`,
`${now - depth.ab.eventTime}`,
`${now - depth.bc.eventTime}`,
`${now - depth.ca.eventTime}`,
`${now - Math.min(depth.ab.eventTime, depth.bc.eventTime, depth.ca.eventTime)}`
]);
});

Expand Down

0 comments on commit e3f2474

Please sign in to comment.