> ## Documentation Index
> Fetch the complete documentation index at: https://api.alphainsider.com/llms.txt
> Use this file to discover all available pages before exploring further.

# newOrder

> Create a new open order. Must pass `amount` or `total` not both.<br/><br/>For TradingView or webhook integrations with percentage based order actions, see [newOrderWebhook](/resources/webhooks/neworderwebhook) or [newOrderAllocations](/resources/trades/newOrderAllocations) api endpoint.



## OpenAPI

````yaml /openapi.yaml post /newOrder
openapi: 3.1.0
info:
  title: AlphaInsider
  version: '1.0'
  description: >-
    The official API and websocket documentation for
    [AlphaInsider.com](https://alphainsider.com/)
servers:
  - url: https://alphainsider.com/api
security: []
tags:
  - name: Introduction
  - name: Authentication
  - name: Users
  - name: Strategies
  - name: Subscriptions
  - name: Payments
  - name: Withdrawals
  - name: Timelines
  - name: Stocks
  - name: Trades
  - name: Webhooks
  - name: Bots
  - name: Websockets
paths:
  /newOrder:
    post:
      tags:
        - Trades
      summary: newOrder
      description: >-
        Create a new open order. Must pass `amount` or `total` not
        both.<br/><br/>For TradingView or webhook integrations with percentage
        based order actions, see
        [newOrderWebhook](/resources/webhooks/neworderwebhook) or
        [newOrderAllocations](/resources/trades/newOrderAllocations) api
        endpoint.
      operationId: newOrder
      parameters:
        - $ref: '#/components/parameters/api_token'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - strategy_id
                - stock_id
                - action
                - type
              properties:
                strategy_id:
                  $ref: '#/components/schemas/strategy_id'
                stock_id:
                  $ref: '#/components/schemas/stock_id'
                action:
                  type: string
                  description: Order action.
                  enum:
                    - buy
                    - sell
                type:
                  type: string
                  description: Type of order.
                  enum:
                    - market
                    - limit
                    - stop_market
                    - stop_limit
                    - oco
                amount:
                  type: string
                  format: double(30,15)
                  description: Number of shares to trade.
                total:
                  type: string
                  format: double(30,15)
                  description: Cash allocated towards order.
                price:
                  type: string
                  format: double(30,15)
                  description: Price to make trade at.
                stop_price:
                  type: string
                  format: double(30,15)
                  description: Price to trigger order.
                order_dependencies:
                  type: array
                  description: >-
                    An array of order IDs to wait for before this order can be
                    executed.
                  items:
                    type: string
      responses:
        '200':
          description: Request was successful.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    $ref: '#/components/schemas/success'
                  response:
                    type: object
                    description: >-
                      Endpoint-specific response payload, or an error message
                      when `success` is false.
                    properties:
                      order_id:
                        $ref: '#/components/schemas/order_id'
                      strategy_id:
                        $ref: '#/components/schemas/strategy_id'
                      type:
                        type: string
                        enum:
                          - market
                          - limit
                          - stop_market
                          - stop_limit
                          - oco
                          - liquidate
                        description: Type or category for this object.
                      action:
                        type: string
                        enum:
                          - buy
                          - sell
                        description: Order or signal action.
                      stop_price:
                        type:
                          - string
                          - 'null'
                        description: Stop trigger price.
                      price:
                        type: string
                        description: Price or execution price, depending on context.
                      amount:
                        type: string
                        description: Amount.
                      total:
                        type:
                          - string
                          - 'null'
                        description: >-
                          Total value; for positions/orders this is
                          strategy-normalized unless documented otherwise.
                      created_at:
                        $ref: '#/components/schemas/created_at'
                      stock_id:
                        $ref: '#/components/schemas/stock_id'
                      figi_composite:
                        type:
                          - string
                          - 'null'
                        description: Composite FIGI identifier when available.
                      symbol:
                        type: string
                        description: Ticker or asset symbol.
                      name:
                        type: string
                        description: Display name.
                      sector:
                        type: string
                        description: Sector or asset category.
                      security:
                        type: string
                        enum:
                          - cryptocurrency
                          - stock
                        description: Security type, such as stock or cryptocurrency.
                      exchange:
                        type: string
                        description: Exchange code.
                      stock:
                        type: string
                        description: Stock symbol as stored by AlphaInsider.
                      peg:
                        type: string
                        description: Peg or quote currency.
                      provider:
                        type: string
                        enum:
                          - coinbase
                          - binance
                          - massive
                          - alphainsider
                        description: External provider or data provider.
                      slippage:
                        type: string
                        description: Slippage value or configured slippage fraction.
                      fee:
                        type: string
                        description: Fee value.
                      links:
                        type: object
                        description: External research and market-data links.
                      stock_status:
                        type: string
                        enum:
                          - active
                          - deleted
                        description: Current stock status.
                      bid:
                        type: string
                        description: Current bid price.
                      ask:
                        type: string
                        description: Current ask price.
                      last:
                        type: string
                        description: Last traded price.
                      order_dependencies:
                        type: array
                        description: >-
                          Order IDs this order is waiting on; `[]` means the
                          order has no outstanding dependencies.
                        items:
                          type: string
              examples:
                '200':
                  value:
                    success: true
                    response:
                      order_id: qoppbNXH4lG0-4x21YLCp
                      strategy_id: 7Wy5AzIKY9bCmkIqjcLSg
                      type: limit
                      action: sell
                      stop_price: null
                      price: '4000.000000000000000'
                      amount: '0.000200000000000'
                      total: null
                      created_at: '2024-10-22T21:47:19.540Z'
                      stock_id: v3lhjrwEhNuAOxPT29oxO
                      figi_composite: null
                      symbol: ETH-USD
                      name: Ethereum
                      sector: Cryptocurrencies
                      security: cryptocurrency
                      exchange: COINBASE
                      stock: ETH-USD
                      peg: USD
                      provider: coinbase
                      slippage: '0.000000000000000'
                      fee: '0.002500000000000'
                      links:
                        trading_view: >-
                          https://www.tradingview.com/symbols/ETHUSD/?exchange=COINBASE
                        yahoo_finance: https://finance.yahoo.com/quote/ETH-USD
                        coin_marketcap: https://coinmarketcap.com/currencies/ethereum/
                        google_finance: https://www.google.com/finance/quote/ETH-USD
                      stock_status: active
                      bid: '2633.43'
                      ask: '2633.43'
                      last: '2633.43'
                      order_dependencies: []
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
components:
  parameters:
    api_token:
      in: header
      name: Authorization
      description: User API token.
      required: true
      schema:
        type: string
        format: JWT
  schemas:
    strategy_id:
      type: string
      description: AlphaInsider strategy identifier.
    stock_id:
      type: string
      description: AlphaInsider stock identifier, or `SYMBOL:EXCHANGE` in requests.
    success:
      type: boolean
      description: True when the request succeeded.
    order_id:
      type: string
      description: Order identifier.
    created_at:
      type: string
      format: date-time
      description: Creation timestamp.
  responses:
    '400':
      description: Request failed.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                description: False when the request failed.
              response:
                type: string
                description: Error message.
          examples:
            '400':
              value:
                success: false
                response: Request failed.
    '401':
      description: Authentication failed.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                description: False when the request failed.
              response:
                type: string
                description: Error message.
          examples:
            '401':
              value:
                success: false
                response: Authentication failed.

````