Coinbase
CryptoExchangeAPIs.Coinbase.CoinbaseClient
— TypeCoinbaseClient <: 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.
CryptoExchangeAPIs.Coinbase.CoinbaseAPIError
— TypeCoinbaseAPIError{T} <: AbstractAPIsError
Exception thrown when an API method fails with code T
.
Required fields
msg::String
: Error message.
Spot
CryptoExchangeAPIs.Coinbase.Spot.public_client
— Constantpublic_client = CoinbaseClient(; base_url = "https://api.exchange.coinbase.com")
CryptoExchangeAPIs.Coinbase.Spot.Candle.candle
— Functioncandle(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:
Parameter | Type | Required | Description |
---|---|---|---|
granularity | TimeInterval | true | m1 m5 m15 h1 h6 d1 |
product_id | String | true | |
start | DateTime | false | |
_end | DateTime | false |
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
},
...
]
CryptoExchangeAPIs.Coinbase.Spot.Currency.currency
— Functioncurrency(client::CoinbaseClient, query::CurrencyQuery)
currency(client::CoinbaseClient = Coinbase.Spot.public_client; kw...)
Gets a list of all known 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
}
]
},
...
]
CryptoExchangeAPIs.Coinbase.Spot.FeeEstimate.fee_estimate
— Functionfee_estimate(client::CoinbaseClient, query::FeeEstimateQuery)
fee_estimate(client::CoinbaseClient; kw...)
Gets the fee estimate for the crypto withdrawal to crypto address.
Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
currency | String | false | |
crypto_address | String | false | |
network | String | false | |
signature | String | false | |
timestamp | String | false |
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
}
CryptoExchangeAPIs.Coinbase.Spot.Product.product
— Functionproduct(client::CoinbaseClient, query::ProductQuery)
product(client::CoinbaseClient = Coinbase.Spot.public_client; kw...)
Gets a list of available currency pairs for trading.
Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
type | String | false |
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
},
...
]
CryptoExchangeAPIs.Coinbase.Spot.ProductStats.product_stats
— Functionproduct_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:
Parameter | Type | Required | Description |
---|---|---|---|
product_id | String | true |
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
}
CryptoExchangeAPIs.Coinbase.Spot.Ticker.ticker
— Functionticker(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:
Parameter | Type | Required | Description |
---|---|---|---|
product_id | String | true |
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"
}