Automate TradingView alerts on Coinbase

Create a Coinbase Advanced Trade API key, add it to StockAutoTrader, and point TradingView alerts at a bot's buy and sell URLs. Orders go to your own Coinbase account against the USD pair, sized in fractions, and capped by your balance.

Starter $49/mo · Bundle $149/mo · cancel from the dashboard.

How the connection works

You create an API key in the Coinbase Developer Platform with trade permission, then paste the key ID and private key (plus passphrase if your key has one) into Webhook Setup. The key is used to sign order requests for your bots.

StockAutoTrader does not connect Coinbase to a sandbox, so every Coinbase bot order is real. Start with a small max amount per trade and scale up once the audit trail looks right.

Setup, step by step

  1. Start a trial from pricing and sign in.
  2. In the Coinbase Developer Platform, create an API key with view and trade permissions. Do not enable transfer permissions.
  3. In Webhook Setup, choose Coinbase and paste the API key ID and private key.
  4. Create a bot: choose Coinbase, the asset (for example BTC, traded as BTC-USD), and a small max dollar amount.
  5. Copy the Buy Signal URL and Sell Signal URL.
  6. Create one TradingView alert per side with Webhook URL enabled, and paste the matching URL.
  7. Use the example message below, or an empty message to let the bot fetch the Coinbase price.
  8. Review the first orders in the trade history.

Example alert message

Spend up to $200 of USD on BTC at market when the buy alert fires:

TradingView alert message (Buy URL)
{
  "price": {{close}},
  "max_amount": 200,
  "signal_id": "btc-buy-{{timenow}}"
}

Sell a fixed 0.01 BTC with a limit 0.2% above the close:

TradingView alert message (Sell URL)
{
  "price": {{close}},
  "quantity": 0.01,
  "default_sell_percent": 0.2
}

What is supported on Coinbase

ItemSupported
MarketsSpot, against USD (the bot asset plus "-USD", such as ETH-USD)
Order typesMarket, or limit at a % offset from price
QuantityFractional, rounded to 8 decimals
Market buysSent as a USD amount, capped at your available USD balance
SellsCapped at the amount of the asset you hold and at the dollar cap
MinimumOrders under $1 are rejected before reaching Coinbase
Price sourceAlert price, or a live Coinbase price if none is sent
Cancel stale limitsOptional: cancel this bot's unfilled limit orders before a new one
Not supported via webhookNon-USD pairs, derivatives, margin, stop orders

Fields the bot reads

Optional JSON fields the bot URL reads. Everything else in the message is ignored.
FieldTypeWhat it does
pricenumber or numeric stringReference price. Used for sizing and as the base for limit offsets. TradingView: {{close}}.
quantitynumberShares or coins for this order. Overrides the bot default.
max_amountnumber (USD)Dollar cap for this order. Overrides the bot setting.
default_buy_quantitynumberOverrides the bot default buy quantity.
default_sell_quantitynumberOverrides the bot default sell quantity.
default_buy_percentnumberPlaces a limit buy this % below price. 0 means market.
default_sell_percentnumberPlaces a limit sell this % above price. 0 means market.
signal_idstringIdempotency key. A repeated signal_id is ignored instead of trading twice.

How quantity is decided

  1. quantity from the alert, if present.
  2. Otherwise the bot default buy or sell quantity.
  3. Otherwise max_amount divided by price (whole shares for stocks, up to 8 decimals for crypto).
  4. If no price was sent, the engine asks the broker for a quote where it can (Tradier and Coinbase).
  5. The order is rejected if the result is zero, above 10,000 units, or more than 1% over the dollar cap.

Things to know before going live

  • Crypto trades around the clock, so alerts can fire while you sleep. Set a max amount you are comfortable losing on any single order.
  • If your USD balance is lower than the requested buy, the order is reduced to what is available rather than failing.
  • A sell with no holdings of that asset is rejected with a clear message.

Automated trading can lose money. Not investment advice. A webhook runs whatever your alert says, including a bad alert. Test in a sandbox or at small size first, and watch the audit trail.

Frequently asked questions

Which coins can I trade?

Any asset Coinbase lists against USD. You set the asset on the bot (for example SOL), and orders go to the matching USD pair (SOL-USD).

Is there a Coinbase paper mode?

No. Coinbase bot orders go to your real Coinbase account. Start with a small max amount. You can also rehearse the same alerts on Tradier's sandbox first.

What API permissions should the key have?

View and trade. StockAutoTrader never needs transfer or withdrawal permission, so leave those off.

Can it buy with a dollar amount instead of a coin amount?

Yes. Market buys are sent to Coinbase as a USD amount, which is how most people size crypto. Set max_amount on the bot or in the alert.

Connect a broker and test your first alert

Orders run in your own account. Start on a broker sandbox, read the audit trail, and go live when you decide to.

Automated trading can lose money. Not investment advice.