Skip to content

Commit

Permalink
Add basic hardcoded fees.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiago Siebler committed Jan 1, 2018
1 parent 7ceff8e commit 233ee17
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions lib/UI.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ UI.init = (options)=>{
.fill()
.store();

UI.cols = [10, 20]
UI.cols = [10, 10, 20]
/*
UI.header = new Line(UI.outputBuffer)
.column('Time', UI.cols[0], [clc.cyan])
Expand All @@ -47,7 +47,13 @@ UI.init = (options)=>{
.column('Step B', UI.cols[0], [clc.cyan])
.column('Step C', UI.cols[0], [clc.cyan])

.column('Rate', UI.cols[1], [clc.green])
.column('Rate', UI.cols[1], [clc.cyan])

.column('Fees BnB', UI.cols[1], [clc.cyan])
.column('(Rate - BnB Fee)', 20, [clc.green])

.column('Fees Normal', 17, [clc.cyan])
.column('(Rate - Fee)', 20, [clc.green])

.fill()
.store();
Expand Down Expand Up @@ -75,11 +81,25 @@ UI.updateArbitageOpportunities = (tickers)=>{
if(ticker.rate && ticker.rate < 1) color = clc.red;

if(ticker.a){
var rate = ((ticker.rate - 1)* 100);
var fees1 = rate * 0.05; //bnb
var fRate1 = rate - fees1;

var fees2 = rate * 0.1; //other
var fRate2 = rate - fees2;

UI.line = new Line(UI.outputBuffer)
.column(ticker.a.toString(), UI.cols[0])
.column(ticker.b.toString(), UI.cols[0])
.column(ticker.c.toString(), UI.cols[0])
.column(((ticker.rate - 1)* 100).toFixed(3).toString() + '%', UI.cols[1], [color])
.column(ticker.a.toString(), UI.cols[0], [clc.cyan])
.column(ticker.b.toString(), UI.cols[0], [clc.cyan])
.column(ticker.c.toString(), UI.cols[0], [clc.cyan])
.column(rate.toFixed(3).toString() + '%', UI.cols[1], [clc.cyan])
.column(fees1.toFixed(3).toString() + '%', UI.cols[1], [clc.cyan])
.column(fRate1.toFixed(3).toString() + '%', 20, [color])

.column(fees2.toFixed(3).toString() + '%', 17, [clc.cyan])
.column(fRate2.toFixed(3).toString() + '%', 20, [color])


.fill()
.store();
}else{
Expand Down

0 comments on commit 233ee17

Please sign in to comment.