Pair summary -> script setup

This commit is contained in:
Matthias 2023-02-27 20:21:45 +01:00
parent 0d59031d72
commit d09dc48944

View File

@ -25,12 +25,12 @@
</b-list-group> </b-list-group>
</template> </template>
<script lang="ts"> <script setup lang="ts">
import { formatPercent, timestampms } from '@/shared/formatters'; import { formatPercent, timestampms } from '@/shared/formatters';
import { Lock, Trade } from '@/types'; import { Lock, Trade } from '@/types';
import TradeProfit from '@/components/ftbot/TradeProfit.vue'; import TradeProfit from '@/components/ftbot/TradeProfit.vue';
import ProfitPill from '@/components/general/ProfitPill.vue'; import ProfitPill from '@/components/general/ProfitPill.vue';
import { defineComponent, computed } from 'vue'; import { computed } from 'vue';
import { useBotStore } from '@/stores/ftbotwrapper'; import { useBotStore } from '@/stores/ftbotwrapper';
interface CombinedPairList { interface CombinedPairList {
@ -44,20 +44,16 @@ interface CombinedPairList {
tradeCount: number; tradeCount: number;
} }
export default defineComponent({ const props = defineProps({
name: 'PairSummary',
components: { TradeProfit, ProfitPill },
props: {
// TOOD: Should be string list // TOOD: Should be string list
pairlist: { required: true, type: Array as () => string[] }, pairlist: { required: true, type: Array as () => string[] },
currentLocks: { required: false, type: Array as () => Lock[], default: () => [] }, currentLocks: { required: false, type: Array as () => Lock[], default: () => [] },
trades: { required: true, type: Array as () => Trade[] }, trades: { required: true, type: Array as () => Trade[] },
sortMethod: { default: 'normal', type: String }, sortMethod: { default: 'normal', type: String },
backtestMode: { required: false, default: false, type: Boolean }, backtestMode: { required: false, default: false, type: Boolean },
}, });
setup(props) { const botStore = useBotStore();
const botStore = useBotStore(); const combinedPairList = computed(() => {
const combinedPairList = computed(() => {
const comb: CombinedPairList[] = []; const comb: CombinedPairList[] = [];
props.pairlist.forEach((pair) => { props.pairlist.forEach((pair) => {
@ -117,8 +113,8 @@ export default defineComponent({
}); });
} }
return comb; return comb;
}); });
const tableFields = computed(() => { const tableFields = computed(() => {
return [ return [
{ key: 'pair', label: 'Pair' }, { key: 'pair', label: 'Pair' },
{ {
@ -132,13 +128,6 @@ export default defineComponent({
formatter: (value) => formatPercent(value, 3), formatter: (value) => formatPercent(value, 3),
}, },
]; ];
});
return {
combinedPairList,
tableFields,
botStore,
};
},
}); });
</script> </script>