diff --git a/packages/protocol/.gitignore b/packages/protocol/.gitignore index 02c496f3f..c7ef1e068 100644 --- a/packages/protocol/.gitignore +++ b/packages/protocol/.gitignore @@ -1,2 +1 @@ -octobot_protocol_ts octobot_protocol_rs \ No newline at end of file diff --git a/packages/protocol/octobot_protocol_ts/models/Account.ts b/packages/protocol/octobot_protocol_ts/models/Account.ts new file mode 100644 index 000000000..698328a26 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/Account.ts @@ -0,0 +1,89 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AccountDetails } from '../models/AccountDetails'; +import { AccountState } from '../models/AccountState'; + +/** +* Account +*/ +export class Account { + 'id': string; + 'name': string; + 'is_simulated': boolean; + 'description'?: string; + 'state'?: AccountState; + 'created_at': string; + 'updated_at': string; + 'details'?: AccountDetails; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "is_simulated", + "baseName": "is_simulated", + "type": "boolean", + "format": "" + }, + { + "name": "description", + "baseName": "description", + "type": "string", + "format": "" + }, + { + "name": "state", + "baseName": "state", + "type": "AccountState", + "format": "" + }, + { + "name": "created_at", + "baseName": "created_at", + "type": "Date", + "format": "date-time" + }, + { + "name": "updated_at", + "baseName": "updated_at", + "type": "Date", + "format": "date-time" + }, + { + "name": "details", + "baseName": "details", + "type": "AccountDetails", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Account.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/AccountActionResult.ts b/packages/protocol/octobot_protocol_ts/models/AccountActionResult.ts new file mode 100644 index 000000000..431c4e5db --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/AccountActionResult.ts @@ -0,0 +1,63 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AccountActionResultErrorMessage } from '../models/AccountActionResultErrorMessage'; +import { UserActionResultType } from '../models/UserActionResultType'; + +/** +* AccountActionResult +*/ +export class AccountActionResult { + 'updated_at': string; + 'error_message'?: AccountActionResultErrorMessage; + 'error_details'?: string; + 'result_type': UserActionResultType; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "updated_at", + "baseName": "updated_at", + "type": "Date", + "format": "date-time" + }, + { + "name": "error_message", + "baseName": "error_message", + "type": "AccountActionResultErrorMessage", + "format": "" + }, + { + "name": "error_details", + "baseName": "error_details", + "type": "string", + "format": "" + }, + { + "name": "result_type", + "baseName": "result_type", + "type": "UserActionResultType", + "format": "" + } ]; + + static getAttributeTypeMap() { + return AccountActionResult.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/AccountActionResultErrorMessage.ts b/packages/protocol/octobot_protocol_ts/models/AccountActionResultErrorMessage.ts new file mode 100644 index 000000000..fa059521d --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/AccountActionResultErrorMessage.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* AccountActionResultErrorMessage +*/ +export type AccountActionResultErrorMessage = 'account_not_found' | 'invalid_configuration' | 'internal_error' diff --git a/packages/protocol/octobot_protocol_ts/models/AccountDetails.ts b/packages/protocol/octobot_protocol_ts/models/AccountDetails.ts new file mode 100644 index 000000000..55606f280 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/AccountDetails.ts @@ -0,0 +1,38 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { BlockchainAccount } from '../models/BlockchainAccount'; +import { ExchangeAccount } from '../models/ExchangeAccount'; +import { GenericAccount } from '../models/GenericAccount'; + +/** + * @type AccountDetails + * Type + * @export + */ +export type AccountDetails = BlockchainAccount | ExchangeAccount | GenericAccount; + +/** +* @type AccountDetailsClass +* @export +*/ +export class AccountDetailsClass { + static readonly discriminator: string | undefined = "account_type"; + + static readonly mapping: {[index: string]: string} | undefined = { + "blockchain": "BlockchainAccount", + "exchange": "ExchangeAccount", + "generic": "GenericAccount", + }; +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/AccountReference.ts b/packages/protocol/octobot_protocol_ts/models/AccountReference.ts new file mode 100644 index 000000000..c51cfb35c --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/AccountReference.ts @@ -0,0 +1,38 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* AccountReference +*/ +export class AccountReference { + 'id': string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return AccountReference.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/AccountState.ts b/packages/protocol/octobot_protocol_ts/models/AccountState.ts new file mode 100644 index 000000000..6ec0d783b --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/AccountState.ts @@ -0,0 +1,49 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AccountStatus } from '../models/AccountStatus'; +import { AccountStatusMessage } from '../models/AccountStatusMessage'; + +/** +* AccountState +*/ +export class AccountState { + 'status': AccountStatus; + 'message'?: AccountStatusMessage; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "status", + "baseName": "status", + "type": "AccountStatus", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "AccountStatusMessage", + "format": "" + } ]; + + static getAttributeTypeMap() { + return AccountState.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/AccountStatus.ts b/packages/protocol/octobot_protocol_ts/models/AccountStatus.ts new file mode 100644 index 000000000..3db71449b --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/AccountStatus.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* AccountStatus +*/ +export type AccountStatus = 'valid' | 'invalid' | 'unknown' diff --git a/packages/protocol/octobot_protocol_ts/models/AccountStatusMessage.ts b/packages/protocol/octobot_protocol_ts/models/AccountStatusMessage.ts new file mode 100644 index 000000000..93af3e27e --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/AccountStatusMessage.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* AccountStatusMessage +*/ +export type AccountStatusMessage = 'pending_validation' | 'valid' | 'invalid_api_keys' | 'missing_api_trading_rights' | 'revoke_api_withdrawal_rights' | 'invalid_api_ip_whitelist' | 'internal_server_error' | 'account_too_old' | 'incompatible_account_referral' diff --git a/packages/protocol/octobot_protocol_ts/models/AccountType.ts b/packages/protocol/octobot_protocol_ts/models/AccountType.ts new file mode 100644 index 000000000..8bfa992bf --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/AccountType.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Account category discriminator. +*/ +export type AccountType = 'generic' | 'exchange' | 'blockchain' diff --git a/packages/protocol/octobot_protocol_ts/models/AccountsState.ts b/packages/protocol/octobot_protocol_ts/models/AccountsState.ts new file mode 100644 index 000000000..0bd47747f --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/AccountsState.ts @@ -0,0 +1,46 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Account } from '../models/Account'; + +/** +* AccountsState +*/ +export class AccountsState { + 'version': string; + 'accounts'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "version", + "baseName": "version", + "type": "string", + "format": "" + }, + { + "name": "accounts", + "baseName": "accounts", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return AccountsState.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/Action.ts b/packages/protocol/octobot_protocol_ts/models/Action.ts new file mode 100644 index 000000000..c434fdb5e --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/Action.ts @@ -0,0 +1,90 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { TaskStatus } from '../models/TaskStatus'; + +/** +* Action +*/ +export class Action { + 'id': string; + 'action_type': string; + 'status': TaskStatus; + 'dsl'?: string; + 'configuration'?: { [key: string]: any; }; + 'result'?: string; + 'error'?: string; + 'completed_at'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "action_type", + "baseName": "action_type", + "type": "string", + "format": "" + }, + { + "name": "status", + "baseName": "status", + "type": "TaskStatus", + "format": "" + }, + { + "name": "dsl", + "baseName": "dsl", + "type": "string", + "format": "" + }, + { + "name": "configuration", + "baseName": "configuration", + "type": "{ [key: string]: any; }", + "format": "" + }, + { + "name": "result", + "baseName": "result", + "type": "string", + "format": "" + }, + { + "name": "error", + "baseName": "error", + "type": "string", + "format": "" + }, + { + "name": "completed_at", + "baseName": "completed_at", + "type": "Date", + "format": "date-time" + } ]; + + static getAttributeTypeMap() { + return Action.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/ActionConfigurationType.ts b/packages/protocol/octobot_protocol_ts/models/ActionConfigurationType.ts new file mode 100644 index 000000000..d4e20e118 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/ActionConfigurationType.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* ActionConfigurationType +*/ +export type ActionConfigurationType = 'market_making' | 'dca' | 'index' | 'grid' | 'copy' | 'generic_process' | 'generic_workflow' diff --git a/packages/protocol/octobot_protocol_ts/models/ActiveOrderSwapStrategy.ts b/packages/protocol/octobot_protocol_ts/models/ActiveOrderSwapStrategy.ts new file mode 100644 index 000000000..aef86622d --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/ActiveOrderSwapStrategy.ts @@ -0,0 +1,55 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ActiveOrderSwapStrategyType } from '../models/ActiveOrderSwapStrategyType'; + +/** +* ActiveOrderSwapStrategy +*/ +export class ActiveOrderSwapStrategy { + 'type': ActiveOrderSwapStrategyType; + 'trigger_price_configuration'?: any; + 'timeout'?: number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "ActiveOrderSwapStrategyType", + "format": "" + }, + { + "name": "trigger_price_configuration", + "baseName": "trigger_price_configuration", + "type": "any", + "format": "" + }, + { + "name": "timeout", + "baseName": "timeout", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ActiveOrderSwapStrategy.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/ActiveOrderSwapStrategyType.ts b/packages/protocol/octobot_protocol_ts/models/ActiveOrderSwapStrategyType.ts new file mode 100644 index 000000000..0ce268a95 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/ActiveOrderSwapStrategyType.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Active order swap strategy class name (mirrors octobot_trading active_order_swap_strategy_factory). +*/ +export type ActiveOrderSwapStrategyType = 'StopFirstActiveOrderSwapStrategy' | 'TakeProfitFirstActiveOrderSwapStrategy' diff --git a/packages/protocol/octobot_protocol_ts/models/Asset.ts b/packages/protocol/octobot_protocol_ts/models/Asset.ts new file mode 100644 index 000000000..689aa3f0d --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/Asset.ts @@ -0,0 +1,66 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Asset +*/ +export class Asset { + 'symbol': string; + 'total': number; + 'available': number; + 'value'?: number; + 'unit'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "symbol", + "baseName": "symbol", + "type": "string", + "format": "" + }, + { + "name": "total", + "baseName": "total", + "type": "number", + "format": "" + }, + { + "name": "available", + "baseName": "available", + "type": "number", + "format": "" + }, + { + "name": "value", + "baseName": "value", + "type": "number", + "format": "" + }, + { + "name": "unit", + "baseName": "unit", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Asset.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/AutomationActionResult.ts b/packages/protocol/octobot_protocol_ts/models/AutomationActionResult.ts new file mode 100644 index 000000000..4e8e4c84e --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/AutomationActionResult.ts @@ -0,0 +1,70 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AutomationActionResultErrorMessage } from '../models/AutomationActionResultErrorMessage'; +import { UserActionResultType } from '../models/UserActionResultType'; + +/** +* AutomationActionResult +*/ +export class AutomationActionResult { + 'updated_at': string; + 'error_message'?: AutomationActionResultErrorMessage; + 'error_details'?: string; + 'created_automation_id'?: string; + 'result_type': UserActionResultType; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "updated_at", + "baseName": "updated_at", + "type": "Date", + "format": "date-time" + }, + { + "name": "error_message", + "baseName": "error_message", + "type": "AutomationActionResultErrorMessage", + "format": "" + }, + { + "name": "error_details", + "baseName": "error_details", + "type": "string", + "format": "" + }, + { + "name": "created_automation_id", + "baseName": "created_automation_id", + "type": "string", + "format": "" + }, + { + "name": "result_type", + "baseName": "result_type", + "type": "UserActionResultType", + "format": "" + } ]; + + static getAttributeTypeMap() { + return AutomationActionResult.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/AutomationActionResultErrorMessage.ts b/packages/protocol/octobot_protocol_ts/models/AutomationActionResultErrorMessage.ts new file mode 100644 index 000000000..9f3fe1da3 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/AutomationActionResultErrorMessage.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* AutomationActionResultErrorMessage +*/ +export type AutomationActionResultErrorMessage = 'automation_not_found' | 'invalid_configuration' | 'strategy_not_found' | 'strategy_version_not_found' | 'account_not_found' | 'internal_error' diff --git a/packages/protocol/octobot_protocol_ts/models/AutomationConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/AutomationConfiguration.ts new file mode 100644 index 000000000..8fb0f539c --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/AutomationConfiguration.ts @@ -0,0 +1,75 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AccountReference } from '../models/AccountReference'; +import { StrategyReference } from '../models/StrategyReference'; + +/** +* AutomationConfiguration +*/ +export class AutomationConfiguration { + 'name': string; + 'description'?: string; + 'created_at': string; + 'updated_at'?: string; + 'strategy': StrategyReference; + 'accounts': Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "description", + "baseName": "description", + "type": "string", + "format": "" + }, + { + "name": "created_at", + "baseName": "created_at", + "type": "Date", + "format": "date-time" + }, + { + "name": "updated_at", + "baseName": "updated_at", + "type": "Date", + "format": "date-time" + }, + { + "name": "strategy", + "baseName": "strategy", + "type": "StrategyReference", + "format": "" + }, + { + "name": "accounts", + "baseName": "accounts", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return AutomationConfiguration.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/AutomationMetadata.ts b/packages/protocol/octobot_protocol_ts/models/AutomationMetadata.ts new file mode 100644 index 000000000..6c6327725 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/AutomationMetadata.ts @@ -0,0 +1,59 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* AutomationMetadata +*/ +export class AutomationMetadata { + 'name': string; + 'description': string; + 'created_at'?: string; + 'updated_at'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "description", + "baseName": "description", + "type": "string", + "format": "" + }, + { + "name": "created_at", + "baseName": "created_at", + "type": "Date", + "format": "date-time" + }, + { + "name": "updated_at", + "baseName": "updated_at", + "type": "Date", + "format": "date-time" + } ]; + + static getAttributeTypeMap() { + return AutomationMetadata.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/AutomationState.ts b/packages/protocol/octobot_protocol_ts/models/AutomationState.ts new file mode 100644 index 000000000..e7650b295 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/AutomationState.ts @@ -0,0 +1,117 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Action } from '../models/Action'; +import { Asset } from '../models/Asset'; +import { AutomationMetadata } from '../models/AutomationMetadata'; +import { OrderSummary } from '../models/OrderSummary'; +import { PositionSummary } from '../models/PositionSummary'; +import { TaskStatus } from '../models/TaskStatus'; +import { TradeSummary } from '../models/TradeSummary'; + +/** +* AutomationState +*/ +export class AutomationState { + 'id': string; + 'status': TaskStatus; + 'metadata': AutomationMetadata; + 'actions'?: Array; + 'priority_actions'?: Array; + 'exchanges'?: Array; + 'exchange_account_ids'?: Array; + 'assets'?: Array; + 'orders'?: Array; + 'trades'?: Array; + 'positions'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "status", + "baseName": "status", + "type": "TaskStatus", + "format": "" + }, + { + "name": "metadata", + "baseName": "metadata", + "type": "AutomationMetadata", + "format": "" + }, + { + "name": "actions", + "baseName": "actions", + "type": "Array", + "format": "" + }, + { + "name": "priority_actions", + "baseName": "priority_actions", + "type": "Array", + "format": "" + }, + { + "name": "exchanges", + "baseName": "exchanges", + "type": "Array", + "format": "" + }, + { + "name": "exchange_account_ids", + "baseName": "exchange_account_ids", + "type": "Array", + "format": "" + }, + { + "name": "assets", + "baseName": "assets", + "type": "Array", + "format": "" + }, + { + "name": "orders", + "baseName": "orders", + "type": "Array", + "format": "" + }, + { + "name": "trades", + "baseName": "trades", + "type": "Array", + "format": "" + }, + { + "name": "positions", + "baseName": "positions", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return AutomationState.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/BlockchainAccount.ts b/packages/protocol/octobot_protocol_ts/models/BlockchainAccount.ts new file mode 100644 index 000000000..a4e5c8802 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/BlockchainAccount.ts @@ -0,0 +1,79 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AccountType } from '../models/AccountType'; + +/** +* BlockchainAccount +*/ +export class BlockchainAccount { + /** + * blockchain + */ + 'account_type': 'blockchain'; + 'blockchain': string; + 'network'?: string; + 'public_key'?: string; + 'private_key'?: string; + 'passphrase'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "account_type", + "baseName": "account_type", + "type": "AccountType", + "format": "" + }, + { + "name": "blockchain", + "baseName": "blockchain", + "type": "string", + "format": "" + }, + { + "name": "network", + "baseName": "network", + "type": "string", + "format": "" + }, + { + "name": "public_key", + "baseName": "public_key", + "type": "string", + "format": "" + }, + { + "name": "private_key", + "baseName": "private_key", + "type": "string", + "format": "" + }, + { + "name": "passphrase", + "baseName": "passphrase", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return BlockchainAccount.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/CancelPolicy.ts b/packages/protocol/octobot_protocol_ts/models/CancelPolicy.ts new file mode 100644 index 000000000..ec06d20c0 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/CancelPolicy.ts @@ -0,0 +1,48 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { CancelPolicyType } from '../models/CancelPolicyType'; + +/** +* CancelPolicy +*/ +export class CancelPolicy { + 'type': CancelPolicyType; + 'details'?: any; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "CancelPolicyType", + "format": "" + }, + { + "name": "details", + "baseName": "details", + "type": "any", + "format": "" + } ]; + + static getAttributeTypeMap() { + return CancelPolicy.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/CancelPolicyType.ts b/packages/protocol/octobot_protocol_ts/models/CancelPolicyType.ts new file mode 100644 index 000000000..91b30b99c --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/CancelPolicyType.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Cancel policy class name (mirrors octobot_trading cancel_policy_factory). +*/ +export type CancelPolicyType = 'ExpirationTimeOrderCancelPolicy' | 'ChainedOrderFillingPriceOrderCancelPolicy' diff --git a/packages/protocol/octobot_protocol_ts/models/CopiedAccount.ts b/packages/protocol/octobot_protocol_ts/models/CopiedAccount.ts new file mode 100644 index 000000000..8c478be5c --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/CopiedAccount.ts @@ -0,0 +1,76 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { CopiedAsset } from '../models/CopiedAsset'; +import { Order } from '../models/Order'; +import { Position } from '../models/Position'; + +/** +* CopiedAccount +*/ +export class CopiedAccount { + 'version': string; + 'updated_at': number; + 'copied_assets': Array; + 'orders'?: Array; + 'positions'?: Array; + 'historical_snapshots'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "version", + "baseName": "version", + "type": "string", + "format": "" + }, + { + "name": "updated_at", + "baseName": "updated_at", + "type": "number", + "format": "" + }, + { + "name": "copied_assets", + "baseName": "copied_assets", + "type": "Array", + "format": "" + }, + { + "name": "orders", + "baseName": "orders", + "type": "Array", + "format": "" + }, + { + "name": "positions", + "baseName": "positions", + "type": "Array", + "format": "" + }, + { + "name": "historical_snapshots", + "baseName": "historical_snapshots", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return CopiedAccount.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/CopiedAsset.ts b/packages/protocol/octobot_protocol_ts/models/CopiedAsset.ts new file mode 100644 index 000000000..07920ba17 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/CopiedAsset.ts @@ -0,0 +1,59 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* CopiedAsset +*/ +export class CopiedAsset { + 'name': string; + 'total': number; + 'available': number; + 'ratio': number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "total", + "baseName": "total", + "type": "number", + "format": "" + }, + { + "name": "available", + "baseName": "available", + "type": "number", + "format": "" + }, + { + "name": "ratio", + "baseName": "ratio", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return CopiedAsset.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/CopyConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/CopyConfiguration.ts new file mode 100644 index 000000000..3218f75db --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/CopyConfiguration.ts @@ -0,0 +1,51 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ActionConfigurationType } from '../models/ActionConfigurationType'; + +/** +* CopyConfiguration +*/ +export class CopyConfiguration { + /** + * copy + */ + 'configuration_type': 'copy'; + 'strategy_id': string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "configuration_type", + "baseName": "configuration_type", + "type": "ActionConfigurationType", + "format": "" + }, + { + "name": "strategy_id", + "baseName": "strategy_id", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return CopyConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/CreateAccountConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/CreateAccountConfiguration.ts new file mode 100644 index 000000000..1d37b2910 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/CreateAccountConfiguration.ts @@ -0,0 +1,52 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Account } from '../models/Account'; +import { UserActionType } from '../models/UserActionType'; + +/** +* CreateAccountConfiguration +*/ +export class CreateAccountConfiguration { + /** + * account_create + */ + 'action_type': 'account_create'; + 'configuration': Account; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "action_type", + "baseName": "action_type", + "type": "UserActionType", + "format": "" + }, + { + "name": "configuration", + "baseName": "configuration", + "type": "Account", + "format": "" + } ]; + + static getAttributeTypeMap() { + return CreateAccountConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/CreateAutomationConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/CreateAutomationConfiguration.ts new file mode 100644 index 000000000..05962053d --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/CreateAutomationConfiguration.ts @@ -0,0 +1,52 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AutomationConfiguration } from '../models/AutomationConfiguration'; +import { UserActionType } from '../models/UserActionType'; + +/** +* CreateAutomationConfiguration +*/ +export class CreateAutomationConfiguration { + /** + * automation_create + */ + 'action_type': 'automation_create'; + 'configuration': AutomationConfiguration; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "action_type", + "baseName": "action_type", + "type": "UserActionType", + "format": "" + }, + { + "name": "configuration", + "baseName": "configuration", + "type": "AutomationConfiguration", + "format": "" + } ]; + + static getAttributeTypeMap() { + return CreateAutomationConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/DCAConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/DCAConfiguration.ts new file mode 100644 index 000000000..821d0fb60 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/DCAConfiguration.ts @@ -0,0 +1,124 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ActionConfigurationType } from '../models/ActionConfigurationType'; +import { EvaluatorConfiguration } from '../models/EvaluatorConfiguration'; +import { TimeFrame } from '../models/TimeFrame'; + +/** +* DCAConfiguration +*/ +export class DCAConfiguration { + /** + * dca + */ + 'configuration_type': 'dca'; + 'symbols': Array; + 'buy_orders_count': number; + 'percent_amount_per_buy_order': number; + 'profit_target_percent': number; + 'buy_order_price_discount_percent': number; + 'enable_stop_loss': boolean; + 'stop_loss_price_discount_percent': number; + 'trigger_mode': DCAConfigurationTriggerModeEnum; + 'use_init_entry_orders': boolean; + 'time_frames': Array; + 'evaluators': Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "configuration_type", + "baseName": "configuration_type", + "type": "ActionConfigurationType", + "format": "" + }, + { + "name": "symbols", + "baseName": "symbols", + "type": "Array", + "format": "" + }, + { + "name": "buy_orders_count", + "baseName": "buy_orders_count", + "type": "number", + "format": "" + }, + { + "name": "percent_amount_per_buy_order", + "baseName": "percent_amount_per_buy_order", + "type": "number", + "format": "" + }, + { + "name": "profit_target_percent", + "baseName": "profit_target_percent", + "type": "number", + "format": "" + }, + { + "name": "buy_order_price_discount_percent", + "baseName": "buy_order_price_discount_percent", + "type": "number", + "format": "" + }, + { + "name": "enable_stop_loss", + "baseName": "enable_stop_loss", + "type": "boolean", + "format": "" + }, + { + "name": "stop_loss_price_discount_percent", + "baseName": "stop_loss_price_discount_percent", + "type": "number", + "format": "" + }, + { + "name": "trigger_mode", + "baseName": "trigger_mode", + "type": "DCAConfigurationTriggerModeEnum", + "format": "" + }, + { + "name": "use_init_entry_orders", + "baseName": "use_init_entry_orders", + "type": "boolean", + "format": "" + }, + { + "name": "time_frames", + "baseName": "time_frames", + "type": "Array", + "format": "" + }, + { + "name": "evaluators", + "baseName": "evaluators", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return DCAConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + +export type DCAConfigurationTriggerModeEnum = 'Maximum evaluators signals based' | 'Time based' + diff --git a/packages/protocol/octobot_protocol_ts/models/DeleteAccountConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/DeleteAccountConfiguration.ts new file mode 100644 index 000000000..b3d7e8a20 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/DeleteAccountConfiguration.ts @@ -0,0 +1,51 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { UserActionType } from '../models/UserActionType'; + +/** +* DeleteAccountConfiguration +*/ +export class DeleteAccountConfiguration { + /** + * account_delete + */ + 'action_type': 'account_delete'; + 'id': string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "action_type", + "baseName": "action_type", + "type": "UserActionType", + "format": "" + }, + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return DeleteAccountConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/EMAMomentumEvaluatorConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/EMAMomentumEvaluatorConfiguration.ts new file mode 100644 index 000000000..fc565bb7e --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/EMAMomentumEvaluatorConfiguration.ts @@ -0,0 +1,65 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { EvaluatorType } from '../models/EvaluatorType'; + +/** +* EMAMomentumEvaluatorConfiguration +*/ +export class EMAMomentumEvaluatorConfiguration { + /** + * EMAMomentumEvaluator + */ + 'configuration_type': 'EMAMomentumEvaluator'; + 'period_length': number; + 'price_threshold_percent': number; + 'reverse_signal': boolean; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "configuration_type", + "baseName": "configuration_type", + "type": "EvaluatorType", + "format": "" + }, + { + "name": "period_length", + "baseName": "period_length", + "type": "number", + "format": "" + }, + { + "name": "price_threshold_percent", + "baseName": "price_threshold_percent", + "type": "number", + "format": "" + }, + { + "name": "reverse_signal", + "baseName": "reverse_signal", + "type": "boolean", + "format": "" + } ]; + + static getAttributeTypeMap() { + return EMAMomentumEvaluatorConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/EditAccountConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/EditAccountConfiguration.ts new file mode 100644 index 000000000..5ec550847 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/EditAccountConfiguration.ts @@ -0,0 +1,59 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Account } from '../models/Account'; +import { UserActionType } from '../models/UserActionType'; + +/** +* EditAccountConfiguration +*/ +export class EditAccountConfiguration { + /** + * account_edit + */ + 'action_type': 'account_edit'; + 'id': string; + 'configuration'?: Account; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "action_type", + "baseName": "action_type", + "type": "UserActionType", + "format": "" + }, + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "configuration", + "baseName": "configuration", + "type": "Account", + "format": "" + } ]; + + static getAttributeTypeMap() { + return EditAccountConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/EditAutomationConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/EditAutomationConfiguration.ts new file mode 100644 index 000000000..dac3f3fd1 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/EditAutomationConfiguration.ts @@ -0,0 +1,59 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AutomationConfiguration } from '../models/AutomationConfiguration'; +import { UserActionType } from '../models/UserActionType'; + +/** +* EditAutomationConfiguration +*/ +export class EditAutomationConfiguration { + 'id': string; + /** + * automation_edit + */ + 'action_type': 'automation_edit'; + 'configuration': AutomationConfiguration; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "action_type", + "baseName": "action_type", + "type": "UserActionType", + "format": "" + }, + { + "name": "configuration", + "baseName": "configuration", + "type": "AutomationConfiguration", + "format": "" + } ]; + + static getAttributeTypeMap() { + return EditAutomationConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/EvaluatorConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/EvaluatorConfiguration.ts new file mode 100644 index 000000000..19c325a88 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/EvaluatorConfiguration.ts @@ -0,0 +1,39 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { EvaluatorConfigurationConfiguration } from '../models/EvaluatorConfigurationConfiguration'; + +/** +* EvaluatorConfiguration +*/ +export class EvaluatorConfiguration { + 'configuration': EvaluatorConfigurationConfiguration; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "configuration", + "baseName": "configuration", + "type": "EvaluatorConfigurationConfiguration", + "format": "" + } ]; + + static getAttributeTypeMap() { + return EvaluatorConfiguration.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/EvaluatorConfigurationConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/EvaluatorConfigurationConfiguration.ts new file mode 100644 index 000000000..f53ebd12a --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/EvaluatorConfigurationConfiguration.ts @@ -0,0 +1,35 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { EMAMomentumEvaluatorConfiguration } from '../models/EMAMomentumEvaluatorConfiguration'; +import { RSIMomentumEvaluatorConfiguration } from '../models/RSIMomentumEvaluatorConfiguration'; + +/** + * @type EvaluatorConfigurationConfiguration + * Type + * @export + */ +export type EvaluatorConfigurationConfiguration = EMAMomentumEvaluatorConfiguration | RSIMomentumEvaluatorConfiguration; + +/** +* @type EvaluatorConfigurationConfigurationClass +* @export +*/ +export class EvaluatorConfigurationConfigurationClass { + static readonly discriminator: string | undefined = "configuration_type"; + + static readonly mapping: {[index: string]: string} | undefined = { + "EMAMomentumEvaluator": "EMAMomentumEvaluatorConfiguration", + "RSIMomentumEvaluator": "RSIMomentumEvaluatorConfiguration", + }; +} + diff --git a/packages/protocol/octobot_protocol_ts/models/EvaluatorType.ts b/packages/protocol/octobot_protocol_ts/models/EvaluatorType.ts new file mode 100644 index 000000000..d58b6fe9f --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/EvaluatorType.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* EvaluatorType +*/ +export type EvaluatorType = 'RSIMomentumEvaluator' | 'EMAMomentumEvaluator' diff --git a/packages/protocol/octobot_protocol_ts/models/ExchangeAccount.ts b/packages/protocol/octobot_protocol_ts/models/ExchangeAccount.ts new file mode 100644 index 000000000..97ea07a43 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/ExchangeAccount.ts @@ -0,0 +1,119 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AccountType } from '../models/AccountType'; +import { Asset } from '../models/Asset'; +import { Order } from '../models/Order'; +import { Position } from '../models/Position'; +import { Trade } from '../models/Trade'; +import { TradingType } from '../models/TradingType'; + +/** +* ExchangeAccount +*/ +export class ExchangeAccount { + /** + * exchange + */ + 'account_type': 'exchange'; + 'trading_type': TradingType; + 'exchange': string; + 'remote_account_id': string; + 'api_key': string; + 'api_secret': string; + 'api_passphrase'?: string; + 'assets'?: Array; + 'orders'?: Array; + 'trades'?: Array; + 'positions'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "account_type", + "baseName": "account_type", + "type": "AccountType", + "format": "" + }, + { + "name": "trading_type", + "baseName": "trading_type", + "type": "TradingType", + "format": "" + }, + { + "name": "exchange", + "baseName": "exchange", + "type": "string", + "format": "" + }, + { + "name": "remote_account_id", + "baseName": "remote_account_id", + "type": "string", + "format": "" + }, + { + "name": "api_key", + "baseName": "api_key", + "type": "string", + "format": "" + }, + { + "name": "api_secret", + "baseName": "api_secret", + "type": "string", + "format": "" + }, + { + "name": "api_passphrase", + "baseName": "api_passphrase", + "type": "string", + "format": "" + }, + { + "name": "assets", + "baseName": "assets", + "type": "Array", + "format": "" + }, + { + "name": "orders", + "baseName": "orders", + "type": "Array", + "format": "" + }, + { + "name": "trades", + "baseName": "trades", + "type": "Array", + "format": "" + }, + { + "name": "positions", + "baseName": "positions", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ExchangeAccount.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/GenericAccount.ts b/packages/protocol/octobot_protocol_ts/models/GenericAccount.ts new file mode 100644 index 000000000..6e6a72891 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/GenericAccount.ts @@ -0,0 +1,52 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AccountType } from '../models/AccountType'; +import { Asset } from '../models/Asset'; + +/** +* GenericAccount +*/ +export class GenericAccount { + /** + * generic + */ + 'account_type': 'generic'; + 'assets'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "account_type", + "baseName": "account_type", + "type": "AccountType", + "format": "" + }, + { + "name": "assets", + "baseName": "assets", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return GenericAccount.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/GenericProcessConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/GenericProcessConfiguration.ts new file mode 100644 index 000000000..c8dd13a72 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/GenericProcessConfiguration.ts @@ -0,0 +1,51 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ActionConfigurationType } from '../models/ActionConfigurationType'; + +/** +* GenericProcessConfiguration +*/ +export class GenericProcessConfiguration { + /** + * generic_process + */ + 'configuration_type': 'generic_process'; + 'profile_data': any; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "configuration_type", + "baseName": "configuration_type", + "type": "ActionConfigurationType", + "format": "" + }, + { + "name": "profile_data", + "baseName": "profile_data", + "type": "any", + "format": "" + } ]; + + static getAttributeTypeMap() { + return GenericProcessConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/GenericWorkflowConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/GenericWorkflowConfiguration.ts new file mode 100644 index 000000000..d07b94333 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/GenericWorkflowConfiguration.ts @@ -0,0 +1,52 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Action } from '../models/Action'; +import { ActionConfigurationType } from '../models/ActionConfigurationType'; + +/** +* GenericWorkflowConfiguration +*/ +export class GenericWorkflowConfiguration { + /** + * generic_workflow + */ + 'configuration_type': 'generic_workflow'; + 'actions': Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "configuration_type", + "baseName": "configuration_type", + "type": "ActionConfigurationType", + "format": "" + }, + { + "name": "actions", + "baseName": "actions", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return GenericWorkflowConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/GridConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/GridConfiguration.ts new file mode 100644 index 000000000..551a4db82 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/GridConfiguration.ts @@ -0,0 +1,112 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ActionConfigurationType } from '../models/ActionConfigurationType'; + +/** +* GridConfiguration +*/ +export class GridConfiguration { + /** + * grid + */ + 'configuration_type': 'grid'; + 'symbol': string; + /** + * Price difference between the closest buy and sell orders. Denominated in the quote currency (600 for a 600 USDT spread on BTC/USDT). + */ + 'spread': number; + /** + * Price difference between two orders of the same side. Denominated in the quote currency (200 for a 200 USDT spread on BTC/USDT). + */ + 'increment': number; + /** + * Number of initial buy orders to create. Make sure to have enough funds to create that many orders. + */ + 'buy_count': number; + /** + * Number of initial sell orders to create. Make sure to have enough funds to create that many orders. + */ + 'sell_count': number; + 'enable_trailing_up': boolean; + 'enable_trailing_down': boolean; + 'order_by_order_trailing': boolean; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "configuration_type", + "baseName": "configuration_type", + "type": "ActionConfigurationType", + "format": "" + }, + { + "name": "symbol", + "baseName": "symbol", + "type": "string", + "format": "" + }, + { + "name": "spread", + "baseName": "spread", + "type": "number", + "format": "" + }, + { + "name": "increment", + "baseName": "increment", + "type": "number", + "format": "" + }, + { + "name": "buy_count", + "baseName": "buy_count", + "type": "number", + "format": "" + }, + { + "name": "sell_count", + "baseName": "sell_count", + "type": "number", + "format": "" + }, + { + "name": "enable_trailing_up", + "baseName": "enable_trailing_up", + "type": "boolean", + "format": "" + }, + { + "name": "enable_trailing_down", + "baseName": "enable_trailing_down", + "type": "boolean", + "format": "" + }, + { + "name": "order_by_order_trailing", + "baseName": "order_by_order_trailing", + "type": "boolean", + "format": "" + } ]; + + static getAttributeTypeMap() { + return GridConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/IndexCoin.ts b/packages/protocol/octobot_protocol_ts/models/IndexCoin.ts new file mode 100644 index 000000000..ce59af793 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/IndexCoin.ts @@ -0,0 +1,45 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* IndexCoin +*/ +export class IndexCoin { + 'name': string; + 'ratio': number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "ratio", + "baseName": "ratio", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return IndexCoin.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/IndexConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/IndexConfiguration.ts new file mode 100644 index 000000000..696aa7c46 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/IndexConfiguration.ts @@ -0,0 +1,59 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ActionConfigurationType } from '../models/ActionConfigurationType'; +import { IndexCoin } from '../models/IndexCoin'; + +/** +* IndexConfiguration +*/ +export class IndexConfiguration { + /** + * index + */ + 'configuration_type': 'index'; + 'coins': Array; + 'rebalance_trigger_min_percent': number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "configuration_type", + "baseName": "configuration_type", + "type": "ActionConfigurationType", + "format": "" + }, + { + "name": "coins", + "baseName": "coins", + "type": "Array", + "format": "" + }, + { + "name": "rebalance_trigger_min_percent", + "baseName": "rebalance_trigger_min_percent", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return IndexConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/MarketMakingConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/MarketMakingConfiguration.ts new file mode 100644 index 000000000..82405b37f --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/MarketMakingConfiguration.ts @@ -0,0 +1,52 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ActionConfigurationType } from '../models/ActionConfigurationType'; +import { MarketMakingSymbolConfiguration } from '../models/MarketMakingSymbolConfiguration'; + +/** +* Per-symbol market making parameters. +*/ +export class MarketMakingConfiguration { + /** + * market_making + */ + 'configuration_type': 'market_making'; + 'pair_settings': Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "configuration_type", + "baseName": "configuration_type", + "type": "ActionConfigurationType", + "format": "" + }, + { + "name": "pair_settings", + "baseName": "pair_settings", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return MarketMakingConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/MarketMakingFundsDistribution.ts b/packages/protocol/octobot_protocol_ts/models/MarketMakingFundsDistribution.ts new file mode 100644 index 000000000..43a07f074 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/MarketMakingFundsDistribution.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* How allocated funds are spread across ladder levels. +*/ +export type MarketMakingFundsDistribution = 'flat' | 'valley' | 'random' diff --git a/packages/protocol/octobot_protocol_ts/models/MarketMakingHedgingEngine.ts b/packages/protocol/octobot_protocol_ts/models/MarketMakingHedgingEngine.ts new file mode 100644 index 000000000..b4438e2eb --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/MarketMakingHedgingEngine.ts @@ -0,0 +1,83 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Optional cross-exchange hedging configuration. +*/ +export class MarketMakingHedgingEngine { + 'average_price_counted_minutes'?: number; + 'hedging_engine_type'?: MarketMakingHedgingEngineHedgingEngineTypeEnum; + 'hedging_exchange'?: string; + 'hedging_max_loss_threshold'?: number; + 'hedging_profit_threshold'?: number; + 'max_negative_percent_price_change'?: number; + 'max_positive_percent_price_change'?: number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "average_price_counted_minutes", + "baseName": "average_price_counted_minutes", + "type": "number", + "format": "" + }, + { + "name": "hedging_engine_type", + "baseName": "hedging_engine_type", + "type": "MarketMakingHedgingEngineHedgingEngineTypeEnum", + "format": "" + }, + { + "name": "hedging_exchange", + "baseName": "hedging_exchange", + "type": "string", + "format": "" + }, + { + "name": "hedging_max_loss_threshold", + "baseName": "hedging_max_loss_threshold", + "type": "number", + "format": "" + }, + { + "name": "hedging_profit_threshold", + "baseName": "hedging_profit_threshold", + "type": "number", + "format": "" + }, + { + "name": "max_negative_percent_price_change", + "baseName": "max_negative_percent_price_change", + "type": "number", + "format": "" + }, + { + "name": "max_positive_percent_price_change", + "baseName": "max_positive_percent_price_change", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return MarketMakingHedgingEngine.attributeTypeMap; + } + + public constructor() { + } +} + +export type MarketMakingHedgingEngineHedgingEngineTypeEnum = 'spot' | 'perpetual_futures' + diff --git a/packages/protocol/octobot_protocol_ts/models/MarketMakingOrderBookDepth.ts b/packages/protocol/octobot_protocol_ts/models/MarketMakingOrderBookDepth.ts new file mode 100644 index 000000000..78875fb10 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/MarketMakingOrderBookDepth.ts @@ -0,0 +1,45 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Order book depth parameters (cumulated volume and daily volume fraction). +*/ +export class MarketMakingOrderBookDepth { + 'cumulated_volume_percent': number; + 'percent_daily_trading_volume': number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "cumulated_volume_percent", + "baseName": "cumulated_volume_percent", + "type": "number", + "format": "" + }, + { + "name": "percent_daily_trading_volume", + "baseName": "percent_daily_trading_volume", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return MarketMakingOrderBookDepth.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/MarketMakingOrdersDistribution.ts b/packages/protocol/octobot_protocol_ts/models/MarketMakingOrdersDistribution.ts new file mode 100644 index 000000000..762abafbd --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/MarketMakingOrdersDistribution.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* How order prices are spaced across the book. +*/ +export type MarketMakingOrdersDistribution = 'linear' diff --git a/packages/protocol/octobot_protocol_ts/models/MarketMakingReferencePair.ts b/packages/protocol/octobot_protocol_ts/models/MarketMakingReferencePair.ts new file mode 100644 index 000000000..5b1562a0c --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/MarketMakingReferencePair.ts @@ -0,0 +1,75 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { TimeFrame } from '../models/TimeFrame'; + +/** +* Reference price source for market making (exchange pair, weighting, and optional formula). +*/ +export class MarketMakingReferencePair { + /** + * Exchange id, or a sentinel such as local exchange price when supported by the trading mode. + */ + 'exchange': string; + 'pair': string; + 'weight'?: number; + /** + * Optional formula overriding the default latest price for this source. + */ + 'formula'?: string; + 'time_frame'?: TimeFrame; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "exchange", + "baseName": "exchange", + "type": "string", + "format": "" + }, + { + "name": "pair", + "baseName": "pair", + "type": "string", + "format": "" + }, + { + "name": "weight", + "baseName": "weight", + "type": "number", + "format": "" + }, + { + "name": "formula", + "baseName": "formula", + "type": "string", + "format": "" + }, + { + "name": "time_frame", + "baseName": "time_frame", + "type": "TimeFrame", + "format": "" + } ]; + + static getAttributeTypeMap() { + return MarketMakingReferencePair.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/MarketMakingScheduledVolume.ts b/packages/protocol/octobot_protocol_ts/models/MarketMakingScheduledVolume.ts new file mode 100644 index 000000000..efd4d2ad9 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/MarketMakingScheduledVolume.ts @@ -0,0 +1,59 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Scheduled volume order sizing and timing in quote currency. +*/ +export class MarketMakingScheduledVolume { + 'min_amount': number; + 'max_amount': number; + 'min_interval_seconds': number; + 'max_interval_seconds': number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "min_amount", + "baseName": "min_amount", + "type": "number", + "format": "" + }, + { + "name": "max_amount", + "baseName": "max_amount", + "type": "number", + "format": "" + }, + { + "name": "min_interval_seconds", + "baseName": "min_interval_seconds", + "type": "number", + "format": "" + }, + { + "name": "max_interval_seconds", + "baseName": "max_interval_seconds", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return MarketMakingScheduledVolume.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/MarketMakingStopConditions.ts b/packages/protocol/octobot_protocol_ts/models/MarketMakingStopConditions.ts new file mode 100644 index 000000000..d9fd57a26 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/MarketMakingStopConditions.ts @@ -0,0 +1,69 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Optional holdings and volatility thresholds used for automations / stop behavior. +*/ +export class MarketMakingStopConditions { + 'min_base_holding'?: number; + 'min_quote_holding'?: number; + 'max_positive_percent_price_change'?: number; + 'max_negative_percent_price_change'?: number; + /** + * Minutes window for average price when evaluating volatility stops. + */ + 'average_price_counted_minutes'?: number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "min_base_holding", + "baseName": "min_base_holding", + "type": "number", + "format": "" + }, + { + "name": "min_quote_holding", + "baseName": "min_quote_holding", + "type": "number", + "format": "" + }, + { + "name": "max_positive_percent_price_change", + "baseName": "max_positive_percent_price_change", + "type": "number", + "format": "" + }, + { + "name": "max_negative_percent_price_change", + "baseName": "max_negative_percent_price_change", + "type": "number", + "format": "" + }, + { + "name": "average_price_counted_minutes", + "baseName": "average_price_counted_minutes", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return MarketMakingStopConditions.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/MarketMakingSymbolConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/MarketMakingSymbolConfiguration.ts new file mode 100644 index 000000000..2003df8d3 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/MarketMakingSymbolConfiguration.ts @@ -0,0 +1,171 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { MarketMakingFundsDistribution } from '../models/MarketMakingFundsDistribution'; +import { MarketMakingHedgingEngine } from '../models/MarketMakingHedgingEngine'; +import { MarketMakingOrderBookDepth } from '../models/MarketMakingOrderBookDepth'; +import { MarketMakingOrdersDistribution } from '../models/MarketMakingOrdersDistribution'; +import { MarketMakingReferencePair } from '../models/MarketMakingReferencePair'; +import { MarketMakingScheduledVolume } from '../models/MarketMakingScheduledVolume'; +import { MarketMakingStopConditions } from '../models/MarketMakingStopConditions'; + +/** +* MarketMakingSymbolConfiguration +*/ +export class MarketMakingSymbolConfiguration { + 'trading_pair': string; + 'reference_price': Array; + /** + * Minimum spread as a percentage (e.g. 0.5 for 0.5%). + */ + 'min_spread': number; + /** + * Maximum spread as a percentage. + */ + 'max_spread': number; + 'order_book_depth'?: MarketMakingOrderBookDepth; + 'scheduled_volume'?: MarketMakingScheduledVolume; + 'stop_conditions'?: MarketMakingStopConditions; + 'bids_count': number; + 'asks_count': number; + 'orders_distribution': MarketMakingOrdersDistribution; + 'funds_distribution': MarketMakingFundsDistribution; + 'exchange': string; + /** + * 0 means unlimited when supported. + */ + 'max_base_budget'?: number; + /** + * 0 means unlimited when supported. + */ + 'max_quote_budget'?: number; + 'min_base_budget'?: number; + 'min_quote_budget'?: number; + 'hedging_engine'?: MarketMakingHedgingEngine; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "trading_pair", + "baseName": "trading_pair", + "type": "string", + "format": "" + }, + { + "name": "reference_price", + "baseName": "reference_price", + "type": "Array", + "format": "" + }, + { + "name": "min_spread", + "baseName": "min_spread", + "type": "number", + "format": "" + }, + { + "name": "max_spread", + "baseName": "max_spread", + "type": "number", + "format": "" + }, + { + "name": "order_book_depth", + "baseName": "order_book_depth", + "type": "MarketMakingOrderBookDepth", + "format": "" + }, + { + "name": "scheduled_volume", + "baseName": "scheduled_volume", + "type": "MarketMakingScheduledVolume", + "format": "" + }, + { + "name": "stop_conditions", + "baseName": "stop_conditions", + "type": "MarketMakingStopConditions", + "format": "" + }, + { + "name": "bids_count", + "baseName": "bids_count", + "type": "number", + "format": "" + }, + { + "name": "asks_count", + "baseName": "asks_count", + "type": "number", + "format": "" + }, + { + "name": "orders_distribution", + "baseName": "orders_distribution", + "type": "MarketMakingOrdersDistribution", + "format": "" + }, + { + "name": "funds_distribution", + "baseName": "funds_distribution", + "type": "MarketMakingFundsDistribution", + "format": "" + }, + { + "name": "exchange", + "baseName": "exchange", + "type": "string", + "format": "" + }, + { + "name": "max_base_budget", + "baseName": "max_base_budget", + "type": "number", + "format": "" + }, + { + "name": "max_quote_budget", + "baseName": "max_quote_budget", + "type": "number", + "format": "" + }, + { + "name": "min_base_budget", + "baseName": "min_base_budget", + "type": "number", + "format": "" + }, + { + "name": "min_quote_budget", + "baseName": "min_quote_budget", + "type": "number", + "format": "" + }, + { + "name": "hedging_engine", + "baseName": "hedging_engine", + "type": "MarketMakingHedgingEngine", + "format": "" + } ]; + + static getAttributeTypeMap() { + return MarketMakingSymbolConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/Order.ts b/packages/protocol/octobot_protocol_ts/models/Order.ts new file mode 100644 index 000000000..c5b776ec9 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/Order.ts @@ -0,0 +1,172 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { CancelPolicy } from '../models/CancelPolicy'; +import { OrderGroup } from '../models/OrderGroup'; +import { OrderStatus } from '../models/OrderStatus'; +import { OrderType } from '../models/OrderType'; +import { Side } from '../models/Side'; +import { TrailingProfile } from '../models/TrailingProfile'; + +/** +* Order +*/ +export class Order { + 'id': string; + 'symbol': string; + 'price': number; + 'quantity': number; + 'filled': number; + 'exchange_id': string; + 'side': Side; + 'type': OrderType; + 'trigger_above'?: boolean; + 'reduce_only'?: boolean; + 'is_active'?: boolean; + 'status': OrderStatus; + 'created_at': string; + 'entries'?: Array; + 'update_with_triggering_order_fees'?: boolean; + 'order_group'?: OrderGroup; + 'trailing_profile'?: TrailingProfile; + 'cancel_policy'?: CancelPolicy; + 'chained_orders'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "symbol", + "baseName": "symbol", + "type": "string", + "format": "" + }, + { + "name": "price", + "baseName": "price", + "type": "number", + "format": "" + }, + { + "name": "quantity", + "baseName": "quantity", + "type": "number", + "format": "" + }, + { + "name": "filled", + "baseName": "filled", + "type": "number", + "format": "" + }, + { + "name": "exchange_id", + "baseName": "exchange_id", + "type": "string", + "format": "" + }, + { + "name": "side", + "baseName": "side", + "type": "Side", + "format": "" + }, + { + "name": "type", + "baseName": "type", + "type": "OrderType", + "format": "" + }, + { + "name": "trigger_above", + "baseName": "trigger_above", + "type": "boolean", + "format": "" + }, + { + "name": "reduce_only", + "baseName": "reduce_only", + "type": "boolean", + "format": "" + }, + { + "name": "is_active", + "baseName": "is_active", + "type": "boolean", + "format": "" + }, + { + "name": "status", + "baseName": "status", + "type": "OrderStatus", + "format": "" + }, + { + "name": "created_at", + "baseName": "created_at", + "type": "Date", + "format": "date-time" + }, + { + "name": "entries", + "baseName": "entries", + "type": "Array", + "format": "" + }, + { + "name": "update_with_triggering_order_fees", + "baseName": "update_with_triggering_order_fees", + "type": "boolean", + "format": "" + }, + { + "name": "order_group", + "baseName": "order_group", + "type": "OrderGroup", + "format": "" + }, + { + "name": "trailing_profile", + "baseName": "trailing_profile", + "type": "TrailingProfile", + "format": "" + }, + { + "name": "cancel_policy", + "baseName": "cancel_policy", + "type": "CancelPolicy", + "format": "" + }, + { + "name": "chained_orders", + "baseName": "chained_orders", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Order.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/OrderGroup.ts b/packages/protocol/octobot_protocol_ts/models/OrderGroup.ts new file mode 100644 index 000000000..50652051d --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/OrderGroup.ts @@ -0,0 +1,56 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ActiveOrderSwapStrategy } from '../models/ActiveOrderSwapStrategy'; +import { OrderGroupType } from '../models/OrderGroupType'; + +/** +* OrderGroup +*/ +export class OrderGroup { + 'id': string; + 'type'?: OrderGroupType; + 'active_order_swap_strategy'?: ActiveOrderSwapStrategy; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "type", + "baseName": "type", + "type": "OrderGroupType", + "format": "" + }, + { + "name": "active_order_swap_strategy", + "baseName": "active_order_swap_strategy", + "type": "ActiveOrderSwapStrategy", + "format": "" + } ]; + + static getAttributeTypeMap() { + return OrderGroup.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/OrderGroupType.ts b/packages/protocol/octobot_protocol_ts/models/OrderGroupType.ts new file mode 100644 index 000000000..4b85b4284 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/OrderGroupType.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Order group class name (mirrors persisted OrderGroup.__name__ in octobot_trading). +*/ +export type OrderGroupType = 'BalancedTakeProfitAndStopOrderGroup' | 'TrailingOnFilledTPBalancedOrderGroup' | 'OneCancelsTheOtherOrderGroup' diff --git a/packages/protocol/octobot_protocol_ts/models/OrderStatus.ts b/packages/protocol/octobot_protocol_ts/models/OrderStatus.ts new file mode 100644 index 000000000..adc2b57bb --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/OrderStatus.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Lifecycle state of an order. +*/ +export type OrderStatus = 'pending_creation' | 'open' | 'partially_filled' | 'filled' | 'canceled' | 'canceling' | 'closed' | 'expired' | 'rejected' | 'unknown' diff --git a/packages/protocol/octobot_protocol_ts/models/OrderSummary.ts b/packages/protocol/octobot_protocol_ts/models/OrderSummary.ts new file mode 100644 index 000000000..f8ffe84e0 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/OrderSummary.ts @@ -0,0 +1,45 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* OrderSummary +*/ +export class OrderSummary { + 'id': string; + 'symbol': string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "symbol", + "baseName": "symbol", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return OrderSummary.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/OrderType.ts b/packages/protocol/octobot_protocol_ts/models/OrderType.ts new file mode 100644 index 000000000..89887dfde --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/OrderType.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Exchange order type. +*/ +export type OrderType = 'limit' | 'market' | 'stop_loss' | 'stop_loss_limit' | 'take_profit' | 'take_profit_limit' diff --git a/packages/protocol/octobot_protocol_ts/models/Position.ts b/packages/protocol/octobot_protocol_ts/models/Position.ts new file mode 100644 index 000000000..f8401de21 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/Position.ts @@ -0,0 +1,91 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { PositionStatus } from '../models/PositionStatus'; +import { Side } from '../models/Side'; + +/** +* Position +*/ +export class Position { + 'id': string; + 'symbol': string; + 'side': Side; + 'quantity': number; + 'entry_price': number; + 'mark_price': number; + 'liquidation_price': number; + 'status': PositionStatus; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "symbol", + "baseName": "symbol", + "type": "string", + "format": "" + }, + { + "name": "side", + "baseName": "side", + "type": "Side", + "format": "" + }, + { + "name": "quantity", + "baseName": "quantity", + "type": "number", + "format": "" + }, + { + "name": "entry_price", + "baseName": "entry_price", + "type": "number", + "format": "" + }, + { + "name": "mark_price", + "baseName": "mark_price", + "type": "number", + "format": "" + }, + { + "name": "liquidation_price", + "baseName": "liquidation_price", + "type": "number", + "format": "" + }, + { + "name": "status", + "baseName": "status", + "type": "PositionStatus", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Position.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/PositionStatus.ts b/packages/protocol/octobot_protocol_ts/models/PositionStatus.ts new file mode 100644 index 000000000..2f4540cee --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/PositionStatus.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* PositionStatus +*/ +export type PositionStatus = 'open' | 'liquidated' | 'liquidating' | 'auto_deleveraging' diff --git a/packages/protocol/octobot_protocol_ts/models/PositionSummary.ts b/packages/protocol/octobot_protocol_ts/models/PositionSummary.ts new file mode 100644 index 000000000..6d6d19685 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/PositionSummary.ts @@ -0,0 +1,45 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* PositionSummary +*/ +export class PositionSummary { + 'id': string; + 'symbol': string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "symbol", + "baseName": "symbol", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return PositionSummary.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/RSIMomentumEvaluatorConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/RSIMomentumEvaluatorConfiguration.ts new file mode 100644 index 000000000..d2e325d06 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/RSIMomentumEvaluatorConfiguration.ts @@ -0,0 +1,65 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { EvaluatorType } from '../models/EvaluatorType'; + +/** +* RSIMomentumEvaluatorConfiguration +*/ +export class RSIMomentumEvaluatorConfiguration { + /** + * RSIMomentumEvaluator + */ + 'configuration_type': 'RSIMomentumEvaluator'; + 'period_length': number; + 'short_threshold': number; + 'long_threshold': number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "configuration_type", + "baseName": "configuration_type", + "type": "EvaluatorType", + "format": "" + }, + { + "name": "period_length", + "baseName": "period_length", + "type": "number", + "format": "" + }, + { + "name": "short_threshold", + "baseName": "short_threshold", + "type": "number", + "format": "" + }, + { + "name": "long_threshold", + "baseName": "long_threshold", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return RSIMomentumEvaluatorConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/RefreshAccountsConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/RefreshAccountsConfiguration.ts new file mode 100644 index 000000000..eca2cfe12 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/RefreshAccountsConfiguration.ts @@ -0,0 +1,51 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { UserActionType } from '../models/UserActionType'; + +/** +* RefreshAccountsConfiguration +*/ +export class RefreshAccountsConfiguration { + /** + * accounts_refresh + */ + 'action_type': 'accounts_refresh'; + 'account_ids'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "action_type", + "baseName": "action_type", + "type": "UserActionType", + "format": "" + }, + { + "name": "account_ids", + "baseName": "account_ids", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return RefreshAccountsConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/Side.ts b/packages/protocol/octobot_protocol_ts/models/Side.ts new file mode 100644 index 000000000..1fd3f1d83 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/Side.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Order execution side. +*/ +export type Side = 'buy' | 'sell' diff --git a/packages/protocol/octobot_protocol_ts/models/StopAutomationConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/StopAutomationConfiguration.ts new file mode 100644 index 000000000..efd85ce33 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/StopAutomationConfiguration.ts @@ -0,0 +1,51 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { UserActionType } from '../models/UserActionType'; + +/** +* StopAutomationConfiguration +*/ +export class StopAutomationConfiguration { + 'id': string; + /** + * automation_stop + */ + 'action_type': 'automation_stop'; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "action_type", + "baseName": "action_type", + "type": "UserActionType", + "format": "" + } ]; + + static getAttributeTypeMap() { + return StopAutomationConfiguration.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/StrategiesState.ts b/packages/protocol/octobot_protocol_ts/models/StrategiesState.ts new file mode 100644 index 000000000..cec90f48f --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/StrategiesState.ts @@ -0,0 +1,46 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Strategy } from '../models/Strategy'; + +/** +* StrategiesState +*/ +export class StrategiesState { + 'version': string; + 'strategies': Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "version", + "baseName": "version", + "type": "string", + "format": "" + }, + { + "name": "strategies", + "baseName": "strategies", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return StrategiesState.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/Strategy.ts b/packages/protocol/octobot_protocol_ts/models/Strategy.ts new file mode 100644 index 000000000..04beb980c --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/Strategy.ts @@ -0,0 +1,81 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { StrategyConfiguration } from '../models/StrategyConfiguration'; + +/** +* Strategy +*/ +export class Strategy { + 'id': string; + 'version': string; + 'name'?: string; + 'description'?: string; + 'created_at'?: string; + 'updated_at'?: string; + 'configuration': StrategyConfiguration; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "version", + "baseName": "version", + "type": "string", + "format": "" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "description", + "baseName": "description", + "type": "string", + "format": "" + }, + { + "name": "created_at", + "baseName": "created_at", + "type": "Date", + "format": "date-time" + }, + { + "name": "updated_at", + "baseName": "updated_at", + "type": "Date", + "format": "date-time" + }, + { + "name": "configuration", + "baseName": "configuration", + "type": "StrategyConfiguration", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Strategy.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/StrategyConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/StrategyConfiguration.ts new file mode 100644 index 000000000..d60054146 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/StrategyConfiguration.ts @@ -0,0 +1,50 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { CopyConfiguration } from '../models/CopyConfiguration'; +import { DCAConfiguration } from '../models/DCAConfiguration'; +import { GenericProcessConfiguration } from '../models/GenericProcessConfiguration'; +import { GenericWorkflowConfiguration } from '../models/GenericWorkflowConfiguration'; +import { GridConfiguration } from '../models/GridConfiguration'; +import { IndexConfiguration } from '../models/IndexConfiguration'; +import { MarketMakingConfiguration } from '../models/MarketMakingConfiguration'; + +/** + * @type StrategyConfiguration + * Type + * @export + */ +export type StrategyConfiguration = CopyConfiguration | DCAConfiguration | GenericProcessConfiguration | GenericWorkflowConfiguration | GridConfiguration | IndexConfiguration | MarketMakingConfiguration; + +/** +* @type StrategyConfigurationClass +* @export +*/ +export class StrategyConfigurationClass { + static readonly discriminator: string | undefined = "configuration_type"; + + static readonly mapping: {[index: string]: string} | undefined = { + "CopyConfiguration": "CopyConfiguration", + "DCAConfiguration": "DCAConfiguration", + "GenericProcessConfiguration": "GenericProcessConfiguration", + "GenericWorkflowConfiguration": "GenericWorkflowConfiguration", + "GridConfiguration": "GridConfiguration", + "IndexConfiguration": "IndexConfiguration", + "MarketMakingConfiguration": "MarketMakingConfiguration", + }; +} + + + + + + diff --git a/packages/protocol/octobot_protocol_ts/models/StrategyReference.ts b/packages/protocol/octobot_protocol_ts/models/StrategyReference.ts new file mode 100644 index 000000000..95035f8ac --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/StrategyReference.ts @@ -0,0 +1,52 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* StrategyReference +*/ +export class StrategyReference { + 'id': string; + 'version': string; + 'emit_signals'?: boolean; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "version", + "baseName": "version", + "type": "string", + "format": "" + }, + { + "name": "emit_signals", + "baseName": "emit_signals", + "type": "boolean", + "format": "" + } ]; + + static getAttributeTypeMap() { + return StrategyReference.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/TaskStatus.ts b/packages/protocol/octobot_protocol_ts/models/TaskStatus.ts new file mode 100644 index 000000000..22cb4850f --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/TaskStatus.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* TaskStatus +*/ +export type TaskStatus = 'pending' | 'scheduled' | 'periodic' | 'running' | 'completed' | 'failed' diff --git a/packages/protocol/octobot_protocol_ts/models/TimeFrame.ts b/packages/protocol/octobot_protocol_ts/models/TimeFrame.ts new file mode 100644 index 000000000..9bdd82834 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/TimeFrame.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* TimeFrame +*/ +export type TimeFrame = '1m' | '5m' | '15m' | '30m' | '1h' | '4h' | '6h' | '8h' | '12h' | '1d' | '3d' | '1w' diff --git a/packages/protocol/octobot_protocol_ts/models/Trade.ts b/packages/protocol/octobot_protocol_ts/models/Trade.ts new file mode 100644 index 000000000..27bb93d3f --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/Trade.ts @@ -0,0 +1,99 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { OrderStatus } from '../models/OrderStatus'; +import { OrderType } from '../models/OrderType'; +import { Side } from '../models/Side'; + +/** +* Trade +*/ +export class Trade { + 'id': string; + 'trade_id': string; + 'type': OrderType; + 'symbol': string; + 'side': Side; + 'quantity': number; + 'price': number; + 'status': OrderStatus; + 'executed_at': string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "trade_id", + "baseName": "trade_id", + "type": "string", + "format": "" + }, + { + "name": "type", + "baseName": "type", + "type": "OrderType", + "format": "" + }, + { + "name": "symbol", + "baseName": "symbol", + "type": "string", + "format": "" + }, + { + "name": "side", + "baseName": "side", + "type": "Side", + "format": "" + }, + { + "name": "quantity", + "baseName": "quantity", + "type": "number", + "format": "" + }, + { + "name": "price", + "baseName": "price", + "type": "number", + "format": "" + }, + { + "name": "status", + "baseName": "status", + "type": "OrderStatus", + "format": "" + }, + { + "name": "executed_at", + "baseName": "executed_at", + "type": "Date", + "format": "date-time" + } ]; + + static getAttributeTypeMap() { + return Trade.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/TradeSummary.ts b/packages/protocol/octobot_protocol_ts/models/TradeSummary.ts new file mode 100644 index 000000000..c0827b3aa --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/TradeSummary.ts @@ -0,0 +1,45 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* TradeSummary +*/ +export class TradeSummary { + 'id': string; + 'symbol': string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "symbol", + "baseName": "symbol", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return TradeSummary.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/TradingType.ts b/packages/protocol/octobot_protocol_ts/models/TradingType.ts new file mode 100644 index 000000000..efa6a860e --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/TradingType.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* TradingType +*/ +export type TradingType = 'spot' | 'futures' | 'options' | 'margin' diff --git a/packages/protocol/octobot_protocol_ts/models/TrailingProfile.ts b/packages/protocol/octobot_protocol_ts/models/TrailingProfile.ts new file mode 100644 index 000000000..51ac5035b --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/TrailingProfile.ts @@ -0,0 +1,48 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { TrailingProfileType } from '../models/TrailingProfileType'; + +/** +* TrailingProfile +*/ +export class TrailingProfile { + 'type': TrailingProfileType; + 'details'?: any; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "TrailingProfileType", + "format": "" + }, + { + "name": "details", + "baseName": "details", + "type": "any", + "format": "" + } ]; + + static getAttributeTypeMap() { + return TrailingProfile.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/TrailingProfileType.ts b/packages/protocol/octobot_protocol_ts/models/TrailingProfileType.ts new file mode 100644 index 000000000..5f262b4eb --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/TrailingProfileType.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Trailing profile discriminator (mirrors octobot_trading TrailingProfileTypes values). +*/ +export type TrailingProfileType = 'filled_take_profit' diff --git a/packages/protocol/octobot_protocol_ts/models/UserAction.ts b/packages/protocol/octobot_protocol_ts/models/UserAction.ts new file mode 100644 index 000000000..5f6398f17 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/UserAction.ts @@ -0,0 +1,78 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { UserActionConfiguration } from '../models/UserActionConfiguration'; +import { UserActionResult } from '../models/UserActionResult'; +import { UserActionStatus } from '../models/UserActionStatus'; + +/** +* UserAction +*/ +export class UserAction { + 'id': string; + 'status'?: UserActionStatus; + 'created_at'?: string; + 'updated_at'?: string; + 'configuration'?: UserActionConfiguration; + 'result'?: UserActionResult; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string", + "format": "" + }, + { + "name": "status", + "baseName": "status", + "type": "UserActionStatus", + "format": "" + }, + { + "name": "created_at", + "baseName": "created_at", + "type": "Date", + "format": "date-time" + }, + { + "name": "updated_at", + "baseName": "updated_at", + "type": "Date", + "format": "date-time" + }, + { + "name": "configuration", + "baseName": "configuration", + "type": "UserActionConfiguration", + "format": "" + }, + { + "name": "result", + "baseName": "result", + "type": "UserActionResult", + "format": "" + } ]; + + static getAttributeTypeMap() { + return UserAction.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/packages/protocol/octobot_protocol_ts/models/UserActionConfiguration.ts b/packages/protocol/octobot_protocol_ts/models/UserActionConfiguration.ts new file mode 100644 index 000000000..3304f8a4d --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/UserActionConfiguration.ts @@ -0,0 +1,50 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { CreateAccountConfiguration } from '../models/CreateAccountConfiguration'; +import { CreateAutomationConfiguration } from '../models/CreateAutomationConfiguration'; +import { DeleteAccountConfiguration } from '../models/DeleteAccountConfiguration'; +import { EditAccountConfiguration } from '../models/EditAccountConfiguration'; +import { EditAutomationConfiguration } from '../models/EditAutomationConfiguration'; +import { RefreshAccountsConfiguration } from '../models/RefreshAccountsConfiguration'; +import { StopAutomationConfiguration } from '../models/StopAutomationConfiguration'; + +/** + * @type UserActionConfiguration + * Type + * @export + */ +export type UserActionConfiguration = CreateAccountConfiguration | CreateAutomationConfiguration | DeleteAccountConfiguration | EditAccountConfiguration | EditAutomationConfiguration | RefreshAccountsConfiguration | StopAutomationConfiguration; + +/** +* @type UserActionConfigurationClass +* @export +*/ +export class UserActionConfigurationClass { + static readonly discriminator: string | undefined = "action_type"; + + static readonly mapping: {[index: string]: string} | undefined = { + "account_create": "CreateAccountConfiguration", + "account_delete": "DeleteAccountConfiguration", + "account_edit": "EditAccountConfiguration", + "accounts_refresh": "RefreshAccountsConfiguration", + "automation_create": "CreateAutomationConfiguration", + "automation_edit": "EditAutomationConfiguration", + "automation_stop": "StopAutomationConfiguration", + }; +} + + + + + + diff --git a/packages/protocol/octobot_protocol_ts/models/UserActionResult.ts b/packages/protocol/octobot_protocol_ts/models/UserActionResult.ts new file mode 100644 index 000000000..7cf50ec88 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/UserActionResult.ts @@ -0,0 +1,35 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AccountActionResult } from '../models/AccountActionResult'; +import { AutomationActionResult } from '../models/AutomationActionResult'; + +/** + * @type UserActionResult + * Type + * @export + */ +export type UserActionResult = AccountActionResult | AutomationActionResult; + +/** +* @type UserActionResultClass +* @export +*/ +export class UserActionResultClass { + static readonly discriminator: string | undefined = "result_type"; + + static readonly mapping: {[index: string]: string} | undefined = { + "account": "AccountActionResult", + "automation": "AutomationActionResult", + }; +} + diff --git a/packages/protocol/octobot_protocol_ts/models/UserActionResultType.ts b/packages/protocol/octobot_protocol_ts/models/UserActionResultType.ts new file mode 100644 index 000000000..bbb749ce0 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/UserActionResultType.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* UserActionResultType +*/ +export type UserActionResultType = 'automation' | 'account' diff --git a/packages/protocol/octobot_protocol_ts/models/UserActionStatus.ts b/packages/protocol/octobot_protocol_ts/models/UserActionStatus.ts new file mode 100644 index 000000000..de26234b9 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/UserActionStatus.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* UserActionStatus +*/ +export type UserActionStatus = 'pending' | 'running' | 'completed' | 'failed' diff --git a/packages/protocol/octobot_protocol_ts/models/UserActionType.ts b/packages/protocol/octobot_protocol_ts/models/UserActionType.ts new file mode 100644 index 000000000..ca9726060 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/UserActionType.ts @@ -0,0 +1,17 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* UserActionType +*/ +export type UserActionType = 'automation_create' | 'automation_edit' | 'automation_stop' | 'account_create' | 'account_edit' | 'account_delete' | 'accounts_refresh' diff --git a/packages/protocol/octobot_protocol_ts/models/UserActionsState.ts b/packages/protocol/octobot_protocol_ts/models/UserActionsState.ts new file mode 100644 index 000000000..5dc50ae5e --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/UserActionsState.ts @@ -0,0 +1,46 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { UserAction } from '../models/UserAction'; + +/** +* UserActionsState +*/ +export class UserActionsState { + 'version': string; + 'user_actions'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "version", + "baseName": "version", + "type": "string", + "format": "" + }, + { + "name": "user_actions", + "baseName": "user_actions", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return UserActionsState.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/UserDataState.ts b/packages/protocol/octobot_protocol_ts/models/UserDataState.ts new file mode 100644 index 000000000..a23360188 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/UserDataState.ts @@ -0,0 +1,54 @@ +/** + * OctoBot protocol types + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { AutomationState } from '../models/AutomationState'; +import { UserAction } from '../models/UserAction'; + +/** +* UserDataState +*/ +export class UserDataState { + 'version': string; + 'automations'?: Array; + 'user_actions'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "version", + "baseName": "version", + "type": "string", + "format": "" + }, + { + "name": "automations", + "baseName": "automations", + "type": "Array", + "format": "" + }, + { + "name": "user_actions", + "baseName": "user_actions", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return UserDataState.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/packages/protocol/octobot_protocol_ts/models/index.ts b/packages/protocol/octobot_protocol_ts/models/index.ts new file mode 100644 index 000000000..019bc01a3 --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/models/index.ts @@ -0,0 +1,84 @@ +export * from "./Account"; +export * from "./AccountActionResult"; +export * from "./AccountActionResultErrorMessage"; +export * from "./AccountDetails"; +export * from "./AccountReference"; +export * from "./AccountState"; +export * from "./AccountStatus"; +export * from "./AccountStatusMessage"; +export * from "./AccountType"; +export * from "./AccountsState"; +export * from "./Action"; +export * from "./ActionConfigurationType"; +export * from "./ActiveOrderSwapStrategy"; +export * from "./ActiveOrderSwapStrategyType"; +export * from "./Asset"; +export * from "./AutomationActionResult"; +export * from "./AutomationActionResultErrorMessage"; +export * from "./AutomationConfiguration"; +export * from "./AutomationMetadata"; +export * from "./AutomationState"; +export * from "./BlockchainAccount"; +export * from "./CancelPolicy"; +export * from "./CancelPolicyType"; +export * from "./CopiedAccount"; +export * from "./CopiedAsset"; +export * from "./CopyConfiguration"; +export * from "./CreateAccountConfiguration"; +export * from "./CreateAutomationConfiguration"; +export * from "./DCAConfiguration"; +export * from "./DeleteAccountConfiguration"; +export * from "./EMAMomentumEvaluatorConfiguration"; +export * from "./EditAccountConfiguration"; +export * from "./EditAutomationConfiguration"; +export * from "./EvaluatorConfiguration"; +export * from "./EvaluatorConfigurationConfiguration"; +export * from "./EvaluatorType"; +export * from "./ExchangeAccount"; +export * from "./GenericAccount"; +export * from "./GenericProcessConfiguration"; +export * from "./GenericWorkflowConfiguration"; +export * from "./GridConfiguration"; +export * from "./IndexCoin"; +export * from "./IndexConfiguration"; +export * from "./MarketMakingConfiguration"; +export * from "./MarketMakingFundsDistribution"; +export * from "./MarketMakingHedgingEngine"; +export * from "./MarketMakingOrderBookDepth"; +export * from "./MarketMakingOrdersDistribution"; +export * from "./MarketMakingReferencePair"; +export * from "./MarketMakingScheduledVolume"; +export * from "./MarketMakingStopConditions"; +export * from "./MarketMakingSymbolConfiguration"; +export * from "./Order"; +export * from "./OrderGroup"; +export * from "./OrderGroupType"; +export * from "./OrderStatus"; +export * from "./OrderSummary"; +export * from "./OrderType"; +export * from "./Position"; +export * from "./PositionStatus"; +export * from "./PositionSummary"; +export * from "./RSIMomentumEvaluatorConfiguration"; +export * from "./RefreshAccountsConfiguration"; +export * from "./Side"; +export * from "./StopAutomationConfiguration"; +export * from "./StrategiesState"; +export * from "./Strategy"; +export * from "./StrategyConfiguration"; +export * from "./StrategyReference"; +export * from "./TaskStatus"; +export * from "./TimeFrame"; +export * from "./Trade"; +export * from "./TradeSummary"; +export * from "./TradingType"; +export * from "./TrailingProfile"; +export * from "./TrailingProfileType"; +export * from "./UserAction"; +export * from "./UserActionConfiguration"; +export * from "./UserActionResult"; +export * from "./UserActionResultType"; +export * from "./UserActionStatus"; +export * from "./UserActionType"; +export * from "./UserActionsState"; +export * from "./UserDataState"; diff --git a/packages/protocol/octobot_protocol_ts/package.json b/packages/protocol/octobot_protocol_ts/package.json new file mode 100644 index 000000000..342edf62c --- /dev/null +++ b/packages/protocol/octobot_protocol_ts/package.json @@ -0,0 +1,9 @@ +{ + "name": "@drakkar.software/octobot-protocol", + "version": "0.3.0", + "description": "TypeScript types generated from OctoBot OpenAPI schema", + "types": "./models/index.ts", + "files": ["models"], + "license": "GPL-3.0", + "sideEffects": false +} diff --git a/packages/protocol/package.json b/packages/protocol/package.json index 094a1ecc2..fec9e5f3c 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -5,9 +5,12 @@ "description": "JSON Schema protocol types and codegen", "scripts": { "test:models": "python -m unittest discover -s test", + "test:postprocess": "node --test test/postprocess-typescript.test.mjs", + "test:postprocess:codegen": "node --test test/postprocess-typescript.codegen.test.mjs", + "test": "npm run test:postprocess && npm run test:postprocess:codegen && npm run test:models", "generate:python": "node scripts/clean-protocol-codegen-output.mjs python && openapi-generator-cli generate -i openapi.json -g python -o . -t openapi_generator_templates/python --global-property models,modelTests=true,supportingFiles=__init__.py --additional-properties packageName=octobot_protocol,useOneOfDiscriminatorLookup=true && npm run test:models", "gen": "npm run generate:python", - "generate:typescript": "node scripts/clean-protocol-codegen-output.mjs typescript && openapi-generator-cli generate -i openapi.json -g typescript -o octobot_protocol_ts --global-property models --additional-properties supportsES6=true,npmName=@drakkar.software/octobot-protocol,npmVersion=0.1.0,useOneOfDiscriminatorLookup=true", + "generate:typescript": "node scripts/clean-protocol-codegen-output.mjs typescript && openapi-generator-cli generate -i openapi.json -g typescript -o octobot_protocol_ts --global-property models --additional-properties modelPropertyNaming=original,stringEnums=true,supportsES6=true,useOneOfDiscriminatorLookup=true && node scripts/postprocess-protocol-typescript.mjs", "generate:rust": "node scripts/clean-protocol-codegen-output.mjs rust && openapi-generator-cli generate -i openapi.json -g rust -o octobot_protocol_rs --global-property models --additional-properties packageName=octobot_protocol_rs,useOneOfDiscriminatorLookup=true", "generate:all": "npm run generate:python && npm run generate:typescript && npm run generate:rust" }, diff --git a/packages/protocol/scripts/clean-protocol-codegen-output.mjs b/packages/protocol/scripts/clean-protocol-codegen-output.mjs index c108c4955..f38caab68 100644 --- a/packages/protocol/scripts/clean-protocol-codegen-output.mjs +++ b/packages/protocol/scripts/clean-protocol-codegen-output.mjs @@ -18,7 +18,7 @@ const targets = { }, typescript: { dir: path.join(protocolDir, "octobot_protocol_ts"), - keep: new Set(["README.md", "package.json", "index.js", "index.d.ts"]), + keep: new Set(["package.json"]), }, rust: { dir: path.join(protocolDir, "octobot_protocol_rs"), @@ -27,6 +27,7 @@ const targets = { test: { dir: path.join(protocolDir, "test"), keep: new Set(), + keepPredicate: (name) => name.endsWith(".mjs"), }, }; @@ -38,15 +39,14 @@ function cleanTarget(key) { ); process.exit(1); } - const { dir, keep } = config; + const { dir, keep, keepPredicate } = config; if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); return; } for (const entryName of fs.readdirSync(dir)) { - if (keep.has(entryName)) { - continue; - } + if (keep.has(entryName)) continue; + if (keepPredicate && keepPredicate(entryName)) continue; fs.rmSync(path.join(dir, entryName), { recursive: true, force: true }); } } diff --git a/packages/protocol/scripts/postprocess-protocol-typescript.lib.mjs b/packages/protocol/scripts/postprocess-protocol-typescript.lib.mjs new file mode 100644 index 000000000..7900a0aa0 --- /dev/null +++ b/packages/protocol/scripts/postprocess-protocol-typescript.lib.mjs @@ -0,0 +1,49 @@ +const HTTP_IMPORT = /^import \{ HttpFile \} from '\.\.\/http\/http';\n/m; +const DATE_FIELD = /^(\s*'[^']+'?\??:\s*)Date\b/gm; +const ENUM_BLOCK = /export enum (\w+) \{([^}]+)\}/g; + +export function stripHttpImport(src) { + return src.replace(HTTP_IMPORT, ""); +} + +export function dateFieldsToString(src) { + return src.replace(DATE_FIELD, "$1string"); +} + +export function enumBlockToUnion(src) { + return src.replace(ENUM_BLOCK, (whole, name, body) => { + const union = body + .split(",") + .map((line) => { + const match = line.match(/=\s*'([^']*)'/); + return match ? `'${match[1]}'` : null; + }) + .filter(Boolean) + .join(" | "); + return union ? `export type ${name} = ${union}` : whole; + }); +} + +export function narrowDiscriminatorField(src, field, literal) { + const pattern = new RegExp(`(['\"]${field}['\"]\\??:\\s*)[A-Za-z_]\\w*(?=\\s*[;,])`, "g"); + return src.replace(pattern, `$1'${literal}'`); +} + +export function collectVariantNarrowings(openapi) { + const result = new Map(); + const schemas = openapi?.components?.schemas; + if (!schemas) return result; + for (const [name, schema] of Object.entries(schemas)) { + const props = schema?.properties; + if (!props) continue; + for (const [propName, prop] of Object.entries(props)) { + if (!prop || typeof prop !== "object") continue; + if (typeof prop.$ref !== "string") continue; + if (typeof prop.description !== "string") continue; + const list = result.get(name) ?? []; + list.push({ field: propName, literal: prop.description }); + result.set(name, list); + } + } + return result; +} diff --git a/packages/protocol/scripts/postprocess-protocol-typescript.mjs b/packages/protocol/scripts/postprocess-protocol-typescript.mjs new file mode 100644 index 000000000..142f4ebb4 --- /dev/null +++ b/packages/protocol/scripts/postprocess-protocol-typescript.mjs @@ -0,0 +1,33 @@ +#!/usr/bin/env node +import fs from "node:fs"; +import path from "node:path"; +import url from "node:url"; +import { stripHttpImport, dateFieldsToString, enumBlockToUnion, narrowDiscriminatorField, collectVariantNarrowings } from "./postprocess-protocol-typescript.lib.mjs"; + +const protocolDir = path.dirname(path.dirname(url.fileURLToPath(import.meta.url))); +const modelsDir = path.join(protocolDir, "octobot_protocol_ts", "models"); +const openapiPath = path.join(protocolDir, "openapi.json"); + +const openapi = JSON.parse(fs.readFileSync(openapiPath, "utf8")); +const narrowings = collectVariantNarrowings(openapi); + +const files = fs.readdirSync(modelsDir).filter((f) => f.endsWith(".ts") && f !== "index.ts"); +for (const file of files) { + const full = path.join(modelsDir, file); + const src = fs.readFileSync(full, "utf8"); + const variant = path.basename(file, ".ts"); + let next = stripHttpImport(src); + next = dateFieldsToString(next); + next = enumBlockToUnion(next); + for (const { field, literal } of narrowings.get(variant) ?? []) { + next = narrowDiscriminatorField(next, field, literal); + } + if (next !== src) fs.writeFileSync(full, next); +} + +const barrel = files + .map((f) => path.basename(f, ".ts")) + .sort() + .map((name) => `export * from "./${name}";`) + .join("\n") + "\n"; +fs.writeFileSync(path.join(modelsDir, "index.ts"), barrel); diff --git a/packages/protocol/test/postprocess-typescript.codegen.test.mjs b/packages/protocol/test/postprocess-typescript.codegen.test.mjs new file mode 100644 index 000000000..8d837eefb --- /dev/null +++ b/packages/protocol/test/postprocess-typescript.codegen.test.mjs @@ -0,0 +1,61 @@ +import { test } from "node:test"; +import assert from "node:assert/strict"; +import fs from "node:fs"; +import path from "node:path"; +import url from "node:url"; + +const protocolDir = path.dirname(path.dirname(url.fileURLToPath(import.meta.url))); +const modelsDir = path.join(protocolDir, "octobot_protocol_ts", "models"); + +function read(name) { + return fs.readFileSync(path.join(modelsDir, name), "utf8"); +} + +const exists = fs.existsSync(path.join(modelsDir, "MarketMakingConfiguration.ts")); +const skip = !exists; +const reason = skip ? "skipped: codegen output missing — run `npm run generate:typescript` first" : undefined; + +test("real codegen output narrows MarketMakingConfiguration.configuration_type", { skip: reason }, () => { + const src = read("MarketMakingConfiguration.ts"); + assert.match(src, /'configuration_type':\s*'market_making'\s*;/); + assert.doesNotMatch(src, /'configuration_type'\s*:\s*ActionConfigurationType\b/); +}); + +test("real codegen output narrows DCAConfiguration.configuration_type", { skip: reason }, () => { + const src = read("DCAConfiguration.ts"); + assert.match(src, /'configuration_type':\s*'dca'\s*;/); +}); + +test("real codegen output narrows CreateAutomationConfiguration.action_type", { skip: reason }, () => { + const src = read("CreateAutomationConfiguration.ts"); + assert.match(src, /'action_type':\s*'automation_create'\s*;/); +}); + +test("real codegen output narrows RSIMomentumEvaluatorConfiguration.configuration_type", { skip: reason }, () => { + const src = read("RSIMomentumEvaluatorConfiguration.ts"); + assert.match(src, /'configuration_type':\s*'RSIMomentumEvaluator'\s*;/); +}); + +test("real codegen output keeps ActionConfigurationType as full union", { skip: reason }, () => { + const src = read("ActionConfigurationType.ts"); + assert.match(src, /'market_making'.*'dca'.*'index'.*'grid'.*'copy'.*'generic_process'.*'generic_workflow'/s); +}); + +test("real codegen output keeps UserActionType as full union", { skip: reason }, () => { + const src = read("UserActionType.ts"); + assert.match(src, /'automation_create'.*'accounts_refresh'/s); +}); + +test("real codegen output has no leftover HttpFile import", { skip: reason }, () => { + const files = fs.readdirSync(modelsDir).filter((f) => f.endsWith(".ts")); + for (const f of files) { + assert.doesNotMatch(read(f), /HttpFile/, `${f} still references HttpFile`); + } +}); + +test("real codegen output has no Date typings on properties", { skip: reason }, () => { + const files = fs.readdirSync(modelsDir).filter((f) => f.endsWith(".ts")); + for (const f of files) { + assert.doesNotMatch(read(f), /^\s*'[^']+'?\??:\s*Date\b/m, `${f} still has Date property typing`); + } +}); diff --git a/packages/protocol/test/postprocess-typescript.test.mjs b/packages/protocol/test/postprocess-typescript.test.mjs new file mode 100644 index 000000000..8f1cbb315 --- /dev/null +++ b/packages/protocol/test/postprocess-typescript.test.mjs @@ -0,0 +1,135 @@ +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { + stripHttpImport, + dateFieldsToString, + enumBlockToUnion, + narrowDiscriminatorField, + collectVariantNarrowings, +} from "../scripts/postprocess-protocol-typescript.lib.mjs"; + +test("stripHttpImport removes the broken HttpFile import line", () => { + const src = "import { HttpFile } from '../http/http';\nexport type X = string;\n"; + assert.equal(stripHttpImport(src), "export type X = string;\n"); +}); + +test("stripHttpImport leaves source untouched when no HttpFile import", () => { + const src = "export type X = string;\n"; + assert.equal(stripHttpImport(src), src); +}); + +test("dateFieldsToString rewrites Date typings to string", () => { + const src = " 'created_at'?: Date;\n 'updated_at': Date;\n"; + assert.equal( + dateFieldsToString(src), + " 'created_at'?: string;\n 'updated_at': string;\n", + ); +}); + +test("dateFieldsToString leaves non-Date typings alone", () => { + const src = " 'count'?: number;\n"; + assert.equal(dateFieldsToString(src), src); +}); + +test("enumBlockToUnion converts string enums to literal unions", () => { + const src = "export enum Color {\n Red = 'red',\n Blue = 'blue'\n}"; + assert.equal(enumBlockToUnion(src), "export type Color = 'red' | 'blue'"); +}); + +test("enumBlockToUnion leaves non-string enums untouched", () => { + const src = "export enum Code {\n Ok = 200,\n NotFound = 404\n}"; + assert.equal(enumBlockToUnion(src), src); +}); + +test("narrowDiscriminatorField replaces shared enum reference with literal", () => { + const src = "export class MM {\n 'configuration_type'?: ActionConfigurationType;\n 'pair_settings': string[];\n}\n"; + const out = narrowDiscriminatorField(src, "configuration_type", "market_making"); + assert.match(out, /'configuration_type'\?:\s*'market_making';/); +}); + +test("narrowDiscriminatorField handles required field (no `?`)", () => { + const src = " 'action_type': UserActionType;\n"; + const out = narrowDiscriminatorField(src, "action_type", "automation_create"); + assert.equal(out, " 'action_type': 'automation_create';\n"); +}); + +test("narrowDiscriminatorField leaves attributeTypeMap string entries alone", () => { + const src = ` [\n {\n "name": "configuration_type",\n "baseName": "configuration_type",\n "type": "ActionConfigurationType",\n "format": ""\n }\n ];\n`; + const out = narrowDiscriminatorField(src, "configuration_type", "market_making"); + assert.equal(out, src); +}); + +test("narrowDiscriminatorField does not match other fields", () => { + const src = " 'name'?: string;\n 'configuration_type'?: ActionConfigurationType;\n"; + const out = narrowDiscriminatorField(src, "configuration_type", "market_making"); + assert.match(out, /'name'\?:\s*string;/); + assert.match(out, /'configuration_type'\?:\s*'market_making';/); +}); + +test("collectVariantNarrowings reads $ref+description properties", () => { + const openapi = { + components: { + schemas: { + ActionConfigurationType: { type: "string", enum: ["market_making", "dca"] }, + MarketMakingConfiguration: { + properties: { + configuration_type: { + $ref: "#/components/schemas/ActionConfigurationType", + description: "market_making", + }, + pair_settings: { type: "array" }, + }, + }, + DCAConfiguration: { + properties: { + configuration_type: { + $ref: "#/components/schemas/ActionConfigurationType", + description: "dca", + }, + }, + }, + }, + }, + }; + const result = collectVariantNarrowings(openapi); + assert.deepEqual(result.get("MarketMakingConfiguration"), [ + { field: "configuration_type", literal: "market_making" }, + ]); + assert.deepEqual(result.get("DCAConfiguration"), [ + { field: "configuration_type", literal: "dca" }, + ]); +}); + +test("collectVariantNarrowings ignores properties without description", () => { + const openapi = { + components: { + schemas: { + Foo: { + properties: { + kind: { $ref: "#/components/schemas/Kind" }, + }, + }, + }, + }, + }; + assert.equal(collectVariantNarrowings(openapi).size, 0); +}); + +test("collectVariantNarrowings ignores properties without $ref", () => { + const openapi = { + components: { + schemas: { + Foo: { + properties: { + kind: { type: "string", description: "some kind" }, + }, + }, + }, + }, + }; + assert.equal(collectVariantNarrowings(openapi).size, 0); +}); + +test("collectVariantNarrowings returns empty map on empty spec", () => { + assert.equal(collectVariantNarrowings({}).size, 0); +});