openapi: 3.0.1
info:
  title: Trade Order Management
  version: v1
  description: |
    # Getting Started
    For more information on how to start using our APIs, please refer to the Getting
    Started guide. 
    ***
    # Servers
    SEI's API products have various environments available depending on your stage of integration. The server URL should correspond with the environment of your application. Please refer to the Getting Started guide for a list of all environments and URLs. 
    
    **Note** For all Client applications, the Two-way TLS URL must be used. This is essential in order for the client server making API calls to establish a successful Two-Way SSL communication with SEI.
    ***
servers:
  - url: 'https://test.mtls.api.seic.com'
    description: Two-way SSL Test Server.
  - url: 'https://mtls.api.seic.com'
    description: Two-way SSL Production Server.
  - url: 'https://build.api.seic.com'
    description: Integration Server with masked data.
  - url: 'https://sandbox.api.seic.com'
    description: Sandbox Server with masked data. 
  - url: 'https://test.api.seic.com'
    description: Test Server with unmasked data.
  - url: 'https://api.seic.com'
    description: Production Server with unmasked data.
paths:
  /v1/order/tradetickets:
    get:
      tags:
      - Trade Ticket
      summary: Communicates ATB Trade Orders to Client for new order quantities, order quality changes, rebalance the price, and status.
      security:
        - oauth2: []
          bearerAuth: []
          ApiKeyAuth: []
      parameters:
      - name: id
        in: query
        description: Trade ticket id.
        schema:
          type: integer
      - name: status
        in: query
        description: Trade ticket status (Original or Refresh).
        schema:
          type: string
      - name: limit
        in: query
        description: The number of records per page or request.
        schema:
          type: integer
          format: int32
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --location --request GET \
            'https://api.seic.com/v1/order/tradetickets' \
            --header 'Authorization: Bearer YOUR_ACCESSTOKEN' \
            --header 'AppKey: YOUR_APPKEY' 
      responses:
        200:
          description: OK- The request has succeeded and the response has been returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PageableResultticketRotation'
              examples: 
                Response Example:
                  $ref: '#/components/examples/PageableResultticketRotationExample'
        400:
          description: Bad request - The server cannot or will not process the request
            due to an inaccurate request submitted by the client application.  Please
            resubmit the request after making the required corrections indicated in
            the error response.  For more Info on SEI Error Standards please refer
            to the API Standards FAQ under Support.
        401:
          description: Unauthorized - Invalid authentication details have been provided.  Also
            useful to trigger an authorization pop up if the API is used from a browser.
        403:
          description: Forbidden-The SEI Server understood the request but refuses
            to fulfill it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
        404:
          description: Not Found- The requested resource or the underlying resource
            does not exist.  Please resubmit the request after making the required
            corrections
        405:
          description: Validation exception
        500:
          description: Internal Server Error - The server was unable to fulfill the
            request due to an unknown condition. Please contact SEI for support. For
            More Info please refer to the "Response & Errors" FAQ under support.
    post:
      tags:
      - Trade Ticket
      summary: Communicates trade instructions from Client one record at a time and indicates what specific tradeTicketIds are part of the same Model change (batchId).
      security:
        - oauth2: []
          bearerAuth: []
          ApiKeyAuth: []
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --location --request POST \
            'https://api.seic.com/v1/order/tradetickets' \
            --header 'Authorization: Bearer YOUR_ACCESSTOKEN' \
            --header 'AppKey: YOUR_APPKEY' 
            --data-raw '{
              "batchId": "12",
              "batchSize": 1,
              "tradeTicketId": 123456789,
              "masterOrderId": 123456789,
              "strategyCode": "AB1",
              "side": "Buy",
              "cusip": "123456789",
              "ticker": "ABCD US",
              "securityName": "test",
              "target": 1,
              "orderGenerationPrice": 123.45,
              "minimumCash": 0.0012,
              "affectsModel": true,
              "comments": "John"
              }'
      requestBody:
        content:
          application/json':
            schema:
              $ref: '#/components/schemas/TradeTicket'
            examples:
              Request Example:
                $ref: '#/components/examples/TradeTicketRequestExample'
        required: true
      responses:
        202:
          description: Accepted-The request has been accepted for processing, but
            the processing may not be complete
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradeTicketResponse'
              examples:
                Response Example:
                  $ref: '#/components/examples/TradeTicketResponseExample'
        400:
          description: Bad request - The server cannot or will not process the request
            due to an inaccurate request submitted by the client application.  Please
            resubmit the request after making the required corrections indicated in
            the error response.  For more Info on SEI Error Standards please refer
            to the API Standards FAQ under Support.
        401:
          description: Unauthorized - Invalid authentication details have been provided.  Also
            useful to trigger an authorization pop up if the API is used from a browser.
        403:
          description: Forbidden-The SEI Server understood the request but refuses
            to fulfill it.
        404:
          description: Not Found- The requested resource or the underlying resource
            does not exist.  Please resubmit the request after making the required
            corrections
        500:
          description: Internal Server Error - The server was unable to fulfill the
            request due to an unknown condition. Please contact SEI for support. For
            More Info please refer to the "Response & Errors" FAQ under support.
      x-codegen-request-body-name: requestPayload
components:
  securitySchemes:
    oauth2:
      type: oauth2
      description: To access any API, first obtain an OAuth Token. Refer to the Access Token documentation for more information. The token has a 60 minutes active TTL and 30 minutes inactive TTL. An application making SEI API Requests from a Client/Server or Server/Server type of infrastructure will leverage the grant_type client_credentials while minting an OAuth from the Token API. 
      flows:
        clientCredentials:
          tokenUrl: /v2/oauthtoken
          scopes: {}
    bearerAuth:
      type: http
      scheme: bearer
      description: After successfully obtaining an OAuth token, pass the access_token value to the desired API endpoint by including the header parameter 'Authorization' with the value 'Bearer access_token'. 
    ApiKeyAuth:
      type: apiKey
      in: header
      name: AppKey
      description: Pass the header parameter 'AppKey' to the API endpoint to authenticate your application. This value can be found within the 'My Apps' page. This value uniquely identifies the registered application. 
  schemas:
    TradeTicket:
      type: object
      properties:
        batchId:
          type: string
          description: "SEI Accounting system generated identifier for batch representing a group of journal entries"
          example: 12
        batchSize:
          type: integer
          description: ""
          example: 1
        tradeTicketId:
          type: integer
          description: "Unique number (up to 8 characters)"
          example: 123456789
        masterOrderId:
          type: integer
          description: "Unique number (up to 8 characters)"
          example: 123456789
        strategyCode:
          type: string
          description: ""
          example: AB1
        side:
          type: string
          description: "Trade Instruction - Buy, Sell"
          example: Buy
        ticker:
          type: string
          description: "A ticker symbol used to identify a stock."
          example: ABCD US
        cusip:
          type: string
          description: "A 9-digit alphanumeric securities identifier assigned by the Committee on Uniform Security Identification Procedures (CUSIP) for the purposes of facilitating clearing and settlement of trades."
          example: 123456789
        securityName:
          type: string
          description: ""
          example: test
        target:
          type: integer
          description: ""
          example: 1
        orderGenerationPrice:
          type: number
          description: "Price supplied for APL."
          example: 123.45
        minimumCash:
          type: number
          description: ""
          example: 0.0012
        affectsModel:
          type: boolean
          description: ""
          example: true
        comments:
          type: string
          description: "Description of the business purpose of the transaction, free text field limited to 255 characters, can be unique for each row in a batch"
          example: Purpose of the transaction
    TradeTicketResponse:
      type: object
      properties:
        batchId:
          type: string
          description: "SEI Accounting system generated identifier for batch representing a group of journal entries"
          example: 1234
        tradeTicketId:
          type: integer
          description: "Unique number (up to 8 characters)"
          example: 123456789
        jobComplete:
          type: boolean
          description: "All validated trade tickets have been received for stated batchId (see batchId description) and are to be imported to the RMT."
          example: true
    ticketRotation:
      type: object
      properties:
        batchId:
          type: string
          description: "SEI Accounting system generated identifier for batch representing a group of journal entries"
          example: 123
        tradeTicketId:
          type: integer
          description: "Unique number (up to 8 characters)"
          example: 10
        masterOrderId:
          type: integer
          description: "Unique number (up to 8 characters)"
          example: 12345
        orderId:
          type: string
          description: "The unique identifier of the order."
          example: 2
        omniBus:
          type: string
          description: "Transactions occurring within an omnibus account will appear under the name of the associated broker, leaving the details of individual investors private"
          example: PW_SMA_GL
        side:
          type: string
          description: "Trade Instruction - Buy, Sell"
          example: BUY
        ticker:
          type: string
          description: "A ticker symbol used to identify a stock."
          example: XOM 1.912 03/06/20
        cusip:
          type: string
          description: "A 9-digit alphanumeric securities identifier assigned by the Committee on Uniform Security Identification Procedures (CUSIP) for the purposes of facilitating clearing and settlement of trades."
          example: 30231GAG7
        quantity:
          type: integer
          description: "The current face amount, or quantity of shares held, for an investment or noted on a transaction."
          example: 1234
        orderGenerationPrice:
          type: integer
          description: "Price supplied for APL."
          example: 11.145
        rebalancePrice:
          type: integer
          description: "Actual price used to generate the trade in APL"
          example: 10
        status:
          type: string
          description: "Defines the status for a specific pending transaction, such as 'Active' or 'Cancel'."
          example: Original
        createDate:
          type: string
          description: "Initial create timestamp for the record. Datetime is Eastern Standard Time (EST). Date Format is UTC YYYY-MM-DDThh:mm:ss:mmm"
          format: date-time
        changeDate:
          type: string
          description: "Latest date the entity relevant to the API was modified. Datetime is Eastern Standard Time (EST). Date Format is UTC YYYY-MM-DDThh:mm:ss:mmm"
          format: date-time
    ErrorModel:
      type: object
      properties:
        code:
          type: string
          description: gateway.{serviceName}.{verb representing the failure}
        message:
          type: string
          description: Error message in short
        trackingId:
          type: string
          description: Apigee request tracking identifier
        transient:
          type: boolean
          description: ""
        errors:
          type: array
          description: ""
          items:
            $ref: '#/components/schemas/Errors'
        debugInfo:
          type: array
          description: ""
          items:
            $ref: '#/components/schemas/DebugInfo'
      description: ""
    Errors:
      type: object
      properties:
        field:
          type: string
          description: The field name that caused error
        reason:
          type: string
          description: ""
        location:
          type: string
          description: The location of the error field
      description: ""
    DebugInfo:
      type: object
      properties:
        type:
          type: string
          description: Type of error
        reason:
          type: string
          description: ""
        remediationMsg:
          type: string
          description: ""
      description: ""
    Paging:
      type: object
      properties:
        totalCount:
          type: integer
          format: int32
          description: The total number of records.
        limit:
          type: integer
          format: int32
          description: Number of records per page. Many responses have a maximum of 50 records per page.
        first:
          type: string
          description: API URL for the first page of data with respect to the request context.
        last:
          type: string
          description: In pagination, this is the ID that points to the start of the last page.
        previous:
          type: string
          description: API URL for the previous page of data with respect to the request context.
        next:
          type: string
          description: URL to the next page of records with respect to the API request.
        self:
          type: string
          description: Current Request URL.
    PageableResultticketRotation:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ticketRotation'
        paging:
          $ref: '#/components/schemas/Paging'
  examples:
    PageableResultticketRotationExample:
      value:
        data:
          - batchId: '123'
            tradeTicketId: 10
            masterOrderId: 12345
            orderId: 2
            omnibus: AB_ABC_GL
            side: BUY
            ticker: XXX 1.912 03/06/20
            cusip: 30123ABC7
            quantity: 1234
            orderGenerationPrice: 11.145
            rebalancePrice: 10
            status: Original
            createDate: '2019-06-26T12:01:12.487'
            changeDate: '2019-06-26T17:06:20.647'
        paging:
          totalCount: 125
          limit: 1
          first: 'https://api.seic.com/v1/order/tradetickets?status=Original&before=MQ==&after=MQ==&limit=1'
          last: 'https://api.seic.com/v1/order/tradetickets?status=Original&before=MTI1&after=MTI1&limit=1'
          previous: null
          next: 'https://api.seic.com/v1/order/tradetickets?status=Original&before=Mg==&after=Mg==&limit=1'
          self: 'https://api.seic.com/v1/order/tradetickets?status=Original&limit=1'
    TradeTicketRequestExample:
      value:
        data:
          batchId: 12
          batchSize: 1
          tradeTicketId: 123456789
          masterOrderId: 123456789
          strategyCode: AB1
          side: Buy
          cusip: 123456789
          ticker: ABCD US
          securityName: test
          target: 1
          orderGenerationPrice: 123.45
          minimumCash: 0.0012
          affectsModel: true
          comments: John
    TradeTicketResponseExample:
      value:
        data:
          batchId: 1234
          tradeTicketId: 123456789
          jobComplete: true