Coinbase icon

Coinbase

Interact with Coinbase Advanced Trade API

Actions9

Order → Create Market Order

AI-generated

Overview

This node interacts with the Coinbase Advanced Trade API to create a market order for a specified cryptocurrency product. It allows users to specify the product to trade (e.g., BTC-USD), the side of the trade (buy or sell), the order type (base size or quote size), and the size of the order. Additional options such as client order ID and self-trade prevention can also be set. This node is useful for automating cryptocurrency trading on Coinbase by placing market orders programmatically.

Use Case Examples

  1. Automatically buy $100 worth of Bitcoin (BTC-USD) when a certain condition is met.
  2. Sell 0.5 BTC at market price using a workflow triggered by an external event.

Properties

Name Meaning
Product ID The product to trade, such as BTC-USD or ETH-USD.
Side Whether to buy or sell the specified product.
Order Type How to specify the order size, either in base currency (e.g., BTC) or quote currency (e.g., USD).
Size The size of the order, specified according to the chosen order type.
Additional Options Optional parameters such as client order ID, self-trade prevention ID, and post-only flag (for limit orders).

Output

JSON

  • id - The unique identifier of the created order.
  • product_id - The product ID for the order (e.g., BTC-USD).
  • side - The side of the order, either BUY or SELL.
  • order_configuration
    • market_market_ioc
      * base_size - The size of the order in base currency if specified.
      * quote_size - The size of the order in quote currency if specified.
  • client_order_id - The client-specified unique ID for the order, if provided.
  • self_trade_prevention_id - The ID used to prevent self-trading, if provided.

Dependencies

  • Coinbase Advanced Trade API
  • An API key credential for Coinbase with API key and secret

Troubleshooting

  • Ensure that valid Coinbase API credentials are provided; missing credentials will cause the node to fail with a 'No credentials found!' error.
  • If the private key format is incorrect, JWT generation will fail with an error indicating the need for proper EC private key headers.
  • API errors from Coinbase will be returned with descriptive messages; check the error message for details such as invalid parameters or insufficient funds.
  • Make sure the product ID is valid and supported by Coinbase (e.g., BTC-USD).
  • If the order size is not specified correctly according to the order type, the API may reject the request.

Links

Discussion