Compare commits
1 Commits
c77a6ff811
...
feature/pr
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d57345634 |
@@ -67,7 +67,7 @@ export const useAcquiredTypesStore = defineStore('market-acquisition', () => {
|
|||||||
await marbasAxiosInstance.put(`${endpoint}${item.id}/`, item);
|
await marbasAxiosInstance.put(`${endpoint}${item.id}/`, item);
|
||||||
log.info(`Acquired type ${item.id} remaining: ${item.remaining}`, item);
|
log.info(`Acquired type ${item.id} remaining: ${item.remaining}`, item);
|
||||||
};
|
};
|
||||||
|
|
||||||
marbasAxiosInstance.get<RawMarbasAcquiredType[]>(endpoint).then(res => acquiredTypes.value = res.data.map(mapRawMarbasAcquiredType));
|
marbasAxiosInstance.get<RawMarbasAcquiredType[]>(endpoint).then(res => acquiredTypes.value = res.data.map(mapRawMarbasAcquiredType));
|
||||||
|
|
||||||
return { acquiredTypes: types, addAcquiredType, removeAcquiredType };
|
return { acquiredTypes: types, addAcquiredType, removeAcquiredType };
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { getHistoryQuartils, MarketType, MarketTypeLabel, TaxInput, useMarketTax
|
|||||||
import { BookmarkSlashIcon, ShoppingCartIcon } from '@heroicons/vue/24/outline';
|
import { BookmarkSlashIcon, ShoppingCartIcon } from '@heroicons/vue/24/outline';
|
||||||
import { useStorage } from '@vueuse/core';
|
import { useStorage } from '@vueuse/core';
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useAcquiredTypesStore } from '../acquisition';
|
|
||||||
import { TrackingResult } from './tracking';
|
import { TrackingResult } from './tracking';
|
||||||
|
|
||||||
type Result = {
|
type Result = {
|
||||||
@@ -18,7 +17,6 @@ type Result = {
|
|||||||
q1: number;
|
q1: number;
|
||||||
median: number;
|
median: number;
|
||||||
q3: number;
|
q3: number;
|
||||||
acquisitions: number;
|
|
||||||
profit: number;
|
profit: number;
|
||||||
score: number;
|
score: number;
|
||||||
}
|
}
|
||||||
@@ -46,7 +44,6 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
defineEmits<Emits>();
|
defineEmits<Emits>();
|
||||||
|
|
||||||
const marketTaxStore = useMarketTaxStore();
|
const marketTaxStore = useMarketTaxStore();
|
||||||
const acquiredTypesStore = useAcquiredTypesStore();
|
|
||||||
|
|
||||||
const days = useStorage('market-tracking-days', 365);
|
const days = useStorage('market-tracking-days', 365);
|
||||||
const threshold = useStorage('market-tracking-threshold', 10);
|
const threshold = useStorage('market-tracking-threshold', 10);
|
||||||
@@ -66,9 +63,6 @@ const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() =>
|
|||||||
const quartils = getHistoryQuartils(r.history, days.value);
|
const quartils = getHistoryQuartils(r.history, days.value);
|
||||||
const profit = quartils.q1 === 0 || quartils.q3 === 0 ? 0 : marketTaxStore.calculateProfit(quartils.q1, quartils.q3);
|
const profit = quartils.q1 === 0 || quartils.q3 === 0 ? 0 : marketTaxStore.calculateProfit(quartils.q1, quartils.q3);
|
||||||
const score = profit <= 0 ? 0 : Math.sqrt((Math.pow(quartils.totalVolume, 1.1) * Math.pow(quartils.q1, 1.2) * Math.pow(profit, 0.5) * Math.pow(Math.max(1, r.orderCount), -0.7)) / days.value);
|
const score = profit <= 0 ? 0 : Math.sqrt((Math.pow(quartils.totalVolume, 1.1) * Math.pow(quartils.q1, 1.2) * Math.pow(profit, 0.5) * Math.pow(Math.max(1, r.orderCount), -0.7)) / days.value);
|
||||||
const acquisitions = columnsToIgnore.value.includes('acquisitions') ? 0 : acquiredTypesStore.acquiredTypes
|
|
||||||
.filter(t => t.type === r.type.id)
|
|
||||||
.reduce((a, b) => a + b.remaining, 0);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: r.type,
|
type: r.type,
|
||||||
@@ -79,7 +73,6 @@ const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() =>
|
|||||||
q1: quartils.q1,
|
q1: quartils.q1,
|
||||||
median: quartils.median,
|
median: quartils.median,
|
||||||
q3: quartils.q3,
|
q3: quartils.q3,
|
||||||
acquisitions,
|
|
||||||
profit,
|
profit,
|
||||||
score
|
score
|
||||||
};
|
};
|
||||||
@@ -135,7 +128,6 @@ const getLineColor = (result: Result) => {
|
|||||||
<SortableHeader v-bind="headerProps" sortKey="q3">Q3</SortableHeader>
|
<SortableHeader v-bind="headerProps" sortKey="q3">Q3</SortableHeader>
|
||||||
<SortableHeader v-bind="headerProps" sortKey="profit">Profit</SortableHeader>
|
<SortableHeader v-bind="headerProps" sortKey="profit">Profit</SortableHeader>
|
||||||
<SortableHeader v-bind="headerProps" sortKey="score">Score</SortableHeader>
|
<SortableHeader v-bind="headerProps" sortKey="score">Score</SortableHeader>
|
||||||
<SortableHeader v-bind="headerProps" sortKey="acquisitions">Acquisitions</SortableHeader>
|
|
||||||
<SortableHeader v-bind="headerProps" sortKey="buttons" unsortable />
|
<SortableHeader v-bind="headerProps" sortKey="buttons" unsortable />
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -151,7 +143,6 @@ const getLineColor = (result: Result) => {
|
|||||||
<td v-if="showColumn('q3')" class="text-right">{{ formatIsk(r.data.q3) }}</td>
|
<td v-if="showColumn('q3')" class="text-right">{{ formatIsk(r.data.q3) }}</td>
|
||||||
<td v-if="showColumn('profit')" class="text-right">{{ percentFormater.format(r.data.profit) }}</td>
|
<td v-if="showColumn('profit')" class="text-right">{{ percentFormater.format(r.data.profit) }}</td>
|
||||||
<td v-if="showColumn('score')" class="text-right">{{ scoreFormater.format(r.data.score) }}</td>
|
<td v-if="showColumn('score')" class="text-right">{{ scoreFormater.format(r.data.score) }}</td>
|
||||||
<td v-if="showColumn('acquisitions')" class="text-right">{{ r.data.acquisitions }}</td>
|
|
||||||
<td v-if="showColumn('buttons')" class="text-right">
|
<td v-if="showColumn('buttons')" class="text-right">
|
||||||
<button class="btn-icon me-1" title="Add acquisitions" @click="$emit('buy', r.data.type, r.data.buy, r.data.sell)"><ShoppingCartIcon /></button>
|
<button class="btn-icon me-1" title="Add acquisitions" @click="$emit('buy', r.data.type, r.data.buy, r.data.sell)"><ShoppingCartIcon /></button>
|
||||||
<button class="btn-icon me-1" title="Untrack" @click="$emit('remove', r.data.type)"><BookmarkSlashIcon /></button>
|
<button class="btn-icon me-1" title="Untrack" @click="$emit('remove', r.data.type)"><BookmarkSlashIcon /></button>
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ watch(useRoute(), async route => {
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="result" class="mb-4">
|
<div v-if="result" class="mb-4">
|
||||||
<span>Market Info:</span>
|
<span>Market Info:</span>
|
||||||
<TrackingResultTable :items="[result]" infoOnly :ignoredColums="['name', 'acquisitions']" />
|
<TrackingResultTable :items="[result]" infoOnly ignoredColums="name" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="acquisitions && acquisitions.length > 0">
|
<div v-if="acquisitions && acquisitions.length > 0">
|
||||||
<span>Acquisitions:</span>
|
<span>Acquisitions:</span>
|
||||||
|
|||||||
22
src/preferences/Preference.ts
Normal file
22
src/preferences/Preference.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
export class Preference<T> {
|
||||||
|
private key: string;
|
||||||
|
private description: string;
|
||||||
|
private value?: T;
|
||||||
|
private defaultValue?: T;
|
||||||
|
|
||||||
|
constructor(key: string, description: string, defaultValue?: T) {
|
||||||
|
this.key = key;
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.value = this.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
private load() {
|
||||||
|
const value = localStorage.getItem(this.key);
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
return JSON.parse(value);
|
||||||
|
}
|
||||||
|
return this.defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
0
src/preferences/index.ts
Normal file
0
src/preferences/index.ts
Normal file
Reference in New Issue
Block a user