Coinbase Edge Fields
A coinbase alias reads public Coinbase Exchange market data for one product (symbol: BTC-USD). All 39 fields are numbers. Prices are in the product's quote currency; changes and _pct distances are fractions.
This page lists every field by group, with its unit and backtest support, then explains the candles setting and when candle-based fields go unavailable. Custom strategies on Kalshi and Polymarket US read a field as edge.<alias>.<field> once it is listed in the alias's fields. For the alias keys and refresh minimums, see Declaring and Reading Edge Data. Kalshi Perps reads the six MACD fields by name instead; see Kalshi Perps.
Price and quote fields
These come from Coinbase's 24-hour stats and top of book. They are the only fields that allow a 1s refresh.
| Field | Unit | Meaning | Backtest |
|---|---|---|---|
price | quote | Last trade price. | Yes (completed 1-minute close) |
bid | quote | Best bid; unavailable when that side of the book is empty. | No, live only |
ask | quote | Best ask. | No, live only |
spread | quote | ask minus bid. | No, live only |
spread_bps | basis points | Spread divided by the midpoint, × 10,000. | No, live only |
change_24h | fraction | Last price vs. the price 24 hours ago: (last − open) ÷ open. | Yes (completed hourly candles) |
volume_24h | base asset | Volume traded over 24 hours, in the base asset (BTC for BTC-USD). | Yes (completed hourly candles) |
Historical backtests make each candle's final values available only after that candle closes. Between closes, they reuse the last available value. Live fields that include a forming candle can change before its close, so those intraminute signals cannot be reconstructed from historical candles. To make live and backtest values line up, see Live or closed candles. A 10-second strategy loop does not turn one-minute Coinbase history into 10-second price history.
Change windows
Each change compares the latest close, including the candle still forming, with an earlier close. All are fractions (0.004 = +0.4%).
| Field | Built from | History needed | Backtest |
|---|---|---|---|
change_5m | latest 1-minute close vs. 5 candles earlier | 6 one-minute candles | Yes (completed 1-minute candles) |
change_15m | latest 1-minute close vs. 15 candles earlier | 16 one-minute candles | Yes (completed 1-minute candles) |
change_1h | latest 5-minute close vs. 12 candles earlier | 13 five-minute candles | Yes (completed 5-minute candles) |
change_4h | latest hourly close vs. 4 candles earlier | 5 hourly candles | Yes (completed hourly candles) |
High and low windows
Highest high or lowest low over recent candles, in the quote currency, including the candle still forming. With less history, fewer candles are used.
| Fields | Window | Backtest |
|---|---|---|
high_15m, low_15m | last 15 one-minute candles | Yes (completed 1-minute candles) |
high_1h, low_1h | last 12 five-minute candles | Yes (completed 5-minute candles) |
high_4h, low_4h | last 4 hourly candles | Yes (completed hourly candles) |
high_24h, low_24h | last 24 hourly candles | Yes (completed hourly candles) |
Moving averages
Averages of candle closes, in the quote currency.
| Field | Meaning | History needed | Backtest |
|---|---|---|---|
sma_20_1m | Simple average of the last 20 one-minute closes. | 20 one-minute candles | Yes (completed 1-minute candles) |
ema_12_1m | 12-period exponential average of one-minute closes, including the forming candle. | 12 one-minute candles | Yes (completed 1-minute candles) |
sma_50_5m | Simple average of the last 50 five-minute closes. | 50 five-minute candles | Yes (completed 5-minute candles) |
ema_26_5m | 26-period exponential average of five-minute closes, including the forming candle. | 26 five-minute candles | Yes (completed 5-minute candles) |
ema_26_15m | 26-period exponential average of completed 15-minute closes. | 26 or more completed 15-minute candles, with no gaps in the last 250 (about 62 hours) | Yes (completed candles only) |
EMA distance
Each EMA has two ready-made distance fields that measure how far price sits from it. Positive means spot is above the average, negative below.
| Field | Unit | Meaning |
|---|---|---|
ema_12_1m_distance_usd | quote | price − ema_12_1m |
ema_12_1m_distance_pct | fraction | (price − ema_12_1m) ÷ ema_12_1m |
ema_26_5m_distance_usd | quote | price − ema_26_5m |
ema_26_5m_distance_pct | fraction | (price − ema_26_5m) ÷ ema_26_5m |
ema_26_15m_distance_usd | quote | price − ema_26_15m |
ema_26_15m_distance_pct | fraction | (price − ema_26_15m) ÷ ema_26_15m |
A distance is unavailable whenever its EMA or price is. The _pct versions are handy across products, because a 0.2% band means the same on BTC and ETH, while a dollar band does not. All six are backtestable. Backtests use the latest completed one-minute close as spot for every distance field, including ema_26_15m distances.
To compare an EMA with a Kalshi strike rather than with spot, use the raw EMA field in a derived metric. See Recipe: spot and EMA vs. strike.
VWAP and velocity
| Field | Unit | Meaning | Backtest |
|---|---|---|---|
vwap_1h | quote | Volume-weighted average of the typical price, (high + low + close) ÷ 3, over the last 12 five-minute candles. | Yes (completed 5-minute candles) |
vwap_24h | quote | The same over the last 24 hourly candles. | Yes (completed hourly candles) |
velocity_1m | quote per second | Latest one-minute close minus the previous one, divided by the seconds between them (normally 60). | Yes (completed 1-minute candles) |
MACD
MACD compares a fast and a slow exponential average of completed candle closes. Each timeframe has three fields, all in signed quote currency.
| Field | Meaning |
|---|---|
macd_1m | MACD line: 12-period EMA minus 26-period EMA of completed one-minute closes. |
macd_signal_1m | Signal line: 9-period EMA of the MACD line. |
macd_histogram_1m | macd_1m minus macd_signal_1m. Positive when the MACD line is above its signal. |
macd_5m, macd_signal_5m, macd_histogram_5m | The same on completed five-minute closes. |
Each timeframe needs at least 34 completed candles (26 for the slow average plus 9 for the signal, minus the one they share), and every candle in the roughly 250 the Bot downloads must be back-to-back. One missing candle leaves all three fields unavailable until it is more than 250 candles old: about 4 hours for the _1m fields, about 21 hours for _5m. All six fields are backtestable and use completed candles only, in live and historical runs alike, unless the alias sets candles: live.
EMA distance and MACD, worked through
EMA distance (15-minute EMA-26)
price 102,500Last Coinbase tradeema_26_15m 102,300EMA of completed 15-minute closesema_26_15m_distance_usd +200Signed dollars. Positive: spot is above the EMA.ema_26_15m_distance_pct 0.00196A fraction, about 0.2%. Compare with 0.002, not 0.2.MACD (one-minute)
macd_1m +40MACD line, in dollarsmacd_signal_1m +28Signal line, in dollarsmacd_histogram_1m +12Positive: the line is above its signalSame test, two ways: macd_1m > macd_signal_1m using value_field, or macd_histogram_1m > 0. Both check the current relationship on every tick, not a one-time cross.
ema_12_1m field, which includes the candle still forming. With candles: closed, both use completed candles; with candles: live, both include the forming candle.MACD values are in the product's quote currency (dollars for -USD pairs), not percent, so their size scales with the product's price. A histogram threshold that fits BTC means something very different on ETH or SOL.
Live or closed candles
By default, fields read candles in two different ways. MACD and ema_26_15m (with its distances) use completed candles only. Every other candle-based field also reads the candle still forming on Coinbase. Backtests use completed candles for all of them. The optional candles key on a Coinbase alias makes every candle-based field read candles the same way:
candles | Live Bot | Backtest |
|---|---|---|
| left out | MACD and ema_26_15m use completed candles; the other candle-based fields include Coinbase's forming candle. | Completed candles for every field. |
live | Every candle-based field includes the forming candle, closed at Coinbase's last trade price. MACD and the EMAs move inside a candle, so rules can fire before it closes. | The forming candle at each minute mark, closed at that minute's last trade. velocity_1m is not backtestable. |
closed | Every candle-based field uses completed candles only; EMA distances still use the live last trade price. | Completed candles for every field, sampled once a minute; EMA distances use the historical price. |
price, bid, ask, spread, spread_bps, change_24h and volume_24h are not built from candles and do not change with the setting.
Choose live when a signal should count before its candle closes, for example acting on a 5-minute MACD turn as it happens. The cost:
- Earlier signals can reverse. A MACD that turns positive halfway through a candle can turn back before the candle closes, so expect more false signals and more trades than with completed candles.
- A short gap at each close. Right after a candle closes, every field built from that candle size is unavailable for a few seconds, until Coinbase publishes the completed candle.
- Backtests read once a minute. At each minute mark the backtest rebuilds the forming 5-minute, 15-minute and hourly candles exactly from completed one-minute candles. A one-minute candle has only just opened at that moment, so one-minute fields cannot show a signal firing inside a minute, which a live Bot can act on. The result says so: "1m live fields are read once a minute in backtests; a live Bot also sees moves inside the minute."
velocity_1mwould always read 0 at those moments, so a live alias that reads it cannot be backtested; backtest that strategy withcandles: closedinstead.
Choose closed to align the candle selection with the backtest, at the cost of reacting later. This does not guarantee the same signals or fills: live refresh timing, available history, prices and execution can differ.
version: 1
platform: kalshi
strategy: custom
strategy_name: BTC 15-minute MACD on the forming 5-minute candle
market:
series_ticker: KXBTC15M
edge:
btc:
provider: coinbase
symbol: BTC-USD
fields: [macd_5m, macd_signal_5m, macd_histogram_5m]
refresh: 5s
candles: live
risk:
max_position: 2
price_floor: 0.10
price_ceiling: 0.90
loop:
interval: 10
rules:
- name: exit_when_momentum_turns_down
when:
all:
- {field: yes_position_size, op: ">", value: 0}
- {field: edge.btc.macd_histogram_5m, op: "<", value: 0}
action: sell_yes
- name: buy_yes_on_bullish_momentum
when:
all:
- {field: position_size, op: "==", value: 0}
- {field: time_to_expiry, op: ">=", value: "5m"}
- {field: edge.btc.macd_5m, op: ">", value_field: edge.btc.macd_signal_5m}
- {field: yes_best_ask, op: "<=", value: 0.60}
action: buy_yes
size: 1candles is only valid on a coinbase alias, and only as live or closed:
# Rejected: candles on an NWS alias
# error: candles is only available for provider coinbase
version: 1
platform: kalshi
strategy: custom
market:
series_ticker: KXHIGHNY
edge:
weather:
provider: nws
station: KNYC
fields: [current_temp_f]
candles: live
risk:
max_position: 2
price_floor: 0.10
price_ceiling: 0.90
loop:
interval: 30
rules:
- name: buy_when_warm
when:
all:
- {field: edge.weather.current_temp_f, op: ">", value: 80}
action: buy_yes
size: 1Changing candles changes the Bot's code. A running Bot keeps reading candles the old way until you redeploy it.
Candle history and freshness
If remote edge-history preparation reaches its deadline, it resumes once automatically when enough preparation time remains. Completed Coinbase chunks are retained, so the resume can reuse that progress. If preparation still fails, the run stops without a completed result and does not retry again automatically. Choose Retry history preparation to retry the same strategy later; if it keeps failing, contact support with the job ID. This is a history preparation failure, so the card does not offer Fix with AI to change the strategy's rules.
For live Bots, there is no warm-up wait. On every refresh the Bot downloads about the last 250 candles of each size (1 minute, 5 minutes, 15 minutes, 1 hour), so indicators have values from the first fetch after you deploy. A field is unavailable only when:
- Coinbase's history is too short, for example a newly listed product.
- The history has gaps. Coinbase omits candles for intervals with no trades, which is common on thin products. MACD and
ema_26_15mneed every downloaded candle to be back-to-back, so a single gap leaves them unavailable for hours (see MACD). - The latest candle is late or missing. If the most recently completed candle is not in Coinbase's data within 10 seconds of its close, every field built from that candle size is unavailable for that refresh. Coinbase publishes no candle for an interval with no trades, so on thin products a quiet minute has the same effect as a late candle. The alias itself stays healthy.
| Candle size | Fields built from it |
|---|---|
| 1 minute | change_5m, change_15m, high_15m, low_15m, sma_20_1m, ema_12_1m and its distances, velocity_1m, the three _1m MACD fields |
| 5 minutes | change_1h, high_1h, low_1h, sma_50_5m, ema_26_5m and its distances, vwap_1h, the three _5m MACD fields |
| 15 minutes | ema_26_15m and its distances (completed candles only, unless candles: live) |
| 1 hour | change_4h, high_4h, low_4h, high_24h, low_24h, vwap_24h |
| none | price, bid, ask, spread, spread_bps, change_24h, volume_24h |