feat(#9): Add button to filter acquisitions to unlisted stock

This commit is contained in:
Sirttas
2026-07-05 16:39:34 +02:00
parent fbe0861c29
commit 2a145bbbe7
6 changed files with 139 additions and 43 deletions
+24 -16
View File
@@ -233,6 +233,14 @@ paths:
"400": "400":
description: Returned when a line carries a quantity that is not a positive description: Returned when a line carries a quantity that is not a positive
whole number whole number
/market/history/refresh:
post:
tags:
- market-history-admin-controller
operationId: refresh_1
responses:
"202":
description: Accepted
/logout: /logout:
post: post:
tags: tags:
@@ -649,6 +657,22 @@ paths:
Returned when: Returned when:
- the types parameter is missing - the types parameter is missing
- a types value is not a numeric id - a types value is not a numeric id
/market/orders:
get:
tags:
- market
summary: List the open market orders across all characters owned by the authenticated
user
operationId: findAllMarketOrders
responses:
"200":
description: The authenticated user's open market orders
content:
'*/*':
schema:
type: array
items:
$ref: "#/components/schemas/MarketOrderResponse"
/market/history/quartiles: /market/history/quartiles:
get: get:
tags: tags:
@@ -691,22 +715,6 @@ paths:
- the types parameter is missing - the types parameter is missing
- a types value is not a numeric id - a types value is not a numeric id
- the days parameter is not greater than 0 - the days parameter is not greater than 0
/market-orders:
get:
tags:
- market-order
summary: List the open market orders across all characters owned by the authenticated
user
operationId: findAllMarketOrders
responses:
"200":
description: The authenticated user's open market orders
content:
'*/*':
schema:
type: array
items:
$ref: "#/components/schemas/MarketOrderResponse"
/ledgers: /ledgers:
get: get:
tags: tags:
+81 -25
View File
@@ -1949,6 +1949,36 @@ export const MarketApiAxiosParamCreator = function (configuration?: Configuratio
options: localVarRequestOptions, options: localVarRequestOptions,
}; };
}, },
/**
*
* @summary List the open market orders across all characters owned by the authenticated user
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findAllMarketOrders: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/market/orders`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Accept'] = '*/*';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/** /**
* *
* @summary Compute volume-weighted price quartiles and the recent price trend for each requested market type * @summary Compute volume-weighted price quartiles and the recent price trend for each requested market type
@@ -2299,6 +2329,18 @@ export const MarketApiFp = function(configuration?: Configuration) {
const localVarOperationServerBasePath = operationServerMap['MarketApi.currentPrices']?.[localVarOperationServerIndex]?.url; const localVarOperationServerBasePath = operationServerMap['MarketApi.currentPrices']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
}, },
/**
*
* @summary List the open market orders across all characters owned by the authenticated user
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async findAllMarketOrders(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<MarketOrderResponse>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.findAllMarketOrders(options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['MarketApi.findAllMarketOrders']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/** /**
* *
* @summary Compute volume-weighted price quartiles and the recent price trend for each requested market type * @summary Compute volume-weighted price quartiles and the recent price trend for each requested market type
@@ -2431,6 +2473,15 @@ export const MarketApiFactory = function (configuration?: Configuration, basePat
currentPrices(types: Array<number>, options?: RawAxiosRequestConfig): AxiosPromise<Array<MarketPriceResponse>> { currentPrices(types: Array<number>, options?: RawAxiosRequestConfig): AxiosPromise<Array<MarketPriceResponse>> {
return localVarFp.currentPrices(types, options).then((request) => request(axios, basePath)); return localVarFp.currentPrices(types, options).then((request) => request(axios, basePath));
}, },
/**
*
* @summary List the open market orders across all characters owned by the authenticated user
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findAllMarketOrders(options?: RawAxiosRequestConfig): AxiosPromise<Array<MarketOrderResponse>> {
return localVarFp.findAllMarketOrders(options).then((request) => request(axios, basePath));
},
/** /**
* *
* @summary Compute volume-weighted price quartiles and the recent price trend for each requested market type * @summary Compute volume-weighted price quartiles and the recent price trend for each requested market type
@@ -2538,6 +2589,16 @@ export class MarketApi extends BaseAPI {
return MarketApiFp(this.configuration).currentPrices(types, options).then((request) => request(this.axios, this.basePath)); return MarketApiFp(this.configuration).currentPrices(types, options).then((request) => request(this.axios, this.basePath));
} }
/**
*
* @summary List the open market orders across all characters owned by the authenticated user
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public findAllMarketOrders(options?: RawAxiosRequestConfig) {
return MarketApiFp(this.configuration).findAllMarketOrders(options).then((request) => request(this.axios, this.basePath));
}
/** /**
* *
* @summary Compute volume-weighted price quartiles and the recent price trend for each requested market type * @summary Compute volume-weighted price quartiles and the recent price trend for each requested market type
@@ -2639,18 +2700,17 @@ export class MarketApi extends BaseAPI {
/** /**
* MarketOrderApi - axios parameter creator * MarketHistoryAdminControllerApi - axios parameter creator
*/ */
export const MarketOrderApiAxiosParamCreator = function (configuration?: Configuration) { export const MarketHistoryAdminControllerApiAxiosParamCreator = function (configuration?: Configuration) {
return { return {
/** /**
* *
* @summary List the open market orders across all characters owned by the authenticated user
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
findAllMarketOrders: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { refresh1: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/market-orders`; const localVarPath = `/market/history/refresh`;
// use dummy base URL string because the URL constructor only accepts absolute URLs. // use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions; let baseOptions;
@@ -2658,11 +2718,10 @@ export const MarketOrderApiAxiosParamCreator = function (configuration?: Configu
baseOptions = configuration.baseOptions; baseOptions = configuration.baseOptions;
} }
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any; const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any; const localVarQueryParameter = {} as any;
localVarHeaderParameter['Accept'] = '*/*';
setSearchParams(localVarUrlObj, localVarQueryParameter); setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -2677,56 +2736,53 @@ export const MarketOrderApiAxiosParamCreator = function (configuration?: Configu
}; };
/** /**
* MarketOrderApi - functional programming interface * MarketHistoryAdminControllerApi - functional programming interface
*/ */
export const MarketOrderApiFp = function(configuration?: Configuration) { export const MarketHistoryAdminControllerApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = MarketOrderApiAxiosParamCreator(configuration) const localVarAxiosParamCreator = MarketHistoryAdminControllerApiAxiosParamCreator(configuration)
return { return {
/** /**
* *
* @summary List the open market orders across all characters owned by the authenticated user
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async findAllMarketOrders(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<MarketOrderResponse>>> { async refresh1(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.findAllMarketOrders(options); const localVarAxiosArgs = await localVarAxiosParamCreator.refresh1(options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['MarketOrderApi.findAllMarketOrders']?.[localVarOperationServerIndex]?.url; const localVarOperationServerBasePath = operationServerMap['MarketHistoryAdminControllerApi.refresh1']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
}, },
} }
}; };
/** /**
* MarketOrderApi - factory interface * MarketHistoryAdminControllerApi - factory interface
*/ */
export const MarketOrderApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { export const MarketHistoryAdminControllerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = MarketOrderApiFp(configuration) const localVarFp = MarketHistoryAdminControllerApiFp(configuration)
return { return {
/** /**
* *
* @summary List the open market orders across all characters owned by the authenticated user
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
findAllMarketOrders(options?: RawAxiosRequestConfig): AxiosPromise<Array<MarketOrderResponse>> { refresh1(options?: RawAxiosRequestConfig): AxiosPromise<void> {
return localVarFp.findAllMarketOrders(options).then((request) => request(axios, basePath)); return localVarFp.refresh1(options).then((request) => request(axios, basePath));
}, },
}; };
}; };
/** /**
* MarketOrderApi - object-oriented interface * MarketHistoryAdminControllerApi - object-oriented interface
*/ */
export class MarketOrderApi extends BaseAPI { export class MarketHistoryAdminControllerApi extends BaseAPI {
/** /**
* *
* @summary List the open market orders across all characters owned by the authenticated user
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
public findAllMarketOrders(options?: RawAxiosRequestConfig) { public refresh1(options?: RawAxiosRequestConfig) {
return MarketOrderApiFp(this.configuration).findAllMarketOrders(options).then((request) => request(this.axios, this.basePath)); return MarketHistoryAdminControllerApiFp(this.configuration).refresh1(options).then((request) => request(this.axios, this.basePath));
} }
} }
@@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import {SliderCheckbox} from '@/components';
import {SortableHeader, useSort, VirtualScrollTable} from '@/components/table'; import {SortableHeader, useSort, VirtualScrollTable} from '@/components/table';
import {MarketType, MarketTypeLabel, TaxInput, useMarketTaxStore} from "@/market"; import {MarketType, MarketTypeLabel, TaxInput, useMarketOrdersStore, useMarketTaxStore} from "@/market";
import {MinusIcon, PlusIcon} from '@heroicons/vue/24/outline'; import {MinusIcon, PlusIcon} 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';
@@ -65,11 +66,16 @@ const columnsToIgnore = computed(() => {
const marketTaxStore = useMarketTaxStore(); const marketTaxStore = useMarketTaxStore();
const ledgersStore = useLedgersStore(); const ledgersStore = useLedgersStore();
const marketOrdersStore = useMarketOrdersStore();
const threshold = useStorage('market-acquisition-threshold', 10); const threshold = useStorage('market-acquisition-threshold', 10);
const filter = ref(""); const filter = ref("");
const unlistedOnly = ref(false);
const matchesFilter = (r: AcquiredType) =>
r.type.name.toLowerCase().includes(filter.value.toLowerCase())
&& (!unlistedOnly.value || !marketOrdersStore.listedTypeIds.has(r.type.id));
const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() => { const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() => {
const filteredItems = props.items.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase())); const filteredItems = props.items.filter(matchesFilter);
if (props.showAll) { if (props.showAll) {
return filteredItems.map(r => { return filteredItems.map(r => {
@@ -172,6 +178,9 @@ const total = computed(() => {
<div class="flex" v-if="!infoOnly"> <div class="flex" v-if="!infoOnly">
<div class="flex justify-self-end mb-2 mt-4 ms-auto"> <div class="flex justify-self-end mb-2 mt-4 ms-auto">
<TaxInput /> <TaxInput />
<div class="end flex items-center" title="Show only acquisitions with no open sell order">
<SliderCheckbox class="me-1" v-model="unlistedOnly" /> Unlisted only
</div>
<div class="end"> <div class="end">
<span>Profit Threshold: </span> <span>Profit Threshold: </span>
<input type="number" min="0" max="1000" step="1" v-model="threshold" /> <input type="number" min="0" max="1000" step="1" v-model="threshold" />
+1
View File
@@ -1,5 +1,6 @@
export * from './RegionalMarketCache'; export * from './RegionalMarketCache';
export * from './history'; export * from './history';
export * from './order';
export * from './tax'; export * from './tax';
export * from './type'; export * from './type';
+1
View File
@@ -0,0 +1 @@
export * from './order';
+21
View File
@@ -0,0 +1,21 @@
import {defineStore} from "pinia";
import {computed, ref} from "vue";
import {marketApi} from "@/mammon";
import {MarketOrderResponse, MarketOrderResponseDirectionEnum} from "@/generated/mammon";
export const useMarketOrdersStore = defineStore('market-orders', () => {
const orders = ref<MarketOrderResponse[]>([]);
const listedTypeIds = computed(() => new Set(
orders.value
.filter(o => o.direction === MarketOrderResponseDirectionEnum.Sell)
.map(o => o.marketTypeId)
));
const refresh = () => marketApi.findAllMarketOrders()
.then(response => orders.value = response.data);
refresh();
return {orders, listedTypeIds, refresh};
});