]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git/blobdiff - cmd/web/js/poloniex.jsx
Display short positions.
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git] / cmd / web / js / poloniex.jsx
index 813a506a60d9af3e7a03426b4a1cd3577c32c08f..db6b1c43da71f123ec830dc8d6a8f89bffbe8146 100644 (file)
@@ -113,6 +113,10 @@ class PoloniexBalance extends React.Component {
     this.state = {'hideMsg': true, 'msg': '', 'msgOk': false};
   }
 
+  computeCurrencyRatio = (currency) => {
+    return (parseFloat(this.props.balance[currency].btcValue) / parseFloat(this.props.balanceValue) * 100.0).toFixed(1);
+  }
+
   render = () => {
     var dashboard = null;
 
@@ -120,16 +124,18 @@ class PoloniexBalance extends React.Component {
 
       var balance = Object.keys(this.props.balance).map(function(currency) {
         return <div key={currency}>
-                 <CurrencyLogo currency={currency} /> {this.props.balance[currency]}
+                 <div>
+                 <CurrencyLogo currency={currency} /> {this.props.balance[currency].amount} {currency} ({this.computeCurrencyRatio(currency)}%)
+                 </div>
                </div>;
       }.bind(this));
 
       dashboard =
         <div className="row">
-          <div className="col-4 align-self-center h-100 balances">
+          <div className="col-6 align-self-center h-100 balances">
               {balance}
           </div>
-          <div className="offset-1 col-7 h-100 align-self-center">
+          <div className="offset-1 col-5 h-100 align-self-center">
             <div className="text-center">
               Balance ({this.props.balanceCurrency}): <span>{this.props.balanceValue}</span><CurrencyLogo currency={this.props.balanceCurrency} />
             </div>