From 233ee1751af8e458c85b2589f6496cb618cdc0fc Mon Sep 17 00:00:00 2001 From: Tiago Siebler Date: Mon, 1 Jan 2018 14:17:54 +0000 Subject: [PATCH] Add basic hardcoded fees. --- lib/UI.js | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/lib/UI.js b/lib/UI.js index c3a7b2f..1b50817 100644 --- a/lib/UI.js +++ b/lib/UI.js @@ -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]) @@ -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(); @@ -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{