Beta sign in

Pipe library / crypto-price-threshold

crypto-price-threshold

Coinbase spot prices that are below a USD threshold. The default threshold is high so the first run shows the current prices.

Price and market

api.coinbase.com

CLI

pipes run examples/crypto-price-threshold.pipe.yaml

MCP call

{
  "name": "pipe__crypto-price-threshold",
  "arguments": {}
}

Pipe file

examples/crypto-price-threshold.pipe.yaml

pipes: 0
name: crypto-price-threshold
version: 0.1.0
description: Coinbase spot prices that are below a USD threshold. The default threshold is high so the first run shows the current prices.
permissions:
  network: [api.coinbase.com]
inputs:
  type: object
  properties:
    coins:
      type: array
      items: { type: string, pattern: "^[A-Z0-9]+$" }
      minItems: 1
      maxItems: 5
      default: [BTC, ETH]
    below:
      type: number
      exclusiveMinimum: 0
      default: 1000000
  required: [coins, below]
outputs:
  type: object
  properties:
    text: { type: string }
    count: { type: integer }
  required: [text, count]
output:
  text: "${steps.format.text}"
  count: "${steps.format.count}"
steps:
  - id: fetch
    block: fetch_http
    for_each: "${inputs.coins}"
    with:
      url: "https://api.coinbase.com/v2/prices/${item}-USD/spot"
      max_bytes: 100000
    retry: { max: 2, backoff_ms: 500 }
    timeout_ms: 15000
  - id: parsed
    block: parse_json
    in: "${steps.fetch}"
    with:
      path: data
  - id: prices
    block: map
    in: "${steps.parsed}"
    with:
      rename: { amount: usd, base: coin }
      number: [usd]
      pick: [coin, usd]
  - id: cheap
    block: filter
    in: "${steps.prices}"
    with:
      where: { field: usd, op: lt, value: "${inputs.below}" }
  - id: format
    block: format
    in: "${steps.cheap}"
    with:
      header: "Below threshold:\n"
      item_template: "- ${item.coin} ${item.usd} USD"
      separator: "\n"
  - id: print
    block: emit_stdout
    in: "${steps.format.text}"
    with: { format: text }