Coinbase Guide
Connect TradingView to Coinbase Spot using TradeAdapter’s direct API integration. This guide covers strategy-based alerts with the Message Generator.
Video walkthrough #
Coinbase + TradingView setup
1 — Create Coinbase API keys #
Coinbase uses the Coinbase Developer Platform (CDP) for API keys. Create a key with Trade permission and optionally restrict it to the TradeAdapter IP.
-
Log in to Coinbase Developer Platform
Go to the Coinbase Developer Platform (CDP) and sign in with your Coinbase account.
-
Open API keys
Navigate to Access → API keys and click to create a new API key.
-
Configure the key
In the Create API key dialog set: an API key nickname (e.g.
TradeAdapter), the Portfolio (e.g. Default), Permission level to include Trade (View and Transfer as needed), and add Allowlist IPs with35.75.198.16so only TradeAdapter can use this key. -
Create & download
Click Create & Download, complete 2-factor authentication with your CDP 2FA code, and save the JSON file. The file contains your API Key Name and Private Key — you will paste these into the alert message as
coinbase_api_keyandcoinbase_api_secret. -
Optional: copy from the popup
In the final popup you can copy the API Key Name and Private Key (they are also in the JSON). Read the warning and click Got it to finish. Never share the Private Key.
2 — Select the Coinbase symbol in TradingView #
Open TradingView and search for the symbol using the COINBASE prefix. Coinbase supports Spot only; ensure you pick a Spot symbol that exists on Coinbase (e.g. COINBASE:BTCUSD, COINBASE:ETHUSD).
Important
The {{ticker}} placeholder sends this exact symbol to Coinbase. The symbol must match a supported Spot product (e.g. BTC-USD, ETH-USDC). Check the Coinbase Spot Symbols list for Product ID, min size, and price step.
3 — Add your strategy #
This guide covers strategy alerts only. Load your Pine Script strategy onto the chart so it generates the trading signals.
Open Pine Editor, paste your strategy code, and click “Add to chart”. Open the Strategy Tester tab to confirm backtest results and that orders are generated.
Not sure if you have a strategy or an indicator? See Indicator vs Strategy. For indicator-based alerts on Coinbase, use the same message structure but set order_action and size manually; the Message Generator linked below is for strategy.
4 — Configure order size #
Coinbase enforces symbol-specific rules (min size, size step, price step). Configure your strategy’s position size so that {{strategy.order.contracts}} meets the symbol’s minimum and step. For Limit orders, ensure {{strategy.order.price}} respects the price step.
Coinbase Spot Symbols — Min Size, Size Step, Price Step per product.
5 — Create the TradingView alert #
Press Alt + A (or the alarm clock icon) to create a new alert on your strategy.
Strategy → one alert
Under Condition, select your strategy and set trigger to “Order fills only”. TradingView fills action, size, and price via {{strategy.order.action}}, {{strategy.order.contracts}}, and {{strategy.order.price}}.
Required: Webhook URL + Message
In Notifications, enable Webhook URL and paste your personal webhook from your TradeAdapter profile. Paste the JSON message (below) in the Message field. You can build it with the Coinbase Message Generator.
Alert message (Strategy) #
Use this template for strategy-based alerts. Replace the placeholder values with your API key and secret; keep the TradingView placeholders as-is.
{
"coinbase_api_key": "PUT YOUR COINBASE API KEY HERE",
"coinbase_api_secret": "PUT YOUR COINBASE PRIVATE KEY HERE",
"real_order": "No",
"order_type": "Market",
"order_market": "Spot",
"exchange": "coinbase",
"ticker": "{{ticker}}",
"time": "{{timenow}}",
"order_contracts": "{{strategy.order.contracts}}",
"order_action": "{{strategy.order.action}}",
"order_price": "{{strategy.order.price}}"
}
Message fields explained #
| Field | Description |
|---|---|
coinbase_api_key |
Your Coinbase API Key Name from CDP (from the JSON download or the creation popup). |
coinbase_api_secret |
Your Coinbase Private Key from the JSON file. Store it securely and never share it. |
real_order |
"Yes" sends real orders to Coinbase. "No" sends test orders via TradeAdapter only (no live trades). |
order_type |
"Market" or "Limit". For Limit orders, order_price is used as the limit price. |
order_market |
Must be "Spot" for Coinbase (Spot only). |
exchange |
Must be "coinbase" so TradeAdapter routes the order to Coinbase. |
ticker |
The TradingView symbol from {{ticker}} (e.g. COINBASE:BTCUSD). |
time |
Alert time from TradingView ({{timenow}}). |
order_contracts |
Position size from your strategy ({{strategy.order.contracts}}). |
order_action |
"BUY" or "SELL". Use {{strategy.order.action}} for strategies. |
order_price |
Price from the strategy ({{strategy.order.price}}), used for Limit orders. |
6 — Execute & monitor #
-
Start with test orders
Set
"real_order": "No"and trigger a few alerts. Check MyTrades to see how TradeAdapter interprets your signals. -
Verify on Coinbase
When you set
"real_order": "Yes", monitor your Coinbase account to confirm orders execute as expected. -
Recreate alerts after changes
If you change strategy parameters or the message, delete and recreate the TradingView alert so the new values are applied.
Important notes #
API security — Never share your Private Key. Use a key with Trade permission only and no withdrawal rights. Restrict by IP (
35.75.198.16) so only TradeAdapter can use the key.
Respect symbol specs — Check Coinbase Spot Symbols for min size, size step, and price step; test with small orders before scaling.
Recreate alerts after changes — If you change strategy parameters or message fields, delete and recreate the TradingView alert.
All setup guides