Skip to content

Commit

Permalink
refactor: rename stats to metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
kibotrel committed Apr 21, 2022
1 parent 6102bc1 commit cfd13ba
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion apps/api/src/routes/user/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default async (req, res, next) => {
username,
linkingpublickey,
},
stats: {
metrics: {
transactions: {
deposits: total_deposit_success_count,
withdrawals: total_withdraw_success_count,
Expand Down
26 changes: 13 additions & 13 deletions apps/front/src/store/user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const defaultState = () => {
username: '',
linkingpublickey: '',
},
stats: {
metrics: {
transactions: {
deposits: 0,
withdrawals: 0,
Expand Down Expand Up @@ -62,11 +62,11 @@ export default {
},
WITHDRAW_SUCCESS(state, amount) {
state.account.available_balance -= parseInt(amount)
state.stats.transactions.withdrawals += 1
state.metrics.transactions.withdrawals += 1
},
DEPOSIT_SUCCESS(state, amount) {
state.account.available_balance += parseInt(amount)
state.stats.transactions.deposits += 1
state.metrics.transactions.deposits += 1
},
},
getters: {
Expand All @@ -76,27 +76,27 @@ export default {

positionsCount: (state) => {
return (
state.stats.futures.running.positions +
state.stats.futures.opened.positions +
state.stats.futures.closed.positions +
state.stats.futures.canceled.positions +
state.stats.options.running.positions +
state.stats.options.closed.positions
state.metrics.futures.running.positions +
state.metrics.futures.opened.positions +
state.metrics.futures.closed.positions +
state.metrics.futures.canceled.positions +
state.metrics.options.running.positions +
state.metrics.options.closed.positions
)
},

globalQuantity: (state, getters, rootState, rootGetters) => {
return (
state.stats.futures.opened.quantity +
state.stats.futures.running.quantity +
state.metrics.futures.opened.quantity +
state.metrics.futures.running.quantity +
rootGetters['options/computeDelta']
)
},

usedMargin: (state, getters, rootState, rootGetters) => {
return (
state.stats.futures.opened.margin +
state.stats.futures.running.margin +
state.metrics.futures.opened.margin +
state.metrics.futures.running.margin +
rootGetters['options/usedMargin']
)
},
Expand Down
4 changes: 2 additions & 2 deletions apps/front/src/views/profile/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export default {
const store = useStore()
return {
username: computed(() => store.state.user.account.username),
deposits: computed(() => store.state.user.stats.transactions.deposits),
deposits: computed(() => store.state.user.metrics.transactions.deposits),
withdrawals: computed(
() => store.state.user.stats.transactions.withdrawals
() => store.state.user.metrics.transactions.withdrawals
),
positions: computed(() => store.getters['user/positionsCount']),
}
Expand Down
4 changes: 2 additions & 2 deletions apps/front/src/views/profile/Risk.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ export default {
quantity_global: computed(() => store.getters['user/globalQuantity']),
quantity_futures: computed(
() =>
store.state.user.stats.futures.opened.quantity +
store.state.user.stats.futures.running.quantity
store.state.user.metrics.futures.opened.quantity +
store.state.user.metrics.futures.running.quantity
),
quantity_options: computed(() => store.getters['options/computeDelta']),
}
Expand Down

0 comments on commit cfd13ba

Please sign in to comment.