openapi: 3.0.1 info: title: Services.Ens description: The Event Notification Services service group provides end points for setting up subscriptions for clients activities. version: 2.2.225+4e98bd104e x-framework-version: 37.0.4+b9d872a2f3 x-machine: SIMOAWEB11-DK1 servers: - url: https://gateway.saxobank.com/sim/openapi paths: /ens/v1/activities: get: tags: - Client Activities summary: Get activities for specified client/Account. description: Returns a list of activities specified by the parameters in the request. operationId: EnsActivitiesGetActivitiesAsync parameters: - name: $skiptoken in: query description: Specifies an entity id to start retrieving entries from. This is normally only used in generated nextlinks. schema: type: string example: B17D8890-3C7A-4A47-A9AA-01B022ED03A5 - name: $top in: query description: The number of entries to return from the beginning of the collection schema: minimum: 0 type: integer format: int32 default: 0 example: 1 - name: AccountGroupKey in: query description: "account group key for accounts used in retrieving the trade data.\r\n If specified, activities of the specified account will be returned/published otherwise activities of all accounts represented by ClientKey." schema: title: "account group key for accounts used in retrieving the trade data.\r\n If specified, activities of the specified account will be returned/published otherwise activities of all accounts represented by ClientKey." minLength: 1 type: string x-type-name: AccountGroupKey example: valueaf04a06e-3c0c-4f62-b66c-6e6eda035173 - name: AccountKey in: query description: "Unique key identifying the account used in retrieving the trade data.\r\n If specified, activities of the specified account will be returned/published otherwise activities of all accounts represented by ClientKey." schema: title: "Unique key identifying the account used in retrieving the trade data.\r\n If specified, activities of the specified account will be returned/published otherwise activities of all accounts represented by ClientKey." minLength: 1 type: string x-type-name: AccountKey example: 18649353-7c02-4a3a-affe-3bc0d9486607 - name: Activities in: query description: Specification of activity typese to return in results. required: true schema: title: Specification of activity typese to return in results. type: array items: $ref: '#/components/schemas/ActivityType' example: - Positions - name: CANotificationTypes in: query description: Corporate action notification type to get the response for. schema: title: Corporate action notification type to get the response for. type: array items: $ref: '#/components/schemas/CANotificationType' example: - Update - name: ClientKey in: query description: "Unique key identifying the client.\r\n If specified, activities of the specified client will be returned/published otherwise for logged in client." schema: title: "Unique key identifying the client.\r\n If specified, activities of the specified client will be returned/published otherwise for logged in client." minLength: 1 type: string x-type-name: ClientKey example: 3bc254fa-7c84-40ed-8876-ec9886409356 - name: Duration in: query description: The order duration type. schema: title: The order duration type. allOf: - $ref: '#/components/schemas/OpenOrderDuration' example: FillOrKill - name: ExpirationDateTime in: query description: The expiration date should only be set if the duration type is GoodTillDate. schema: title: The expiration date should only be set if the duration type is GoodTillDate. type: string format: date-time x-type-name: UtcDateTime example: '2022-04-11T12:45:29.7789990+00:00' - name: FieldGroups in: query description: Specification of field groups to return in results. schema: title: Specification of field groups to return in results. type: array items: $ref: '#/components/schemas/ActivityFieldGroup' example: - ExchangeInfo - name: FromDateTime in: query description: 'If specified, activities starting FromDateTime will be returned/published. Default returns current day activities' schema: title: 'If specified, activities starting FromDateTime will be returned/published. Default returns current day activities' type: string format: date-time x-type-name: UtcDateTime example: '2022-04-11T12:45:29.7789990+00:00' - name: IncludeSubAccounts in: query description: 'If specified true, activities of sub-clients will also be returned/published.' schema: title: 'If specified true, activities of sub-clients will also be returned/published.' type: boolean example: true - name: OrderStatuses in: query description: List of order statuses. schema: title: List of order statuses. type: array items: $ref: '#/components/schemas/OrderStatus' example: - Cancelled - name: OrderTypes in: query description: List of order types. schema: title: List of order types. type: array items: $ref: '#/components/schemas/PlaceableOrderType' example: - TraspasoIn - name: PositionEventFilter in: query description: Specify position event filter if any. Default is PositionEventFilter.All. schema: title: Specify position event filter if any. Default is PositionEventFilter.All. allOf: - $ref: '#/components/schemas/PositionEventFilter' example: TradesOnly - name: SequenceId in: query description: "If specified and message with SequenceId available in ENS cache, streaming of events start from SequenceId.\r\n If sequenceId not found in ENS system, Subscription Error with \"Sequence id unavailable\"\r\n If not specified and FromDateTime is not specified, subscription will be real-time subscription." schema: title: "If specified and message with SequenceId available in ENS cache, streaming of events start from SequenceId.\r\n If sequenceId not found in ENS system, Subscription Error with \"Sequence id unavailable\"\r\n If not specified and FromDateTime is not specified, subscription will be real-time subscription." type: string example: 1c891f8f-05f8-447a-b996-50ed2812fb3b - name: TimeOnMargin in: query description: "Time the client has been on margin.\r\n If specified, margin activities with greater or equal to the time specified otherwise all activities." schema: title: "Time the client has been on margin.\r\n If specified, margin activities with greater or equal to the time specified otherwise all activities." type: string example: '00:00:00.0000128' - name: ToDateTime in: query description: 'If specified, activities ending ToDateTime will be returned/published.' schema: title: 'If specified, activities ending ToDateTime will be returned/published.' type: string format: date-time x-type-name: UtcDateTime example: '2022-04-11T12:45:29.7789990+00:00' responses: '200': description: Indicates that the request was performed correctly. content: application/json: schema: $ref: '#/components/schemas/ActivityResponseListResult' example: Data: [ ] '400': description: Bad Request content: application/json: schema: required: - ErrorCode - Message type: object properties: ErrorCode: enum: - InvalidAccountKey - InvalidArguments - InvalidClientKey - InvalidModelState - UnauthorizedAccountKey - UnauthorizedClientKey type: string x-enum-descriptions: InvalidModelState: One or more properties of the request are invalid! InvalidArguments: Arguments Are Not Provided InvalidClientKey: ClientKey is not valid InvalidAccountKey: AccountKey is not valid UnauthorizedClientKey: User can not view activities for client UnauthorizedAccountKey: User can not view activities for account Message: type: string ModelState: $ref: '#/components/schemas/ModelStateDictionary' '401': $ref: '#/components/responses/Unauthorized' '503': $ref: '#/components/responses/ServiceUnavailable' '429': $ref: '#/components/responses/TooManyRequests' security: - OpenApiOAuthSecurityScheme: [ ] - OpenApiJWTSecurityScheme: [ ] x-required-permissions: personal: Read '/ens/v1/activities/subscriptions/{ContextId}': delete: tags: - Client Activities summary: Remove multiple subscriptions description: 'Removes multiple all subscriptions for the current session on this resource, and frees all resources on the server.' operationId: EnsActivitiesDeleteSubscriptions parameters: - name: ContextId in: path description: The context id part of the streaming session (used to identify the subscription within a streaming session). required: true schema: type: string example: '29931122' - name: Tag in: query description: Optional. Remove only subscriptions that are marked with specified tag. schema: type: string example: PAGE2 responses: '204': description: No Content '202': description: Subscription delete request will be processed eventually. '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '503': $ref: '#/components/responses/ServiceUnavailable' '429': $ref: '#/components/responses/TooManyRequests' security: - OpenApiOAuthSecurityScheme: [ ] - OpenApiJWTSecurityScheme: [ ] x-required-permissions: personal: Subscribe '/ens/v1/activities/subscriptions/{ContextId}/{ReferenceId}': delete: tags: - Client Activities summary: Remove subscription description: Removes subscription for the current session identified by subscription id. operationId: EnsActivitiesDeleteSubscription parameters: - name: ContextId in: path description: Unique streaming context ID part of the streaming session. required: true schema: type: string example: '29931122' - name: ReferenceId in: path description: Unique ID of the subscription required: true schema: type: string example: NP6783 responses: '204': description: No Content '202': description: Subscription delete request will be processed eventually. '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '503': $ref: '#/components/responses/ServiceUnavailable' '429': $ref: '#/components/responses/TooManyRequests' security: - OpenApiOAuthSecurityScheme: [ ] - OpenApiJWTSecurityScheme: [ ] x-required-permissions: personal: Subscribe /ens/v1/activities/subscriptions: post: tags: - Client Activities summary: Create a subscription for client events description: Sets up an active subscription to listen client events. operationId: EnsActivitiesAddSubscriptionAsync requestBody: content: application/json: schema: $ref: '#/components/schemas/ActivitySubscriptionRequest' example: Arguments: AccountGroupKey: mroYddvgiGqqudzBPn8daA== AccountKey: mroYddvgiGqqudzBPn8daA== Activities: - AccountFundings - MarginCalls - Orders - Positions ClientKey: URpoxLBgX2I33Af3IhCvHg== FieldGroups: - DisplayAndFormat - ExchangeInfo FromDateTime: '2015-02-02T01:02:03Z' IncludeSubAccounts: false SequenceId: '37456' ContextId: Context_20221031081659106 ReferenceId: M_344 RefreshRate: 0 responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/ActivitySubscriptionResponse' example: ContextId: Context_20221031081659111 InactivityTimeout: 30 ReferenceId: M_344 RefreshRate: 0 Snapshot: Data: [ ] State: Active '400': description: Bad Request content: application/json: schema: required: - ErrorCode - Message type: object properties: ErrorCode: enum: - InvalidAccountKey - InvalidArguments - InvalidClientKey - InvalidModelState - SequenceIdUnavailable - UnauthorizedAccountKey - UnauthorizedClientKey - UnsupportedSubscriptionFormat type: string x-enum-descriptions: InvalidModelState: One or more properties of the request are invalid! UnsupportedSubscriptionFormat: Error code returned when a subscription format that isn't supported by the publisher is requested. InvalidArguments: Arguments Are Not Provided SequenceIdUnavailable: SequenceId Unavailable InvalidClientKey: ClientKey is not valid InvalidAccountKey: AccountKey is not valid UnauthorizedClientKey: User can not view activities for client UnauthorizedAccountKey: User can not view activities for account Message: type: string ModelState: $ref: '#/components/schemas/ModelStateDictionary' '409': description: Conflict content: application/json: schema: required: - ErrorCode - Message type: object properties: ErrorCode: enum: - SubscriptionLimitExceeded type: string x-enum-descriptions: SubscriptionLimitExceeded: 'Error code returned when more than the maximum allowed number of subscriptions for a specified type, is exceeded.' Message: type: string ModelState: $ref: '#/components/schemas/ModelStateDictionary' '401': $ref: '#/components/responses/Unauthorized' '503': $ref: '#/components/responses/ServiceUnavailable' '429': $ref: '#/components/responses/TooManyRequests' security: - OpenApiOAuthSecurityScheme: [ ] - OpenApiJWTSecurityScheme: [ ] x-required-permissions: personal: Subscribe x-streaming-type: $ref: '#/components/schemas/ActivityResponseDomainEvent' components: schemas: ActivityFieldGroup: title: Specification of field group to include additional data in results. enum: - DisplayAndFormat - ExchangeInfo type: string x-enum-descriptions: ExchangeInfo: Adds information about the instrument's exchange. DisplayAndFormat: Display and Format. ActivityResponse: title: Represents streaming data for activities subscription. type: object properties: AccountId: title: Identifies the account involved in the transaction. type: string AccountKey: title: Identifies the account key involved in the transaction. type: string ActivityTime: title: Represents activity time. type: string format: date-time x-type-name: UtcDateTime ActivityType: title: Represents type of data included in response. allOf: - $ref: '#/components/schemas/ActivityType' ClientId: title: Identifies the client involved in the transaction. type: string ClientKey: title: Identifies the client key involved in the transaction. type: string SequenceId: title: Unique number representing activity response. type: string additionalProperties: false ActivityResponseDomainEvent: type: object properties: Data: title: 'The type of data transported by the DomainEvent instance (e.g. price update, position list update etc.).' allOf: - $ref: '#/components/schemas/ActivityResponse' PartitionNumber: title: The partition number if this DomainEvent is a partition. type: integer format: int32 ReferenceId: title: 'Client specified id, which is sent back to the client with every data update.' type: string Timestamp: title: The UTC date and time of the event. type: string format: date-time x-type-name: UtcDateTime TotalPartitions: title: The total number of partitions if this DomainEvent is a partition. type: integer format: int32 additionalProperties: false ActivityResponseListResult: type: object properties: Data: type: array items: $ref: '#/components/schemas/ActivityResponse' description: The collection of entities for this feed. MaxRows: type: number description: The maximum number of rows that can be returned (if applicable). __count: type: number description: The total count of items in the feed. __next: type: string description: The link for the next page of items in the feed. additionalProperties: false ActivitySubscriptionRequest: title: Represent activity subscription request. required: - ContextId - ReferenceId type: object properties: ContextId: title: "The streaming context id that this request is associated with.\r\n This parameter must only contain letters (a-z) and numbers (0-9) as well as - (dash) and _ (underscore). It is case insensitive. Max length is 50 characters." pattern: '^[a-zA-Z0-9_-]{1,50}$' type: string x-display-order: 1 ReferenceId: title: "Mandatory client specified reference id for the subscription.\r\n This parameter must only contain alphanumberic characters as well as - (dash) and _ (underscore). Cannot start with _. It is case insensitive. Max length is 50 characters." pattern: '^[a-zA-Z0-9-][a-zA-Z0-9_-]{0,49}$' type: string x-display-order: 2 Arguments: title: Arguments for the subscription request. allOf: - $ref: '#/components/schemas/SubscriptionActivityRequest' Format: title: "Optional Media type (RFC 2046) of the serialized data updates that are streamed to the client.\r\n Currently only application/json and application/x-protobuf is supported.\r\n If an unrecognized format is specified, the subscription end point will return HTTP status code 400 - Bad format." type: string RefreshRate: title: "Optional custom refresh rate, measured in milliseconds, between each data update.\r\n Note that it is not possible to get a refresh rate lower than the rate specified in the\r\n customer service level agreement (SLA)." maximum: 2147483647 minimum: 0 type: integer format: int32 ReplaceReferenceId: title: Reference id of the subscription that should be replaced. pattern: '^[a-zA-Z0-9-][a-zA-Z0-9_-]{0,49}$' type: string Tag: title: Optional client specified tag used for grouping subscriptions. type: string additionalProperties: false ActivitySubscriptionResponse: title: Represents client\account activities subscription response. type: object properties: ContextId: title: The streaming context id that this response is associated with. type: string x-display-order: 1 ReferenceId: title: The reference id that (along with streaming context id and session id) identifies the subscription (within the context of a specific service/subscription type) type: string x-display-order: 2 Format: title: 'The media type (RFC 2046), of the serialized data updates that are streamed to the client.' type: string InactivityTimeout: title: The time (in seconds) that the client should accept the subscription to be inactive before considering it invalid. type: integer format: int32 RefreshRate: title: Actual refresh rate assigned to the subscription according to the customers SLA. type: integer format: int32 Snapshot: title: 'Snapshot of the current data on hand, when subscription was created.' allOf: - $ref: '#/components/schemas/ActivityResponseListResult' State: title: The value "Active". type: string description: This property is kept for backwards compatibility. Tag: title: 'Client specified tag assigned to the subscription, if specified in the request.' type: string additionalProperties: false ActivityType: title: Represents activity types supported by open-apis. enum: - AccountDepreciation - AccountFundings - CorporateActions - MarginCalls - Orders - PositionDepreciation - Positions type: string x-enum-descriptions: Orders: Order related information. Positions: Position related information. MarginCalls: Margin call information. AccountFundings: Funding Information. AccountDepreciation: Account depreciation information. PositionDepreciation: Position Depreciation information. CorporateActions: Corporate action information CANotificationType: title: Corporate action notification type enum: - Announcement - Payment - Update type: string x-enum-descriptions: Announcement: Corporate action announcement. Update: Corporate action update. Payment: Corporate action payment. CorporateActionEventFilter: title: Corporate action event filter type: object properties: CANotificationTypes: title: List of corporate action notification types. type: array items: $ref: '#/components/schemas/CANotificationType' additionalProperties: false ModelStateDictionary: type: object additionalProperties: type: array items: type: string OpenOrderDuration: title: Order durations enum: - AtTheClose - AtTheOpening - DayOrder - FillOrKill - GoodForPeriod - GoodTillCancel - GoodTillDate - ImmediateOrCancel - Unknown type: string x-enum-descriptions: Unknown: Unspecified duration GoodTillCancel: Good Till Cancel - working until explicitly cancelled DayOrder: Day order - working in all session until trade date roll FillOrKill: Fill or kill ImmediateOrCancel: Fill or fill partially and cancel remaining AtTheOpening: Working at the opening auction only AtTheClose: Working at the closing auction only GoodTillDate: Working untill specified date GoodForPeriod: Working for specified period OrderDuration: title: "The time frame during which the order is valid.\r\n If the DurationType is GoodTillDate, then an ExpirationDateTime must also be provided." type: object properties: DurationType: title: The order duration type. allOf: - $ref: '#/components/schemas/OpenOrderDuration' ExpirationDate: title: 'The expiration date, should only be set if the duration type is GoodTillDate.' type: string format: date-time x-type-name: UtcDateTime ExpirationDateContainsTime: title: 'The value indicating whether the ExpirationDateTime field contains the time. Notice, that the value can only be true for GoodTillDate duration type and the time must be provided in the ExpirationDateTime.' type: boolean ExpirationDateTime: title: "The expiration date (and optionally time), should only be set if the duration type is GoodTillDate.\r\n If the field contains the time, it must always be expressed in the exchange local time and the ExpirationDateContainsTime property must me set to true. \r\n Time zone indication must never be added. The time part should be in the following format:\r\n HH:mm, where HH is 24 hour clock. Seconds and milliseconds are not allowed." type: string format: date-time x-type-name: UtcDateTime ExpiryTimeOnExchange: title: '(Deprecated) Expiry time for GoodTillDate order, Format can be "HH:mm, where HH is 24 hour clock.".' type: string description: The field has been obsoleted and has no effect. Use ExpirationDateTime and ExpirationDateContainsTime instead. deprecated: true additionalProperties: false OrderEventFilter: title: Order event filter type: object properties: Duration: title: Order duration allOf: - $ref: '#/components/schemas/OrderDuration' OrderStatuses: title: List of order statuses. type: array items: $ref: '#/components/schemas/OrderStatus' OrderTypes: title: List of order types. type: array items: $ref: '#/components/schemas/PlaceableOrderType' additionalProperties: false OrderStatus: title: Represents order status enum: - Cancelled - Changed - DoneForDay - Expired - Fill - FinalFill - Placed - TrailingStopOrderMove type: string x-enum-descriptions: Placed: Order placed. Changed: Order changed. Cancelled: Order cancelled. Fill: Received fill on order. FinalFill: Received final fill on order. DoneForDay: Order is done for day. Expired: Order expired. TrailingStopOrderMove: Movement in trailing Stop Order PlaceableOrderType: title: Placeable order type enum: - Algorithmic - DealCapture - GuaranteedStop - Limit - Market - PreviouslyQuoted - Stop - StopIfTraded - StopLimit - Switch - TrailingStop - TrailingStopIfTraded - Traspaso - TraspasoIn - TriggerBreakout - TriggerLimit - TriggerStop type: string x-enum-descriptions: Market: Market order type Limit: Limit order type StopIfTraded: StopIfTraded order type Stop: Stop order type StopLimit: StopLimit order type TrailingStopIfTraded: TrailingStopIfTraded order type TrailingStop: Trailingstop order type Algorithmic: Algorithmic order type Switch: Switch order type Traspaso: Traspaso order type TraspasoIn: TrasapasoIn order type GuaranteedStop: GuaranteedStop order type PreviouslyQuoted: Previously quoted order type TriggerLimit: Similar to Limit order type but used only with Trigger orders TriggerStop: Similar to Stop order type but used only with Trigger orders TriggerBreakout: A Breakout Order (Trigger order with up and down prices) DealCapture: "Deal Capture Order. Specify to capture trades, which are already registered on\r\n Exchange, into Saxo System. Currently supported for selected partners only." PositionEventFilter: title: Position event filter. Default value is All. enum: - All - TradesOnly type: string x-enum-descriptions: TradesOnly: Positions events related fills or allocations. All: All positions events. SubscriptionActivityRequest: title: Subscription request required: - Activities type: object properties: AccountGroupKey: title: "account group key for accounts used in retrieving the trade data.\r\n If specified, activities of the specified account will be returned/published otherwise activities of all accounts represented by ClientKey." minLength: 1 type: string x-type-name: AccountGroupKey AccountKey: title: "Unique key identifying the account used in retrieving the trade data.\r\n If specified, activities of the specified account will be returned/published otherwise activities of all accounts represented by ClientKey." minLength: 1 type: string x-type-name: AccountKey Activities: title: Specification of activity typese to return in results. type: array items: $ref: '#/components/schemas/ActivityType' ClientKey: title: "Unique key identifying the client.\r\n If specified, activities of the specified client will be returned/published otherwise for logged in client." minLength: 1 type: string x-type-name: ClientKey CorporateActionEventFilter: title: 'Specify corporate action event filter, if any.' allOf: - $ref: '#/components/schemas/CorporateActionEventFilter' FieldGroups: title: Specification of field groups to return in results. type: array items: $ref: '#/components/schemas/ActivityFieldGroup' FromDateTime: title: 'If specified, activities starting FromDateTime will be returned/published. Default returns current day activities' type: string format: date-time x-type-name: UtcDateTime IncludeSubAccounts: title: 'If specified true, activities of sub-clients will also be returned/published.' type: boolean OrderEventFilter: title: Specify order event filter if any. allOf: - $ref: '#/components/schemas/OrderEventFilter' PositionEventFilter: title: Specify position event filter if any. Default is PositionEventFilter.All. allOf: - $ref: '#/components/schemas/PositionEventFilter' SequenceId: title: "If specified and message with SequenceId available in ENS cache, streaming of events start from SequenceId.\r\n If sequenceId not found in ENS system, Subscription Error with \"Sequence id unavailable\"\r\n If not specified and FromDateTime is not specified, subscription will be real-time subscription." type: string TimeOnMargin: title: "Time the client has been on margin.\r\n If specified, margin activities with greater or equal to the time specified otherwise all activities." type: string ToDateTime: title: 'If specified, activities ending ToDateTime will be returned/published.' type: string format: date-time x-type-name: UtcDateTime additionalProperties: false responses: BadRequest: description: One or more of the provided parameters are invalid. content: application/json: schema: required: - ErrorCode - Message type: object properties: ErrorCode: enum: - InvalidRequest type: string x-enum-descriptions: InvalidRequest: Default error code returned when it cannot be determined which part of the request is malformed. Message: type: string ModelState: $ref: '#/components/schemas/ModelStateDictionary' ServiceUnavailable: description: Service Unavailable. TooManyRequests: description: The request was rejected due to rate limit being exceeded. Unauthorized: description: Indicates that the request was rejected because the 'Authorization' header was missing in the request or contained an invalid security token. securitySchemes: OpenApiJWTSecurityScheme: type: http scheme: bearer bearerFormat: JWT OpenApiOAuthSecurityScheme: type: oauth2 flows: authorizationCode: authorizationUrl: https://sim.logonvalidation.net/authorize tokenUrl: https://sim.logonvalidation.net/token scopes: { } tags: - name: Client Activities description: Provides subscription endpoints to stream client related events.