> For AI agents: the complete documentation index is available at [llms.txt](https://docs.snaptrade.com/llms.txt). Markdown versions of documentation pages are available by appending .md to the URL path.

# Preview crypto order

POST https://api.snaptrade.com/accounts/{accountId}/trading/crypto/preview

Previews an order using the specified account.


Reference: https://docs.snaptrade.com/reference/Trading/Trading_previewCryptoOrder

## Code Examples

### TypeScript

```typescript

import { Snaptrade } from "snaptrade-typescript-sdk";

const snaptrade = new Snaptrade({});

const response =
  await snaptrade.trading.previewCryptoOrder({});
console.log(response.data);

```

### Python

```python

from pprint import pprint
from snaptrade_client import SnapTrade

snaptrade = SnapTrade()

response = snaptrade.trading.preview_crypto_order()
pprint(response.body)

```

## OpenAPI Specification

```yaml

openapi: 3.0.0
info:
  description: Connect brokerage accounts to your app for live positions and trading
  version: 1.0.0
  title: SnapTrade
  termsOfService: N/A
  contact:
    email: api@snaptrade.com
  x-konfig-ignore:
    potential-incorrect-type: true
  x-readme:
    explorer-enabled: false
paths:
  /accounts/{accountId}/trading/crypto/preview:
    post:
      tags:
        - Trading
      summary: Preview crypto order
      description: |
        Previews an order using the specified account.
      operationId: Trading_previewCryptoOrder
      parameters:
        - in: query
          required: true
          name: userId
          schema:
            description: >-
              SnapTrade User ID. This is chosen by the API partner and can be
              any string that is a) unique to the user, and b) immutable for the
              user. It is recommended to NOT use email addresses for this
              property because they are usually not immutable.
            type: string
            example: snaptrade-user-123
        - in: query
          required: true
          name: userSecret
          schema:
            description: >-
              SnapTrade User Secret. This is a randomly generated string and
              should be stored securely. If compromised, please rotate it via
              the [rotate user secret
              endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
            type: string
            example: adf2aa34-8219-40f7-a6b3-60156985cc61
        - in: path
          required: true
          name: accountId
          schema:
            description: >-
              Unique identifier for the connected brokerage account. This is the
              UUID used to reference the account in SnapTrade.
            type: string
            format: uuid
            example: 917c8734-8470-4a3e-a18f-57c3f2ee6631
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - instrument
                - side
                - type
                - time_in_force
                - amount
              properties:
                instrument:
                  type: object
                  required:
                    - symbol
                    - type
                  properties:
                    symbol:
                      description: The instrument's trading ticker symbol
                      type: string
                      example: BTC
                    type:
                      description: The instrument's type
                      type: string
                      enum:
                        - CRYPTOCURRENCY
                        - CRYPTOCURRENCY_PAIR
                side:
                  description: >-
                    The action describes the intent or side of a trade. This is
                    either `BUY` or `SELL`.
                  type: string
                  enum:
                    - BUY
                    - SELL
                type:
                  type: string
                  enum:
                    - MARKET
                    - LIMIT
                    - STOP_LOSS_MARKET
                    - STOP_LOSS_LIMIT
                    - TAKE_PROFIT_MARKET
                    - TAKE_PROFIT_LIMIT
                  description: The type of order to place.
                time_in_force:
                  description: >
                    The Time in Force type for the order. This field indicates
                    how long the order will remain active before it is executed
                    or expires.
                      - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled.
                      - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
                      - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
                      - `GTD` - Good Til Date. The order is valid until the specified date.
                  type: string
                  enum:
                    - GTC
                    - FOK
                    - IOC
                    - GTD
                amount:
                  description: The amount of the base currency to buy or sell.
                  type: string
                  format: decimal
                  example: '123.45'
                limit_price:
                  description: >-
                    The limit price. Required if the order type is `LIMIT`,
                    `STOP_LOSS_LIMIT` or `TAKE_PROFIT_LIMIT`.
                  type: string
                  format: decimal
                  example: '123.45'
                stop_price:
                  description: >-
                    The stop price. Required if the order type is
                    `STOP_LOSS_MARKET`, `STOP_LOSS_LIMIT`, `TAKE_PROFIT_MARKET`
                    or `TAKE_PROFIT_LIMIT`.
                  type: string
                  format: decimal
                  example: '123.45'
                post_only:
                  type: boolean
                  example: false
                  description: >
                    Valid and required only for order type `LIMIT`. If true
                    orders that would be filled immediately are rejected to
                    avoid incurring TAKER fees.
                expiration_date:
                  type: string
                  format: date-time
                  example: '2024-01-01T00:00:00Z'
                  description: >-
                    The expiration date of the order. Required if the
                    time_in_force is `GTD`.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                description: Preview of an order.
                type: object
                properties:
                  estimated_fee:
                    type: object
                    required:
                      - currency
                      - amount
                    description: The estimated order fee.
                    properties:
                      currency:
                        description: >-
                          Symbol to identify a cryptocurrency or fiat currency
                          on a crypto exchange. Fiat currencies symbols are
                          ISO-4217 codes.
                        type: string
                        example: BTC
                      amount:
                        type: string
                        format: decimal
                        example: '123.45'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                description: Example for failed request response
                type: object
                properties:
                  default_detail:
                    example: Unable to verify data sent
                  default_code:
                    example: 1076
        '500':
          description: Unexpected Error

```