-
+
+
+
+
+
+
+
+ Item
+ Q1
+ Median
+ Q3
+ Percent
+
+
+
+
+
+
+ {{ r.name }}
+ |
+ {{ formatIsk(r.q1) }} |
+ {{ formatIsk(r.mmedian) }} |
+ {{ formatIsk(r.q3) }} |
+ {{ percentFormater.format(r.percent) }} |
+
+
+
+
+
\ No newline at end of file
diff --git a/src/market/index.ts b/src/market/index.ts
new file mode 100644
index 0000000..0354896
--- /dev/null
+++ b/src/market/index.ts
@@ -0,0 +1,2 @@
+export * from './market';
+
diff --git a/src/market/market.ts b/src/market/market.ts
new file mode 100644
index 0000000..5bb3af7
--- /dev/null
+++ b/src/market/market.ts
@@ -0,0 +1,59 @@
+import { esiAxiosInstance } from "@/service";
+
+export const jitaId = 10000002;
+
+export type MarketOrderHistory = {
+ average: number;
+ date: string;
+ highest: number;
+ lowest: number;
+ order_count: number;
+ volume: number;
+}
+
+export const getHistory = async (regionId: number, tyeId: number): Promise
=> (await esiAxiosInstance.get(`/markets/${regionId}/history/`, { params: { type_id: tyeId } })).data;
+
+export const getHistoryQuartils = async (regionId: number, tyeId: number): Promise<[number, number, number]> => {
+ const history = await getHistory(regionId, tyeId);
+ const volumes = history
+ .flatMap(h => {
+ const volume = h.volume;
+
+ if (volume === 0) {
+ return [];
+ }
+
+ const e = estimateVolume(h);
+
+ return [[h.highest, e], [h.lowest, volume - e]];
+ })
+ .filter(h => h[1] > 0)
+ .sort((a, b) => a[0] - b[0]);
+
+ const totalVolume = volumes.reduce((acc, [_, v]) => acc + v, 0);
+ const quartilVolume = totalVolume / 4;
+ const quartils: [number, number, number] = [0, 0, 0];
+
+ let currentVolume = 0;
+ let quartil = 0;
+
+ for (const [price, volume] of volumes) {
+ currentVolume += volume;
+
+ if (currentVolume >= quartilVolume * (quartil + 1)) {
+ quartils[quartil] = price;
+ if (quartil === 2) {
+ break;
+ }
+ quartil++;
+ }
+ }
+ return quartils;
+}
+
+const estimateVolume = (history: MarketOrderHistory): number => {
+ if (history.volume === 0) {
+ return 0;
+ }
+ return Math.max(1, Math.round(history.volume * ((history.average - history.lowest) / (history.highest - history.lowest))));
+}
\ No newline at end of file
diff --git a/src/market/type/MarketType.ts b/src/market/type/MarketType.ts
new file mode 100644
index 0000000..b7c9d02
--- /dev/null
+++ b/src/market/type/MarketType.ts
@@ -0,0 +1,16 @@
+import { apiAxiosInstance } from "@/service";
+
+export type MarketType = {
+ id: number;
+ group_id: number;
+ marketgroup_id: number;
+ name: string;
+ published: boolean;
+ description: string;
+ basePrice: number;
+ icon_id: number;
+ volume: number;
+ portionSize: number;
+}
+
+export const searchMarketType = async (name: string): Promise => (await apiAxiosInstance.post("/sde/types/search", [["name", name]])).data[0];
diff --git a/src/reprocess/ReprocessResultTable.vue b/src/reprocess/ReprocessResultTable.vue
index 87074c2..e0963e2 100644
--- a/src/reprocess/ReprocessResultTable.vue
+++ b/src/reprocess/ReprocessResultTable.vue
@@ -1,6 +1,7 @@
@@ -50,7 +49,10 @@ const copyToClipboard = (s: string) => navigator.clipboard.writeText(s);
- | {{ r.name }} |
+
+
+ {{ r.name }}
+ |
{{ formatIsk(useSellOrder ? r.sell : r.buy) }} |
{{ formatIsk(useSellOrder ? r.sell_reprocess : r.buy_reprocess) }} |
{{ percentFormater.format(useSellOrder ? r.sell_ratio : r.buy_ratio) }} |
diff --git a/src/reprocess/index.ts b/src/reprocess/index.ts
index c63556f..51202e3 100644
--- a/src/reprocess/index.ts
+++ b/src/reprocess/index.ts
@@ -1,2 +1,2 @@
-export { default as Reprocess } from './Reprocess.vue'
-export * from './reprocess'
+export * from './reprocess';
+
diff --git a/src/utils.ts b/src/utils.ts
new file mode 100644
index 0000000..e99fc39
--- /dev/null
+++ b/src/utils.ts
@@ -0,0 +1 @@
+export const copyToClipboard = (s: string) => navigator.clipboard.writeText(s);
\ No newline at end of file