-
Executed benefits over bought items. Only open orders
+
Executed benefits over bought items. Only current open orders
+
+
+
+
+
+
+
+
+
+ {{ scope.row.price | toCurrency(scope.row.ticker.currency) }}
+
+
+
+
+ {{ scope.row.cost | toCurrency(scope.row.ticker.currency) }}
+
+
+
+
+ {{ scope.row.transaction.currency_rate | toCurrency(scope.row.ticker.currency) }}
+
+
+
+
+
+
+
+
+
+
@@ -118,7 +153,7 @@
- {{ scope.row.current_price | toCurrency(scope.row.ticker.currency) }}
+ {{ scope.row.market.price | toCurrency(scope.row.ticker.currency) }}
@@ -131,17 +166,21 @@
{{ scope.row.win_lose | toCurrency(base_currency) }}
-
+
- {{ scope.row.price_change_percent | round(2) }}%
+ {{ scope.row.market.price_change | round(2) }}%
-
+
- {{ scope.row.current_pre | toCurrency(scope.row.ticker.currency) }}
+ {{ scope.row.market.pre | toCurrency(scope.row.ticker.currency) }}
+
+
+
+
+ {{ scope.row.market.pre_change | round(2) }}%
-
@@ -173,7 +212,7 @@
+ :cell-class-name="colorClass">
@@ -210,6 +249,7 @@ import {Table, TableColumn, Tabs, TabPane, Popover} from 'element-ui';
import axios from "axios";
import StatsCard from "../../../UIComponents/Cards/StatsCard";
import ChartCard from 'src/components/UIComponents/Cards/ChartCard';
+import VueTradingView from 'vue-trading-view/src/vue-trading-view';
const tooltipOptions = {
tooltipFillColor: "rgba(0,0,0,0.5)",
@@ -231,7 +271,7 @@ export default {
name: "Wallet",
components: {
Table, TableColumn, StatsCard, ChartCard, Tabs, TabPane,
- [Popover.name]: Popover,
+ [Popover.name]: Popover, VueTradingView
},
data() {
return {
@@ -244,6 +284,7 @@ export default {
total_cost: 0,
current_benefits_percent: 0,
benefits_percent: 0,
+ base_previous_value: 0,
investKey: 0,
investChart: {
labels: [],
@@ -285,9 +326,9 @@ export default {
createInvestChart(wallet_value) {
this.investChart.labels = this.wallet.map(el => el.ticker.ticker);
this.investChart.datasets[0].backgroundColor = this.wallet.map(function (el) {
- var r = Math.floor(Math.random() * 255);
- var g = Math.floor(Math.random() * 255);
- var b = Math.floor(Math.random() * 255);
+ let r = Math.floor(Math.random() * 255);
+ let g = Math.floor(Math.random() * 255);
+ let b = Math.floor(Math.random() * 255);
return "rgb(" + r + "," + g + "," + b + ")";
});
@@ -296,17 +337,22 @@ export default {
},
fillWallet(res) {
this.wallet = res.data;
- var vm = this;
+ let vm = this;
this.wallet = []
this.total_cost = 0;
this.total_current_benefits = 0; // taking into account if we sell the wallet right now
this.total_benefits = 0;
this.total_value = 0;
+ this.base_previous_value = 0;
let bar = new Promise((resolve, reject) => {
res.data.forEach(function (t, index, array) {
t.children = t.open_orders;
t['win_lose'] = t.current_benefit;
+ t.symbol = t.ticker.ticker;
+ t.container_id = t.ticker.ticker;
+ t.style = "3";
+ t.break_even = t.break_even * vm.fx_rate;
t.children.forEach(function (c) {
c.ticker = {
@@ -323,6 +369,7 @@ export default {
vm.total_benefits += t.benefits;
vm.total_current_benefits += t.current_benefit;
vm.total_value += t.base_current_value;
+ vm.base_previous_value += t.base_previous_value;
if (index === array.length - 1) resolve();
});
@@ -345,10 +392,17 @@ export default {
await axios.get(process.env.VUE_APP_BACKEND_URL + "/stock/fx_rate").then(this.fillFxRate);
await axios.get(process.env.VUE_APP_BACKEND_URL + "/stock/wallet").then(this.fillWallet);
},
- testClass(item) {
- if (item.column.property == 'pre_price_change_percent' || item.column.property == 'current_price_change_percent'
+ colorClass(item) {
+ if (item.column.property == 'market.price_change' || item.column.property == 'market.pre_change'
|| item.column.property == 'win_lose') {
- if (parseInt(item.row[item.column.property]) > 0)
+ let objects = item.column.property.split('.')
+ let value = 0;
+ if (objects.length > 1){
+ value = objects.reduce((a, prop) => a[prop], item.row);
+ } else {
+ value = item.row[item.column.property]
+ }
+ if (parseFloat(value) > 0)
return "green";
else
return "red"
diff --git a/frontend/src/components/Dashboard/Views/Broker/Orders.vue b/frontend/src/components/Dashboard/Views/Broker/Orders.vue
index f2b2593..93cbc96 100644
--- a/frontend/src/components/Dashboard/Views/Broker/Orders.vue
+++ b/frontend/src/components/Dashboard/Views/Broker/Orders.vue
@@ -59,12 +59,12 @@
filter-placement="bottom-end"
>
-
+
- {{ scope.row.price | toCurrency(scope.row.currency) }}
+ {{ scope.row.price | toCurrency(scope.row.ticker.currency) }}
@@ -78,7 +78,7 @@
- {{scope.row.total | toCurrency(scope.row.currency)}}
+ {{scope.row.total | toCurrency(scope.row.ticker.currency)}}
@@ -178,9 +178,9 @@ export default {
this.orders.forEach(function (s) {
s.value_date = s.value_date.split(' ')[0];
s.total = s.shares * s.price;
- if (s.type == 0) {
+ if (s.type === 0) {
s.type = "Buy";
- s.cost = s.total - s.fee - s.exchange_fee;
+ s.cost = s.total * s.currency_rate - s.fee - s.exchange_fee;
} else {
s.type = "Sell";
s.cost = s.total * s.currency_rate + s.fee + s.exchange_fee;
diff --git a/frontend/src/components/Dashboard/Views/Broker/Tax.vue b/frontend/src/components/Dashboard/Views/Broker/Tax.vue
index 45b5894..960f70e 100644
--- a/frontend/src/components/Dashboard/Views/Broker/Tax.vue
+++ b/frontend/src/components/Dashboard/Views/Broker/Tax.vue
@@ -45,7 +45,7 @@
@@ -123,7 +123,6 @@ export default {
},
methods: {
fillTaxes(res) {
- let resStatus = res.status === 200;
this.closedOrders = res.data;
this.benefits = 0;
this.fees = 0;
@@ -153,9 +152,8 @@ export default {
async getData() {
await axios.get(process.env.VUE_APP_BACKEND_URL + "/stock/tax?year=" + this.tax_year).then(this.fillTaxes);
},
- testClass(item) {
- if (item.column.property == 'pre_price_change_percent' || item.column.property == 'current_price_change_percent'
- || item.column.property == 'win_lose') {
+ colorClass(item) {
+ if (item.column.property == 'benefits') {
if (parseInt(item.row[item.column.property]) > 0)
return "green";
else
diff --git a/frontend/src/components/Dashboard/Views/Crypto/CryptoBalance.vue b/frontend/src/components/Dashboard/Views/Crypto/CryptoBalance.vue
index 711c32c..e131be6 100644
--- a/frontend/src/components/Dashboard/Views/Crypto/CryptoBalance.vue
+++ b/frontend/src/components/Dashboard/Views/Crypto/CryptoBalance.vue
@@ -20,11 +20,21 @@
-
-
+
+
+
Current wallet value. Benefits vs cost and benefits from previous day
+
+
+
+
+
+
+
+
@@ -47,19 +57,19 @@
+ :cell-class-name="colorClass" :cell-style="{padding: '0', height: '20px'}">
- {{ scope.row.amount | toCurrency(scope.row.currency, 8) }}
+ {{ scope.row.amount | toCurrency(undefined, 8) }}
-
+
{{ scope.row.price | toCurrency(scope.row.current_price_currency, 8) }}
-
+
{{ scope.row.cost | toCurrency(scope.row.current_price_currency, 8) }}
@@ -69,6 +79,16 @@
{{ scope.row.current_price | toCurrency(scope.row.current_price_currency, 8) }}
+
+
+ {{ scope.row.current_value | toCurrency(scope.row.current_price_currency, 8) }}
+
+
+
+
+ {{ scope.row.current_benefit | toCurrency(scope.row.current_price_currency, 8) }}
+
+
@@ -100,7 +120,7 @@
+ :cell-class-name="colorClass">
@@ -120,7 +140,7 @@