Compare commits

..
4 Commits
5 changed files with 182 additions and 158 deletions

No files matched your search

+7 -12
View File
@@ -959,7 +959,7 @@ paths:
/ledgers/{ledgerId}/profit: /ledgers/{ledgerId}/profit:
get: get:
tags: tags:
- transaction - profit
summary: Get the daily profit series for a single ledger summary: Get the daily profit series for a single ledger
operationId: profitPerDayInLedger operationId: profitPerDayInLedger
parameters: parameters:
@@ -987,8 +987,8 @@ paths:
/ledgers/{ledgerId}/margin: /ledgers/{ledgerId}/margin:
get: get:
tags: tags:
- transaction - profit
summary: Get the daily FIFO-realized profit series for a single ledger summary: Get the daily FIFO-realized margin series for a single ledger
operationId: marginPerDayInLedger operationId: marginPerDayInLedger
parameters: parameters:
- name: ledgerId - name: ledgerId
@@ -1000,10 +1000,10 @@ paths:
format: uuid format: uuid
responses: responses:
"200": "200":
description: "Daily FIFO-realized profit for the ledger, ascending by date,\ description: "Daily FIFO-realized margin for the ledger, ascending by date,\
\ only for days with a sale. iskIn is the sum of that day's profitable\ \ only for days with a consumption. iskIn is the sum of that day's profitable\
\ trades, iskOut is the sum of that day's losing trades (as a positive\ \ consumptions, iskOut is the sum of that day's losing consumptions (as\
\ deficit); profit is iskIn minus iskOut." \ a positive deficit); profit is iskIn minus iskOut."
content: content:
'*/*': '*/*':
schema: schema:
@@ -2310,10 +2310,6 @@ components:
format: uuid format: uuid
description: Ledger the acquisition is held in. description: Ledger the acquisition is held in.
example: 3fa85f64-5717-4562-b3fc-2c963f66afa6 example: 3fa85f64-5717-4562-b3fc-2c963f66afa6
source:
$ref: "#/components/schemas/ActivitySourceResponse"
description: "Where the acquisition came from: a character, a corporation,\
\ or nothing."
marketTypeId: marketTypeId:
type: integer type: integer
format: int64 format: int64
@@ -2345,5 +2341,4 @@ components:
- marketTypeId - marketTypeId
- quantity - quantity
- remaining - remaining
- source
- unitCost - unitCost
+169 -140
View File
@@ -35,10 +35,6 @@ export interface AcquisitionResponse {
* Ledger the acquisition is held in. * Ledger the acquisition is held in.
*/ */
'ledgerId': string; 'ledgerId': string;
/**
* Where the acquisition came from: a character, a corporation, or nothing.
*/
'source': ActivitySourceResponse;
/** /**
* EVE market type (item) id that was acquired. * EVE market type (item) id that was acquired.
*/ */
@@ -3636,6 +3632,175 @@ export class MarketHistoryAdminControllerApi extends BaseAPI {
/**
* ProfitApi - axios parameter creator
*/
export const ProfitApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @summary Get the daily FIFO-realized margin series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
marginPerDayInLedger: async (ledgerId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'ledgerId' is not null or undefined
assertParamExists('marginPerDayInLedger', 'ledgerId', ledgerId)
const localVarPath = `/ledgers/{ledgerId}/margin`
.replace('{ledgerId}', encodeURIComponent(String(ledgerId)));
// 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 Get the daily profit series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
profitPerDayInLedger: async (ledgerId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'ledgerId' is not null or undefined
assertParamExists('profitPerDayInLedger', 'ledgerId', ledgerId)
const localVarPath = `/ledgers/{ledgerId}/profit`
.replace('{ledgerId}', encodeURIComponent(String(ledgerId)));
// 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,
};
},
}
};
/**
* ProfitApi - functional programming interface
*/
export const ProfitApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = ProfitApiAxiosParamCreator(configuration)
return {
/**
*
* @summary Get the daily FIFO-realized margin series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async marginPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<DailyProfitResponse>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.marginPerDayInLedger(ledgerId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['ProfitApi.marginPerDayInLedger']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @summary Get the daily profit series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async profitPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<DailyProfitResponse>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.profitPerDayInLedger(ledgerId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['ProfitApi.profitPerDayInLedger']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* ProfitApi - factory interface
*/
export const ProfitApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = ProfitApiFp(configuration)
return {
/**
*
* @summary Get the daily FIFO-realized margin series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
marginPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise<Array<DailyProfitResponse>> {
return localVarFp.marginPerDayInLedger(ledgerId, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Get the daily profit series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
profitPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise<Array<DailyProfitResponse>> {
return localVarFp.profitPerDayInLedger(ledgerId, options).then((request) => request(axios, basePath));
},
};
};
/**
* ProfitApi - object-oriented interface
*/
export class ProfitApi extends BaseAPI {
/**
*
* @summary Get the daily FIFO-realized margin series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public marginPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig) {
return ProfitApiFp(this.configuration).marginPerDayInLedger(ledgerId, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Get the daily profit series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public profitPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig) {
return ProfitApiFp(this.configuration).profitPerDayInLedger(ledgerId, options).then((request) => request(this.axios, this.basePath));
}
}
/** /**
* ReprocessingApi - axios parameter creator * ReprocessingApi - axios parameter creator
*/ */
@@ -4192,74 +4357,6 @@ export const TransactionApiAxiosParamCreator = function (configuration?: Configu
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Get the daily FIFO-realized profit series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
marginPerDayInLedger: async (ledgerId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'ledgerId' is not null or undefined
assertParamExists('marginPerDayInLedger', 'ledgerId', ledgerId)
const localVarPath = `/ledgers/{ledgerId}/margin`
.replace('{ledgerId}', encodeURIComponent(String(ledgerId)));
// 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 Get the daily profit series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
profitPerDayInLedger: async (ledgerId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'ledgerId' is not null or undefined
assertParamExists('profitPerDayInLedger', 'ledgerId', ledgerId)
const localVarPath = `/ledgers/{ledgerId}/profit`
.replace('{ledgerId}', encodeURIComponent(String(ledgerId)));
// 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 { return {
url: toPathString(localVarUrlObj), url: toPathString(localVarUrlObj),
options: localVarRequestOptions, options: localVarRequestOptions,
@@ -4287,32 +4384,6 @@ export const TransactionApiFp = function(configuration?: Configuration) {
const localVarOperationServerBasePath = operationServerMap['TransactionApi.finAllTransactionsInLedger']?.[localVarOperationServerIndex]?.url; const localVarOperationServerBasePath = operationServerMap['TransactionApi.finAllTransactionsInLedger']?.[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 Get the daily FIFO-realized profit series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async marginPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<DailyProfitResponse>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.marginPerDayInLedger(ledgerId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['TransactionApi.marginPerDayInLedger']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @summary Get the daily profit series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async profitPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<DailyProfitResponse>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.profitPerDayInLedger(ledgerId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['TransactionApi.profitPerDayInLedger']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
} }
}; };
@@ -4332,26 +4403,6 @@ export const TransactionApiFactory = function (configuration?: Configuration, ba
finAllTransactionsInLedger(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise<Array<TransactionResponse>> { finAllTransactionsInLedger(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise<Array<TransactionResponse>> {
return localVarFp.finAllTransactionsInLedger(ledgerId, options).then((request) => request(axios, basePath)); return localVarFp.finAllTransactionsInLedger(ledgerId, options).then((request) => request(axios, basePath));
}, },
/**
*
* @summary Get the daily FIFO-realized profit series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
marginPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise<Array<DailyProfitResponse>> {
return localVarFp.marginPerDayInLedger(ledgerId, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Get the daily profit series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
profitPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig): AxiosPromise<Array<DailyProfitResponse>> {
return localVarFp.profitPerDayInLedger(ledgerId, options).then((request) => request(axios, basePath));
},
}; };
}; };
@@ -4369,28 +4420,6 @@ export class TransactionApi extends BaseAPI {
public finAllTransactionsInLedger(ledgerId: string, options?: RawAxiosRequestConfig) { public finAllTransactionsInLedger(ledgerId: string, options?: RawAxiosRequestConfig) {
return TransactionApiFp(this.configuration).finAllTransactionsInLedger(ledgerId, options).then((request) => request(this.axios, this.basePath)); return TransactionApiFp(this.configuration).finAllTransactionsInLedger(ledgerId, options).then((request) => request(this.axios, this.basePath));
} }
/**
*
* @summary Get the daily FIFO-realized profit series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public marginPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig) {
return TransactionApiFp(this.configuration).marginPerDayInLedger(ledgerId, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Get the daily profit series for a single ledger
* @param {string} ledgerId Id of the ledger
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public profitPerDayInLedger(ledgerId: string, options?: RawAxiosRequestConfig) {
return TransactionApiFp(this.configuration).profitPerDayInLedger(ledgerId, options).then((request) => request(this.axios, this.basePath));
}
} }
+2
View File
@@ -12,6 +12,7 @@ import {
LocationApi, LocationApi,
MarketApi, MarketApi,
MeResponse, MeResponse,
ProfitApi,
ReprocessingApi, ReprocessingApi,
RuleBookApi, RuleBookApi,
RuleScriptApi, RuleScriptApi,
@@ -108,6 +109,7 @@ export const postLogout = (): Promise<void> =>
export const ledgerApi = new LedgerApi(undefined, mammonUrl, mammonAxiosInstance); export const ledgerApi = new LedgerApi(undefined, mammonUrl, mammonAxiosInstance);
export const transactionApi = new TransactionApi(undefined, mammonUrl, mammonAxiosInstance); export const transactionApi = new TransactionApi(undefined, mammonUrl, mammonAxiosInstance);
export const profitApi = new ProfitApi(undefined, mammonUrl, mammonAxiosInstance);
export const characterApi = new CharacterApi(undefined, mammonUrl, mammonAxiosInstance); export const characterApi = new CharacterApi(undefined, mammonUrl, mammonAxiosInstance);
export const corporationApi = new CorporationApi(undefined, mammonUrl, mammonAxiosInstance); export const corporationApi = new CorporationApi(undefined, mammonUrl, mammonAxiosInstance);
export const ruleBookApi = new RuleBookApi(undefined, mammonUrl, mammonAxiosInstance); export const ruleBookApi = new RuleBookApi(undefined, mammonUrl, mammonAxiosInstance);
+1 -3
View File
@@ -1,7 +1,7 @@
import {defineStore} from "pinia"; import {defineStore} from "pinia";
import {computed, ref} from "vue"; import {computed, ref} from "vue";
import {acquisitionApi, activityApi} from "@/mammon"; import {acquisitionApi, activityApi} from "@/mammon";
import {AcquisitionResponse, ActivitySourceResponse} from "@/generated/mammon"; import {AcquisitionResponse} from "@/generated/mammon";
import {onActivitiesProcessed} from "@/activity"; import {onActivitiesProcessed} from "@/activity";
export type RawAcquiredType = { export type RawAcquiredType = {
@@ -12,7 +12,6 @@ export type RawAcquiredType = {
remaining: number; remaining: number;
price: number; price: number;
date: Date; date: Date;
source: ActivitySourceResponse;
} }
export const toAcquiredType = (a: AcquisitionResponse): RawAcquiredType => ({ export const toAcquiredType = (a: AcquisitionResponse): RawAcquiredType => ({
@@ -23,7 +22,6 @@ export const toAcquiredType = (a: AcquisitionResponse): RawAcquiredType => ({
remaining: a.remaining, remaining: a.remaining,
price: a.unitCost, price: a.unitCost,
date: new Date(a.datetime), date: new Date(a.datetime),
source: a.source,
}); });
export const useAcquiredTypesStore = defineStore('market-acquisition', () => { export const useAcquiredTypesStore = defineStore('market-acquisition', () => {
+3 -3
View File
@@ -18,7 +18,7 @@ import {
} from "chart.js"; } from "chart.js";
import {Chart} from "vue-chartjs"; import {Chart} from "vue-chartjs";
import {useLedgerParam} from "@/ledger"; import {useLedgerParam} from "@/ledger";
import {transactionApi} from "@/mammon"; import {profitApi} from "@/mammon";
import {useProcessedResource} from "@/activity"; import {useProcessedResource} from "@/activity";
import {DailyProfitResponse} from "@/generated/mammon"; import {DailyProfitResponse} from "@/generated/mammon";
import {IskLabel} from "@/market"; import {IskLabel} from "@/market";
@@ -48,8 +48,8 @@ const profits = useProcessedResource<DailyProfitResponse[]>(async () => {
} }
const {data} = mode.value === ProfitModes.Margin const {data} = mode.value === ProfitModes.Margin
? await transactionApi.marginPerDayInLedger(ledgerId.value) ? await profitApi.marginPerDayInLedger(ledgerId.value)
: await transactionApi.profitPerDayInLedger(ledgerId.value); : await profitApi.profitPerDayInLedger(ledgerId.value);
return data; return data;
}, []); }, []);