diff --git a/docs/mammon-api.yml b/docs/mammon-api.yml index d4b676b..d8f7624 100644 --- a/docs/mammon-api.yml +++ b/docs/mammon-api.yml @@ -466,7 +466,8 @@ paths: get: tags: - market - summary: "Scan a single market type, returning its volume-weighted price quartiles" + summary: "Scan a single market type, returning its volume-weighted price quartiles\ + \ and recent price trend" operationId: scanMarketType parameters: - name: marketTypeId @@ -497,12 +498,12 @@ paths: minimum: 0 - name: salesTax in: query - description: "Sales tax as a fraction (e.g. 0.036 for 3.6%), paid on sell\ + description: "Sales tax as a fraction (e.g. 0.03375 for 3.375%), paid on sell\ \ orders" required: false schema: type: number - default: 0.036 + default: 0.03375 maximum: 1 minimum: 0 responses: @@ -548,6 +549,39 @@ paths: $ref: "#/components/schemas/MarketHistoryResponse" "400": description: The days parameter is not greater than 0 + /market/{marketTypeId}/history/quartiles: + get: + tags: + - market + summary: Compute volume-weighted price quartiles and the recent price trend + from a type's market history + operationId: findQuartiles + parameters: + - name: marketTypeId + in: path + description: Id of the market type + required: true + schema: + type: integer + format: int64 + - name: days + in: query + description: Optional number of most recent days to analyze; omit for the + full history + required: false + schema: + type: integer + format: int32 + minimum: 1 + responses: + "200": + description: The price quartiles of the type + content: + '*/*': + schema: + $ref: "#/components/schemas/HistoryQuartilesResponse" + "400": + description: The days parameter is not greater than 0 /market/types: get: tags: @@ -620,7 +654,7 @@ paths: tags: - market summary: "Scan every tracked market type, returning volume-weighted price quartiles\ - \ for each" + \ and the recent price trend for each" operationId: scanMarket parameters: - name: days @@ -644,12 +678,12 @@ paths: minimum: 0 - name: salesTax in: query - description: "Sales tax as a fraction (e.g. 0.036 for 3.6%), paid on sell\ + description: "Sales tax as a fraction (e.g. 0.03375 for 3.375%), paid on sell\ \ orders" required: false schema: type: number - default: 0.036 + default: 0.03375 maximum: 1 minimum: 0 responses: @@ -694,6 +728,48 @@ paths: Returned when: - the types parameter is missing - a types value is not a numeric id + /market/history/quartiles: + get: + tags: + - market + summary: Compute volume-weighted price quartiles and the recent price trend + for each requested market type + operationId: findAllQuartiles + parameters: + - name: types + in: query + description: "Market type ids to analyze, e.g. types=34,35" + required: true + schema: + type: array + items: + type: integer + format: int64 + - name: days + in: query + description: Optional number of most recent days to analyze; omit for the + full history + required: false + schema: + type: integer + format: int32 + minimum: 1 + responses: + "200": + description: "The price quartiles for each requested type, one entry per\ + \ type" + content: + '*/*': + schema: + type: array + items: + $ref: "#/components/schemas/HistoryQuartilesResponse" + "400": + description: |- + Returned when: + - the types parameter is missing + - a types value is not a numeric id + - the days parameter is not greater than 0 /ledgers: get: tags: @@ -1126,6 +1202,12 @@ components: totalVolume: type: integer format: int64 + trend: + type: string + enum: + - UP + - DOWN + - FLAT profit: type: number score: @@ -1140,6 +1222,7 @@ components: - score - sell - totalVolume + - trend MarketHistoryResponse: type: object properties: @@ -1169,6 +1252,34 @@ components: - marketTypeId - orderCount - volume + HistoryQuartilesResponse: + type: object + properties: + marketTypeId: + type: integer + format: int64 + q1: + type: number + median: + type: number + q3: + type: number + totalVolume: + type: integer + format: int64 + trend: + type: string + enum: + - UP + - DOWN + - FLAT + required: + - marketTypeId + - median + - q1 + - q3 + - totalVolume + - trend MarketTypeResponse: type: object properties: diff --git a/src/generated/mammon/api.ts b/src/generated/mammon/api.ts index 6bb476b..68d43dd 100644 --- a/src/generated/mammon/api.ts +++ b/src/generated/mammon/api.ts @@ -73,6 +73,23 @@ export interface CreateRuleBookRequest { 'ledgerRefs': Array; 'script': string; } +export interface HistoryQuartilesResponse { + 'marketTypeId': number; + 'q1': number; + 'median': number; + 'q3': number; + 'totalVolume': number; + 'trend': HistoryQuartilesResponseTrendEnum; +} + +export const HistoryQuartilesResponseTrendEnum = { + Up: 'UP', + Down: 'DOWN', + Flat: 'FLAT', +} as const; + +export type HistoryQuartilesResponseTrendEnum = typeof HistoryQuartilesResponseTrendEnum[keyof typeof HistoryQuartilesResponseTrendEnum]; + export interface IskTransferResponse extends TransferResponse { 'fromLedgerId': string; 'toLedgerId': string; @@ -121,9 +138,19 @@ export interface MarketScanResponse { 'median': number; 'q3': number; 'totalVolume': number; + 'trend': MarketScanResponseTrendEnum; 'profit': number; 'score': number; } + +export const MarketScanResponseTrendEnum = { + Up: 'UP', + Down: 'DOWN', + Flat: 'FLAT', +} as const; + +export type MarketScanResponseTrendEnum = typeof MarketScanResponseTrendEnum[keyof typeof MarketScanResponseTrendEnum]; + export interface MarketTypeResponse { 'id': number; 'name': string; @@ -1424,6 +1451,48 @@ export const MarketApiAxiosParamCreator = function (configuration?: Configuratio options: localVarRequestOptions, }; }, + /** + * + * @summary Compute volume-weighted price quartiles and the recent price trend for each requested market type + * @param {Array} types Market type ids to analyze, e.g. types=34,35 + * @param {number} [days] Optional number of most recent days to analyze; omit for the full history + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findAllQuartiles: async (types: Array, days?: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'types' is not null or undefined + assertParamExists('findAllQuartiles', 'types', types) + const localVarPath = `/market/history/quartiles`; + // 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; + + if (types) { + localVarQueryParameter['types'] = types; + } + + if (days !== undefined) { + localVarQueryParameter['days'] = days; + } + + 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 Find the market history of a type, most recent first @@ -1463,6 +1532,45 @@ export const MarketApiAxiosParamCreator = function (configuration?: Configuratio options: localVarRequestOptions, }; }, + /** + * + * @summary Compute volume-weighted price quartiles and the recent price trend from a type\'s market history + * @param {number} marketTypeId Id of the market type + * @param {number} [days] Optional number of most recent days to analyze; omit for the full history + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findQuartiles: async (marketTypeId: number, days?: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'marketTypeId' is not null or undefined + assertParamExists('findQuartiles', 'marketTypeId', marketTypeId) + const localVarPath = `/market/{marketTypeId}/history/quartiles` + .replace('{marketTypeId}', encodeURIComponent(String(marketTypeId))); + // 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; + + if (days !== undefined) { + localVarQueryParameter['days'] = days; + } + + 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 Return the static market type details for each requested type id @@ -1537,10 +1645,10 @@ export const MarketApiAxiosParamCreator = function (configuration?: Configuratio }, /** * - * @summary Scan every tracked market type, returning volume-weighted price quartiles for each + * @summary Scan every tracked market type, returning volume-weighted price quartiles and the recent price trend for each * @param {number} [days] Number of most recent days of history to analyse * @param {number} [brokerFee] Broker fee as a fraction (e.g. 0.015 for 1.5%), paid on both buy and sell orders - * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.036 for 3.6%), paid on sell orders + * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.03375 for 3.375%), paid on sell orders * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1582,11 +1690,11 @@ export const MarketApiAxiosParamCreator = function (configuration?: Configuratio }, /** * - * @summary Scan a single market type, returning its volume-weighted price quartiles + * @summary Scan a single market type, returning its volume-weighted price quartiles and recent price trend * @param {number} marketTypeId The market type id to scan * @param {number} [days] Number of most recent days of history to analyse * @param {number} [brokerFee] Broker fee as a fraction (e.g. 0.015 for 1.5%), paid on both buy and sell orders - * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.036 for 3.6%), paid on sell orders + * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.03375 for 3.375%), paid on sell orders * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1693,6 +1801,20 @@ export const MarketApiFp = function(configuration?: Configuration) { const localVarOperationServerBasePath = operationServerMap['MarketApi.currentPrices']?.[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 + * @param {Array} types Market type ids to analyze, e.g. types=34,35 + * @param {number} [days] Optional number of most recent days to analyze; omit for the full history + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async findAllQuartiles(types: Array, days?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.findAllQuartiles(types, days, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['MarketApi.findAllQuartiles']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, /** * * @summary Find the market history of a type, most recent first @@ -1707,6 +1829,20 @@ export const MarketApiFp = function(configuration?: Configuration) { const localVarOperationServerBasePath = operationServerMap['MarketApi.findHistory']?.[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 from a type\'s market history + * @param {number} marketTypeId Id of the market type + * @param {number} [days] Optional number of most recent days to analyze; omit for the full history + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async findQuartiles(marketTypeId: number, days?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.findQuartiles(marketTypeId, days, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['MarketApi.findQuartiles']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, /** * * @summary Return the static market type details for each requested type id @@ -1735,10 +1871,10 @@ export const MarketApiFp = function(configuration?: Configuration) { }, /** * - * @summary Scan every tracked market type, returning volume-weighted price quartiles for each + * @summary Scan every tracked market type, returning volume-weighted price quartiles and the recent price trend for each * @param {number} [days] Number of most recent days of history to analyse * @param {number} [brokerFee] Broker fee as a fraction (e.g. 0.015 for 1.5%), paid on both buy and sell orders - * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.036 for 3.6%), paid on sell orders + * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.03375 for 3.375%), paid on sell orders * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1750,11 +1886,11 @@ export const MarketApiFp = function(configuration?: Configuration) { }, /** * - * @summary Scan a single market type, returning its volume-weighted price quartiles + * @summary Scan a single market type, returning its volume-weighted price quartiles and recent price trend * @param {number} marketTypeId The market type id to scan * @param {number} [days] Number of most recent days of history to analyse * @param {number} [brokerFee] Broker fee as a fraction (e.g. 0.015 for 1.5%), paid on both buy and sell orders - * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.036 for 3.6%), paid on sell orders + * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.03375 for 3.375%), paid on sell orders * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1797,6 +1933,17 @@ export const MarketApiFactory = function (configuration?: Configuration, basePat currentPrices(types: Array, options?: RawAxiosRequestConfig): AxiosPromise> { return localVarFp.currentPrices(types, options).then((request) => request(axios, basePath)); }, + /** + * + * @summary Compute volume-weighted price quartiles and the recent price trend for each requested market type + * @param {Array} types Market type ids to analyze, e.g. types=34,35 + * @param {number} [days] Optional number of most recent days to analyze; omit for the full history + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findAllQuartiles(types: Array, days?: number, options?: RawAxiosRequestConfig): AxiosPromise> { + return localVarFp.findAllQuartiles(types, days, options).then((request) => request(axios, basePath)); + }, /** * * @summary Find the market history of a type, most recent first @@ -1808,6 +1955,17 @@ export const MarketApiFactory = function (configuration?: Configuration, basePat findHistory(marketTypeId: number, days?: number, options?: RawAxiosRequestConfig): AxiosPromise> { return localVarFp.findHistory(marketTypeId, days, options).then((request) => request(axios, basePath)); }, + /** + * + * @summary Compute volume-weighted price quartiles and the recent price trend from a type\'s market history + * @param {number} marketTypeId Id of the market type + * @param {number} [days] Optional number of most recent days to analyze; omit for the full history + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findQuartiles(marketTypeId: number, days?: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.findQuartiles(marketTypeId, days, options).then((request) => request(axios, basePath)); + }, /** * * @summary Return the static market type details for each requested type id @@ -1830,10 +1988,10 @@ export const MarketApiFactory = function (configuration?: Configuration, basePat }, /** * - * @summary Scan every tracked market type, returning volume-weighted price quartiles for each + * @summary Scan every tracked market type, returning volume-weighted price quartiles and the recent price trend for each * @param {number} [days] Number of most recent days of history to analyse * @param {number} [brokerFee] Broker fee as a fraction (e.g. 0.015 for 1.5%), paid on both buy and sell orders - * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.036 for 3.6%), paid on sell orders + * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.03375 for 3.375%), paid on sell orders * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1842,11 +2000,11 @@ export const MarketApiFactory = function (configuration?: Configuration, basePat }, /** * - * @summary Scan a single market type, returning its volume-weighted price quartiles + * @summary Scan a single market type, returning its volume-weighted price quartiles and recent price trend * @param {number} marketTypeId The market type id to scan * @param {number} [days] Number of most recent days of history to analyse * @param {number} [brokerFee] Broker fee as a fraction (e.g. 0.015 for 1.5%), paid on both buy and sell orders - * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.036 for 3.6%), paid on sell orders + * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.03375 for 3.375%), paid on sell orders * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1882,6 +2040,18 @@ export class MarketApi extends BaseAPI { return MarketApiFp(this.configuration).currentPrices(types, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary Compute volume-weighted price quartiles and the recent price trend for each requested market type + * @param {Array} types Market type ids to analyze, e.g. types=34,35 + * @param {number} [days] Optional number of most recent days to analyze; omit for the full history + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + public findAllQuartiles(types: Array, days?: number, options?: RawAxiosRequestConfig) { + return MarketApiFp(this.configuration).findAllQuartiles(types, days, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @summary Find the market history of a type, most recent first @@ -1894,6 +2064,18 @@ export class MarketApi extends BaseAPI { return MarketApiFp(this.configuration).findHistory(marketTypeId, days, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary Compute volume-weighted price quartiles and the recent price trend from a type\'s market history + * @param {number} marketTypeId Id of the market type + * @param {number} [days] Optional number of most recent days to analyze; omit for the full history + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + public findQuartiles(marketTypeId: number, days?: number, options?: RawAxiosRequestConfig) { + return MarketApiFp(this.configuration).findQuartiles(marketTypeId, days, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @summary Return the static market type details for each requested type id @@ -1918,10 +2100,10 @@ export class MarketApi extends BaseAPI { /** * - * @summary Scan every tracked market type, returning volume-weighted price quartiles for each + * @summary Scan every tracked market type, returning volume-weighted price quartiles and the recent price trend for each * @param {number} [days] Number of most recent days of history to analyse * @param {number} [brokerFee] Broker fee as a fraction (e.g. 0.015 for 1.5%), paid on both buy and sell orders - * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.036 for 3.6%), paid on sell orders + * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.03375 for 3.375%), paid on sell orders * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1931,11 +2113,11 @@ export class MarketApi extends BaseAPI { /** * - * @summary Scan a single market type, returning its volume-weighted price quartiles + * @summary Scan a single market type, returning its volume-weighted price quartiles and recent price trend * @param {number} marketTypeId The market type id to scan * @param {number} [days] Number of most recent days of history to analyse * @param {number} [brokerFee] Broker fee as a fraction (e.g. 0.015 for 1.5%), paid on both buy and sell orders - * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.036 for 3.6%), paid on sell orders + * @param {number} [salesTax] Sales tax as a fraction (e.g. 0.03375 for 3.375%), paid on sell orders * @param {*} [options] Override http request option. * @throws {RequiredError} */ diff --git a/src/market/acquisition/AcquisitionQuantilsTooltip.vue b/src/market/acquisition/AcquisitionQuartilesTooltip.vue similarity index 59% rename from src/market/acquisition/AcquisitionQuantilsTooltip.vue rename to src/market/acquisition/AcquisitionQuartilesTooltip.vue index 3beec75..2467450 100644 --- a/src/market/acquisition/AcquisitionQuantilsTooltip.vue +++ b/src/market/acquisition/AcquisitionQuartilesTooltip.vue @@ -1,12 +1,9 @@