Skip to content

Commit

Permalink
Merge pull request #179 from Polygant/general_fixes
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
botjoker authored Nov 2, 2023
2 parents a973e82 + 8a3183b commit e3167b4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/mixins/getFixedDecimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ function addSpace(number) {
*/

function getFixedDecimal(val, precision = 8, toClosest = false) {
console.log(val, precision);
if (val === Infinity) debugger;
return val
? new Decimal(
new Decimal(val).toFixed(
Expand Down
26 changes: 17 additions & 9 deletions src/modules/trade/components/TradeGraphic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import localConfig from "~/local_config";
export default {
// eslint-disable-next-line vue/require-prop-types
props: ["precision"],
props: {
precision: {
type: Number,
required: true,
},
},
data() {
return {
tvWidget: null,
Expand Down Expand Up @@ -41,14 +46,17 @@ export default {
console.log(e);
}
},
precision(value) {
if (!value) return;
try {
this.setGraphColor();
this.makeChart();
} catch (e) {
console.log(e);
}
precision: {
immediate: true,
handler(value) {
if (!value) return;
try {
this.setGraphColor();
this.makeChart();
} catch (e) {
console.log(e);
}
},
},
currentTheme() {
this.setGraphColor();
Expand Down
8 changes: 5 additions & 3 deletions src/modules/trade/components/orders/Orders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@
:max-depth="sellOrders[0].depth"
:order="order"
:is-circle="order.owner"
:precision="precision"
:precision="Math.min(precision * 1, 0.01) || 0.01"
color="rgba(255, 93, 85, .3)"
@select="sellRowClick"
></orders-table-row>
</orders-table>

<orders-sell-buy :precision="precision"></orders-sell-buy>
<orders-sell-buy
:precision="Math.min(precision * 1, 0.01) || 0.01"
></orders-sell-buy>

<orders-table :type="'buy'">
<orders-table-row
Expand All @@ -55,7 +57,7 @@
:max-depth="buyOrders[buyOrders.length - 1].depth"
:order="order"
:is-circle="order.owner"
:precision="precision"
:precision="Math.min(precision * 1, 0.01) || 0.01"
color="rgba(31, 167, 114, .3)"
@select="buyRowClick"
></orders-table-row>
Expand Down
4 changes: 3 additions & 1 deletion src/modules/trade/pages/Trade.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
</div>
<div class="md:w-6/12 graphic-order xl:px-4">
<div class="graphic-order-wrapper">
<TradeGraphic :precision="savedPrecision" />
<TradeGraphic
:precision="Math.min(savedPrecision * 1, 0.01) || 0.01"
/>
</div>
<div>
<v-card>
Expand Down

0 comments on commit e3167b4

Please sign in to comment.