Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Decimal missing #1638

Merged
merged 10 commits into from
Jul 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
total profit decimal place
  • Loading branch information
McSam authored and McSam committed Jun 28, 2019
commit ce39c3e3a22b35badef21c6e4caa39c6a60c3366
3 changes: 2 additions & 1 deletion src/botPage/bot/Interface/MiscInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export default Interface =>
notifyTelegram: this.notifyTelegram,
getTotalRuns : () => this.tradeEngine.getTotalRuns(),
getBalance : type => this.tradeEngine.getBalance(type),
getTotalProfit: () => this.tradeEngine.getTotalProfit(),
getTotalProfit: (...args) =>
this.tradeEngine.getTotalProfit(...args, this.tradeEngine.tradeOptions.currency),
};
}
};
9 changes: 7 additions & 2 deletions src/botPage/bot/TradeEngine/Total.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,14 @@ export default Engine =>
const accountStat = this.getAccountStat();
return accountStat.totalRuns;
}
getTotalProfit() {
getTotalProfit(toString = false, currency) {
const accountStat = this.getAccountStat();
return Number(accountStat.totalProfit);
return toString
? roundBalance({
currency,
balance: +accountStat.totalProfit,
})
: +accountStat.totalProfit;
}
/* eslint-enable */
checkLimits(tradeOption) {
Expand Down
13 changes: 12 additions & 1 deletion src/botPage/view/blockly/blocks/tools/total_profit.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,15 @@ Blockly.Blocks.total_profit = {
this.setHelpUrl('https://github.com/binary-com/binary-bot/wiki');
},
};
Blockly.JavaScript.total_profit = () => ['Bot.getTotalProfit()', Blockly.JavaScript.ORDER_ATOMIC];
Blockly.JavaScript.total_profit = () => ['Bot.getTotalProfit(false)', Blockly.JavaScript.ORDER_ATOMIC];

Blockly.Blocks.total_profit_string = {
init: function init() {
this.appendDummyInput().appendField(translate('Total Profit String'));
this.setOutput(true, 'String');
this.setColour('#dedede');
this.setTooltip(translate('Return the total profit (String)'));
this.setHelpUrl('https://github.com/binary-com/binary-bot/wiki');
},
};
Blockly.JavaScript.total_profit_string = () => ['Bot.getTotalProfit(true)', Blockly.JavaScript.ORDER_ATOMIC];
1 change: 1 addition & 0 deletions static/xml/toolbox.xml
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@
<category name="Misc." i18n-text="Misc.">
<block type="balance"></block>
<block type="total_profit"></block>
<block type="total_profit_string"></block>
<block type="total_runs"></block>
<block type="notify">
<field name="NOTIFICATION_TYPE">success</field>
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy