From 7f83ee2ee25bbc562712bbdcec4a39cc4ee20607 Mon Sep 17 00:00:00 2001 From: Sirttas Date: Mon, 2 Oct 2023 19:49:25 +0200 Subject: [PATCH] fix score --- src/market/appraisal.ts | 6 ++++-- src/market/scan/ScanResultTable.vue | 6 +++--- src/market/scan/scan.ts | 3 ++- src/pages/market/Scan.vue | 3 ++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/market/appraisal.ts b/src/market/appraisal.ts index 2abda26..8ecb4df 100644 --- a/src/market/appraisal.ts +++ b/src/market/appraisal.ts @@ -6,7 +6,8 @@ import { MarketType } from "./type"; export type MarketTypePrice = { type: MarketType; buy: number, - sell: number + sell: number, + orderCount: number } type MarketTypePriceCache = { @@ -31,7 +32,8 @@ export const useApraisalStore = defineStore('appraisal', () => { .map((item: any) => ({ type: types.find(t => t.name === item.typeName) as MarketType, buy: item.prices.buy.max, - sell: item.prices.sell.min + sell: item.prices.sell.min, + orderCount: item.prices.all.order_count })); } diff --git a/src/market/scan/ScanResultTable.vue b/src/market/scan/ScanResultTable.vue index ccfb620..e9aa7c5 100644 --- a/src/market/scan/ScanResultTable.vue +++ b/src/market/scan/ScanResultTable.vue @@ -46,7 +46,7 @@ const { sortedArray, headerProps } = useSort(computed(() => props.items .map(r => { const quartils = getHistoryQuartils(r.history, days.value); const profit = marketTaxStore.calculateProfit(quartils.q1, quartils.q3); - const score = profit <= 0 ? 0 : Math.sqrt(quartils.totalVolume * r.sell * profit / days.value); + const score = profit <= 0 ? 0 : Math.sqrt(quartils.totalVolume * r.sell * profit / Math.log(r.orderCount + 1)); return { type: r.type, @@ -61,8 +61,8 @@ const { sortedArray, headerProps } = useSort(computed(() => props.items score }; }).filter(r => !onlyCheap.value || (r.buy <= r.q1 && r.profit >= (threshold.value / 100)))), { - defaultSortKey: 'name', - defaultSortDirection: 'asc' + defaultSortKey: 'score', + defaultSortDirection: 'desc' }) const getLineColor = (result: Result) => { if (result.profit < (threshold.value / 100)) { diff --git a/src/market/scan/scan.ts b/src/market/scan/scan.ts index b6fb311..27cb5e3 100644 --- a/src/market/scan/scan.ts +++ b/src/market/scan/scan.ts @@ -8,7 +8,8 @@ export type ScanResult = { type: MarketType; history: MarketOrderHistory[]; buy: number, - sell: number + sell: number, + orderCount: number, } interface MarketScan extends RecordModel { diff --git a/src/pages/market/Scan.vue b/src/pages/market/Scan.vue index 97a9581..546acbb 100644 --- a/src/pages/market/Scan.vue +++ b/src/pages/market/Scan.vue @@ -22,7 +22,8 @@ const addOrRelaod = async (type: MarketType) => { type, history, buy: price.buy, - sell: price.sell + sell: price.sell, + orderCount: price.orderCount }; if (items.value.some(i => i.type.id === typeID)) {