User Guide
Overview
CoinbaseProExchange.jl provides a Julia wrapper for the Coinbase Pro REST API. Available endpoints are implemented in the form of callable functions. Depending on the operation, a function can return data (either as a DataFrame or Dict) or the associated HTTP response (Dict).
Available functions
CoinbaseProExchange.cancel_all_orders
CoinbaseProExchange.cancel_order
CoinbaseProExchange.place_limit_order
CoinbaseProExchange.place_market_order
CoinbaseProExchange.show_account_info
CoinbaseProExchange.show_all_accounts
CoinbaseProExchange.show_all_products
CoinbaseProExchange.show_exchange_limits
CoinbaseProExchange.show_fees
CoinbaseProExchange.show_fills
CoinbaseProExchange.show_historical_data
CoinbaseProExchange.show_latest_trades
CoinbaseProExchange.show_open_orders
CoinbaseProExchange.show_product_data
CoinbaseProExchange.show_profiles
CoinbaseProExchange.show_server_time
CoinbaseProExchange.show_single_order
CoinbaseProExchange.show_transfers
Public endpoints (Coinbase Pro account is not necessary)
CoinbaseProExchange.show_server_time
— Functionshow_server_time(time_type::String)
Get the API server time.
Arguments
time_type::String
: "iso" (default) or "epoch" (represents decimal seconds since Unix epoch)
Example
julia> show_server_time("iso")
"2021-07-06T22:09:17.231Z"
CoinbaseProExchange.show_historical_data
— Functionshow_historical_data(pair::String, interval::Int64)
Fetch historic rates for a product.
Arguments
pair::String
: Specify currency pair, for example "ETH-EUR"interval::Int64
: Rates are returned in grouped buckets based on specified interval. Choose one from [60, 300 (default), 900, 3600, 21600, 86400], all in seconds.
Example
julia> show_historical_data("ETH-EUR", 3600)
300×6 DataFrame
Row │ time low high open close volume
│ Any Any Any Any Any Any
─────┼──────────────────────────────────────────────────────────────────
1 │ 2021-06-24T11:00:00 1619.45 1650.91 1619.45 1648.84 407.623
2 │ 2021-06-24T12:00:00 1644.02 1665.64 1648.05 1655.5 446.389
CoinbaseProExchange.show_all_products
— Functionshow_all_products(currency::String)
Fetch list of all available products for a given currency.
Arguments
currency::String
: "EUR", "USD" (default), "GBP" etc.
Example
julia> show_all_products("EUR")
40-element Vector{String}:
"ETC-EUR"
"SNX-EUR"
CoinbaseProExchange.show_latest_trades
— Methodshow_latest_trades(pair::String)
Fetch list of latest trades for a given product.
Arguments
pair::String
: Specify currency pair, for example "ETH-EUR"
Example
julia> show_latest_trades("ETH-EUR")
1000×5 DataFrame
Row │ time price side size trade_id
│ Any Float64 String Float64 Int64
──────┼─────────────────────────────────────────────────────────────────
1 │ 2021-07-06T22:23:54.963Z 1949.03 sell 0.101 22822595
2 │ 2021-07-06T22:23:53.612Z 1948.85 sell 0.0187214 22822594
CoinbaseProExchange.show_product_data
— Functionshow_product_data(pair::String, endpoint::String)
Fetch product data based on the selected endpoint.
Arguments
pair::String
: Specify currency pair, for example "ETH-EUR"endpoint::String
: Select one from ["24hr stats" (default), "product info", "product ticker", "order book 1", "order book 2", "order book 3"]
Example
julia> show_product_data("BTC-EUR", "24hr stats")
1×6 DataFrame
Row │ high last low open volume volume_30day
│ String String String String String String
─────┼───────────────────────────────────────────────────────────────────────
1 │ 29620.29 28740.89 28362.27 28642.14 1058.30490447 57346.67861744
Private endpoints (Coinbase Pro account + API keys are needed)
API key should have "trade" or "view" permission
CoinbaseProExchange.show_all_accounts
— Methodshow_all_accounts(user_data::UserInfo, currencies::Vector{String})
Fetch summary of all cryptocurrency accounts associated with the given API key.
Arguments
user_data::UserInfo
: API datacurrencies::Vector{String}
: Can be set to ["all"] or a specific set, for example ["LTC", "XTZ"]
Example
julia> show_all_accounts(user_data, ["LTC", "XTZ"])
2×7 DataFrame
Row │ currency balance profile_id trading_enabled id hold ⋯
│ String Float64 String Bool String Float ⋯
─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ LTC 0.0 4617f329-2709-453b-b95d-d14727cb… true eed5095d-848e-490c-8738-2f2073e7… 0 ⋯
2 │ XTZ 0.0 4617f329-2709-453b-b95d-d14727cb… true 21f6c731-91f7-44bf-ad9e-97cc2dfb… 0
CoinbaseProExchange.show_account_info
— Methodshow_account_info(user_data::UserInfo, currency::String, info_type::String)
Fetch account information for a single cryptocurrency associated with the given API key.
Arguments
user_data::UserInfo
: API datacurrency::String
: Select one, for example ["ETH"]info_type::String
: Select one from "info", "history" or "holds"
Example
julia> show_account_info(user_data, "ETH", "history")
2×8 DataFrame
Row │ amount balance created_at order_id produc ⋯
│ String String String String String ⋯
─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ -0.0248430100000000 0.0000000000000000 2021-05-09T00:56:06.877638Z 561bd042-9bd8-412f-a905-2a231e77… ETH-EU ⋯
2 │ 0.0248430100000000 0.0248430100000000 2021-05-08T23:52:37.666196Z 496f1b74-5a66-45dd-9f6e-817da994… ETH-EU
4 columns omitted
CoinbaseProExchange.show_exchange_limits
— Methodshow_exchange_limits(user_data::UserInfo, currency::String)
Fetch information on the payment method transfer limit for a given currency.
Arguments
user_data::UserInfo
: API datacurrency::String
: "ETH, "BTC", "XTZ" etc.
Example
julia> show_exchange_limits(user_data, "ETH")
5×4 DataFrame
Row │ payment_method max period_in_days remaining
│ String Float64 Int64 Float64
─────┼───────────────────────────────────────────────────────────
1 │ ideal_deposit 14.6423 1 14.6423
2 │ exchange_withdraw 146.423 1 146.423
3 │ secure3d_buy 1.75707 7 1.75707
4 │ credit_debit_card 0.585691 7 0.585691
5 │ paypal_withdrawal 11.7138 1 11.7138
CoinbaseProExchange.show_fills
— Methodshow_fills(user_data::UserInfo, pair::String)
Get a list of recent fills of the API key's profile for a given pair.
Arguments
user_data::UserInfo
: API datapair::String
: "ETH-EUR" etc.
Example
julia> show_fills(user_data, "ETH-EUR")
7×13 DataFrame
Row │ created_at fee liquidity order_id price ⋯
│ String String String String String ⋯
─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ 2021-07-04T21:54:09.902Z 0.0746268391200000 T d275ae2b-4f34-4ce9-98a7-1147bccf… 2003.90 ⋯
2 │ 2021-07-04T15:43:54.115Z 0.0733968750000000 T 7a019bf8-bee8-4001-bb34-e3d6f3e6… 1957.25
CoinbaseProExchange.show_transfers
— Functionshow_transfers(user_data::UserInfo, deposit_type::String="deposit")
Get a list of deposits/withdrawals from the profile of the API key, in descending order by created time.
Arguments
user_data::UserInfo
: API datadeposit_type::String
: "deposit" (default), "internaldeposit" (transfer between portfolios), "withdraw" or "internalwithdraw"
Example
julia> show_transfers(user_data, "internal_deposit")
4×7 DataFrame
Row │ account_id amount created_at curren ⋯
│ String String String String ⋯
─────┼─────────────────────────────────────────────────────────────────────────────────────────────────
1 │ 6defb94d-80e3-45b4-a6bf-0420cc5f… 10.0000000000000000 2021-07-16 11:10:10.253255+00 EUR ⋯
2 │ 6defb94d-80e3-45b4-a6bf-0420cc5f… 10.0000000000000000 2021-07-16 11:07:48.003446+00 EUR
CoinbaseProExchange.show_fees
— Methodshow_fees(user_data::UserInfo)
Get current maker & taker fee rates, as well as your 30-day trailing volume.
Arguments
user_data::UserInfo
: API data
Example
julia> show_fees(user_data_default)
1×3 DataFrame
Row │ maker_fee_rate taker_fee_rate usd_volume
│ String String String
─────┼────────────────────────────────────────────
1 │ 0.0050 0.0050 117.09
CoinbaseProExchange.show_profiles
— Methodshow_profiles(user_data::UserInfo)
Get a list of all user profiles/portfolios.
Arguments
user_data::UserInfo
: API data
Example
julia> show_profiles(user_data_default)
6×6 DataFrame
Row │ active created_at id is_default name ⋯
│ Bool String String Bool String ⋯
─────┼─────────────────────────────────────────────────────────────────────────────────────────────────
1 │ true 2019-06-23T00:19:33.647283Z dc06c753-2e85-4e2f-b281-3a78bc7b… true default ⋯
2 │ true 2021-05-07T21:10:07.037681Z 4617f329-2709-453b-b95d-d14727cb… false Julia Bot
API key should have "trade" permission
CoinbaseProExchange.place_market_order
— Methodplace_market_order(side::String, pair::String, amount::IntOrFloat, amount_type::String,
user_data::UserInfo)
Place a market order using the information provided.
Arguments
side::String
: "buy" or "sell"pair::String
: Specify currency pair, for example "ETH-EUR"amount::IntOrFloat
: Specify amount in base currency (ETH, BTC etc.) or quote currency (EUR, USD etc.)amount_type::String
: Select either "base" or "quote" based on the amount entereduser_data::UserInfo
: API data
Example
julia> place_market_order("buy", "ETH-EUR", 15, "quote", user_data)
[ Info: Order placed
Dict{String, Any} with 14 entries:
"created_at" => "2021-07-04T21:54:09.895868Z"
"stp" => "dc"
"product_id" => "ETH-EUR"
"settled" => false
"specified_funds" => "15"
"status" => "pending"
"id" => "d275ae2b-4f34-4ce9-98a7-1147bccf07ca"
"executed_value" => "0"
"post_only" => false
"filled_size" => "0"
"side" => "buy"
"fill_fees" => "0"
"funds" => "14.92537313"
"type" => "market"
CoinbaseProExchange.place_limit_order
— Methodplace_limit_order(side::String, pair::String, amount::IntOrFloat, price::IntOrFloat,
user_data::UserInfo)
Place a limit order using the information provided.
Arguments
side::String
: "buy" or "sell"pair::String
: Specify currency pair, for example "ETH-EUR"amount::IntOrFloat
: Specify amount in base currency (ETH, BTC etc.)user_data::UserInfo
: API data
Example
julia> place_limit_order("sell", "BTC-EUR", 0.0005, 30000, user_data)
[ Info: Order placed
Dict{String, Any} with 15 entries:
"created_at" => "2021-07-04T21:59:11.083132Z"
"price" => "30000"
"stp" => "dc"
"product_id" => "BTC-EUR"
"settled" => false
"status" => "pending"
"id" => "cae9158e-1660-448e-bd9a-d368ce3fdc8a"
"executed_value" => "0"
"post_only" => false
"size" => "0.0005"
"filled_size" => "0"
"side" => "sell"
"time_in_force" => "GTC"
"fill_fees" => "0"
"type" => "limit"
CoinbaseProExchange.show_open_orders
— Methodshow_open_orders(user_data::UserInfo)
Fetch list of open orders associated with the given API key.
Example
julia> show_open_orders(user_data)
1×15 DataFrame
Row │ created_at executed_value fill_fees filled_size id ⋯
│ String String String String String ⋯
─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ 2021-07-04T22:15:03.793256Z 0.0000000000000000 0.0000000000000000 0.00000000 5591e17e-5f79-41f0-93d5-b455e ⋯
11 columns omitted
CoinbaseProExchange.show_single_order
— Methodshow_single_order(order_ID::String, user_data::UserInfo)
Fetch order information for a given order ID.
Arguments
order_id::String
: Order ID, can be obtained via
show_open_orders(user_data)
user_data::UserInfo
: API data
Example
julia> show_single_order("14c0db51-ca17-4a8d-9d2c-aa633e703358", user_data)
1×15 DataFrame
Row │ created_at executed_value fill_fees filled_size id ⋯
│ String String String String String ⋯
─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ 2021-07-04T23:11:02.0001Z 0.0000000000000000 0.0000000000000000 0.00000000 14c0db51-ca17-4a8d-9d2c-aa633e7 ⋯
11 columns omitted
CoinbaseProExchange.cancel_order
— Methodcancel_order(order_id::String, user_data::UserInfo)
Cancel an order with a given order ID.
Arguments
order_id::String
: Order ID, can be obtained via
show_open_orders(user_data)
user_data::UserInfo
: API data
Example
julia>cancel_order("5591e17e-5f79-41f0-93d5-b455ec552ecc", user_data)
"5591e17e-5f79-41f0-93d5-b455ec552ecc"
CoinbaseProExchange.cancel_all_orders
— Methodcancel_all_orders(user_data::UserInfo)
Cancel all open orders from the profile associated with the API key.
Example
julia>cancel_all_orders(user_data)
1-element Vector{Any}:
"35fa8e19-f204-40c0-b995-eb2e4e168e01"