feat: add colored diff % on table
Signed-off-by: Ameya Shenoy <shenoy.ameya@gmail.com>
This commit is contained in:
parent
2b9bfd1ddb
commit
d921cf521f
2 changed files with 14 additions and 1 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
// TODO: fix baseurl as per builds
|
|
||||||
const getAPI = axios.create({
|
const getAPI = axios.create({
|
||||||
baseURL: 'http://localhost:8000',
|
baseURL: 'http://localhost:8000',
|
||||||
timeout: 60000,
|
timeout: 60000,
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,14 @@
|
||||||
>
|
>
|
||||||
<template v-slot:top>
|
<template v-slot:top>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-slot:item.diff_percent="{ item }">
|
||||||
|
<v-chip
|
||||||
|
:color="getColor(item)"
|
||||||
|
outlined
|
||||||
|
>
|
||||||
|
{{ +parseFloat(( item.close_price - item.open_price ) * 100 / item.open_price).toFixed(2) }}
|
||||||
|
</v-chip>
|
||||||
|
</template>
|
||||||
</v-data-table>
|
</v-data-table>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -108,6 +116,11 @@
|
||||||
export default {
|
export default {
|
||||||
name: 'BhavStock',
|
name: 'BhavStock',
|
||||||
methods: {
|
methods: {
|
||||||
|
getColor (stock) {
|
||||||
|
if (stock.close_price > stock.open_price) return 'green'
|
||||||
|
else if (stock.close_price == stock.open_price) return 'black'
|
||||||
|
else return 'red'
|
||||||
|
},
|
||||||
downloadcsv() {
|
downloadcsv() {
|
||||||
var table_data = this.$refs["bhavCopyTable"];
|
var table_data = this.$refs["bhavCopyTable"];
|
||||||
var searchField = this.$refs["searchField"];
|
var searchField = this.$refs["searchField"];
|
||||||
|
|
@ -203,6 +216,7 @@
|
||||||
{text: 'High', value: 'high_price'},
|
{text: 'High', value: 'high_price'},
|
||||||
{text: 'Low', value: 'low_price'},
|
{text: 'Low', value: 'low_price'},
|
||||||
{text: 'Close', value: 'close_price'},
|
{text: 'Close', value: 'close_price'},
|
||||||
|
{ text: 'Diff (%)', value: 'diff_percent' },
|
||||||
{text: 'Last', value: 'last_price'},
|
{text: 'Last', value: 'last_price'},
|
||||||
{text: 'Previous Close', value: 'prevclose_price'},
|
{text: 'Previous Close', value: 'prevclose_price'},
|
||||||
{text: 'No. of Trades', value: 'no_trades'},
|
{text: 'No. of Trades', value: 'no_trades'},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue