Coinbase

CryptoExchangeAPIs.Coinbase.CoinbaseClientType
CoinbaseClient <: AbstractAPIsClient

Client info.

Required fields

  • base_url::String: Base URL for the client.

Optional fields

  • public_key::String: Public key for authentication.
  • secret_key::String: Secret key for authentication.
  • interface::String: Interface for the client.
  • proxy::String: Proxy information for the client.
  • account_name::String: Account name associated with the client.
  • description::String: Description of the client.
source

Spot

CryptoExchangeAPIs.Coinbase.Spot.Candle.candleFunction
candle(client::CoinbaseClient, query::CandleQuery)
candle(client::CoinbaseClient = Coinbase.Spot.public_client; kw...)

Get rates for a single product by product ID, grouped in buckets.

GET products/{product_id}/candles

Parameters:

ParameterTypeRequiredDescription
granularityTimeIntervaltruem1 m5 m15 h1 h6 d1
product_idStringtrue
startDateTimefalse
_endDateTimefalse

Code samples:

using Serde
using CryptoExchangeAPIs.Coinbase

result = Coinbase.Spot.candle(;
    granularity = Coinbase.Spot.Candle.d1,
    product_id = "BTC-USD",
)

to_pretty_json(result.result)

Result:

[
  {
    "time":"2024-03-21T00:00:00",
    "low":0.617,
    "high":0.648,
    "open":0.637,
    "close":0.632,
    "volume":417732.13
  },
  ...
]
source
CryptoExchangeAPIs.Coinbase.Spot.Currency.currencyFunction
currency(client::CoinbaseClient, query::CurrencyQuery)
currency(client::CoinbaseClient = Coinbase.Spot.public_client; kw...)

Gets a list of all known currencies.

GET currencies

Code samples:

using Serde
using CryptoExchangeAPIs.Coinbase

result = Coinbase.Spot.currency()

to_pretty_json(result.result)

Result:

[
  {
    "id":"00",
    "name":"00 Token",
    "min_size":"0.00000001",
    "status":"online",
    "message":null,
    "max_precision":1.0e-8,
    "convertible_to":[

    ],
    "details":{
        "type":"crypto",
        "symbol":null,
        "network_confirmations":14,
        "sort_order":0,
        "crypto_address_link":"https://etherscan.io/token/0x881ba05de1e78f549cc63a8f6cabb1d4ad32250d?a={{address}}",
        "crypto_transaction_link":"https://etherscan.io/tx/0x{{txId}}",
        "push_payment_methods":[

        ],
        "group_types":[

        ],
        "display_name":null,
        "processing_time_seconds":null,
        "min_withdrawal_amount":1.0e-8,
        "max_withdrawal_amount":410000.0
    },
    "default_network":"ethereum",
    "supported_networks":[
        {
        "id":"ethereum",
        "name":"Ethereum",
        "status":"online",
        "contract_address":"0x881ba05de1e78f549cc63a8f6cabb1d4ad32250d",
        "crypto_address_link":"https://etherscan.io/token/0x881ba05de1e78f549cc63a8f6cabb1d4ad32250d?a={{address}}",
        "crypto_transaction_link":"https://etherscan.io/tx/0x{{txId}}",
        "min_withdrawal_amount":1.0e-8,
        "max_withdrawal_amount":410000.0,
        "network_confirmations":14,
        "processing_time_seconds":null
        }
    ]
  },
  ...
]
source
CryptoExchangeAPIs.Coinbase.Spot.FeeEstimate.fee_estimateFunction
fee_estimate(client::CoinbaseClient, query::FeeEstimateQuery)
fee_estimate(client::CoinbaseClient; kw...)

Gets the fee estimate for the crypto withdrawal to crypto address.

GET withdrawals/fee-estimate

Parameters:

ParameterTypeRequiredDescription
currencyStringfalse
crypto_addressStringfalse
networkStringfalse
signatureStringfalse
timestampStringfalse

Code samples:

using Serde
using CryptoExchangeAPIs.Coinbase

coinbase_client = CoinbaseClient(;
    base_url = "https://api.exchange.coinbase.com",
    public_key = ENV["COINBASE_PUBLIC_KEY"],
    secret_key = ENV["COINBASE_SECRET_KEY"],
    passphrase = ENV["COINBASE_PASSPHRASE"],
)

result = Coinbase.Spot.fee_estimate(coinbase_client)

to_pretty_json(result.result)

Result:

{
  "fee":0.1,
  "fee_before_subsidy":0.01
}
source
CryptoExchangeAPIs.Coinbase.Spot.Product.productFunction
product(client::CoinbaseClient, query::ProductQuery)
product(client::CoinbaseClient = Coinbase.Spot.public_client; kw...)

Gets a list of available currency pairs for trading.

GET products

Parameters:

ParameterTypeRequiredDescription
typeStringfalse

Code samples:

using Serde
using CryptoExchangeAPIs.Coinbase

result = Coinbase.Spot.product(;
    type = "ADA-USDT",
)

to_pretty_json(result.result)

Result:

[
  {
    "id":"BCH-GBP",
    "base_currency":"BCH",
    "quote_currency":"GBP",
    "quote_increment":0.01,
    "base_increment":1.0e-8,
    "display_name":"BCH-GBP",
    "min_market_funds":0.72,
    "margin_enabled":false,
    "post_only":false,
    "limit_only":false,
    "cancel_only":false,
    "status":"online",
    "status_message":null,
    "trading_disabled":false,
    "fx_stablecoin":false,
    "max_slippage_percentage":0.03,
    "auction_mode":false,
    "high_bid_limit_percentage":null
  },
  ...
]
source
CryptoExchangeAPIs.Coinbase.Spot.ProductStats.product_statsFunction
product_stats(client::CoinbaseClient, query::ProductStatsQuery)
product_stats(client::CoinbaseClient = Coinbase.Spot.public_client; kw...)

Get rates for a single product by product ID, grouped in buckets.

GET products/{product_id}/stats

Parameters:

ParameterTypeRequiredDescription
product_idStringtrue

Code samples:

using Serde
using CryptoExchangeAPIs.Coinbase

result = Coinbase.Spot.product_stats(;
    product_id = "BTC-USD",
)

to_pretty_json(result.result)

Result:

{
  "open":65837.77,
  "high":66944.06,
  "low":64500.0,
  "last":65975.28,
  "volume":15431.78734886,
  "volume_30day":648921.33864485,
  "rfq_volume_24hour":20.273182,
  "rfq_volume_30day":1452.764429,
  "conversions_volume_24hour":null,
  "conversions_volume_30day":null
}
source
CryptoExchangeAPIs.Coinbase.Spot.Ticker.tickerFunction
ticker(client::CoinbaseClient, query::TickerQuery)
ticker(client::CoinbaseClient = Coinbase.Spot.public_client; kw...)

Gets snapshot information about the last trade (tick), best bid/ask and 24h volume.

GET products/{product_id}/ticker

Parameters:

ParameterTypeRequiredDescription
product_idStringtrue

Code samples:

using Serde
using CryptoExchangeAPIs.Coinbase

result = Coinbase.Spot.ticker(
    product_id = "ADA-USDT",
) 

to_pretty_json(result.result)

Result:

{
  "ask":0.633,
  "bid":0.632,
  "volume":420912.11,
  "trade_id":679787,
  "price":0.633,
  "size":23.7,
  "time":"2024-03-21T23:34:52.062646"
}
source