Title: | Wrapper for 'Coinbase Pro (erstwhile GDAX)' Cryptocurrency Exchange |
---|---|
Description: | Allow access to both public and private end points to Coinbase Pro (erstwhile GDAX) cryptocurrency exchange. For authenticated flow, users must have valid api, secret and passphrase to be able to connect. |
Authors: | Dheeraj Agarwal [aut, cre] |
Maintainer: | Dheeraj Agarwal <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.2.1 |
Built: | 2024-11-20 03:34:18 UTC |
Source: | https://github.com/dheerajagarwal/rgdax |
This is an auth based function. User must have valid api keys generated by GDAX which must be passed as mandatory arguments. The function takes an account id as an additional input and returns the account details for that account. The account details currently include information about the currency (fiat or crypto) and the details on the balance (total, available and help for other transactions).
account(acct_id, api.key, secret, passphrase)
account(acct_id, api.key, secret, passphrase)
acct_id |
Mandatory character value. This is case senstivite. Must be one of the |
api.key |
Mandatory character value. This is the API key as generated by GDAX. Typically a 32 character value. |
secret |
Mandatory character value. This is the API secret as generated by GDAX. Typically a 88 character value. |
passphrase |
Mandatory character value. This is the passphrase as generated by GDAX. Typically a 11 character value. |
Dataframe with a single row, provides the currency, the current balance, available, holds and profile_id of the user.
## Not run: account(acct_id = "9kb58e27-276s-4g99-r2v7-128723948k1c", api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) ## End(Not run)
## Not run: account(acct_id = "9kb58e27-276s-4g99-r2v7-128723948k1c", api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) ## End(Not run)
This is an auth based function. User must have valid api keys generated by GDAX which must be passed as mandatory arguments. The function takes a currency as an additional input and returns the ledger for that currency. Since currency and account id have one to one mapping, the currency is being used a proxy.
account_hist(currency = "BTC", api.key, secret, passphrase)
account_hist(currency = "BTC", api.key, secret, passphrase)
currency |
Optional character value. The default is |
api.key |
Mandatory character value. This is the API key as generated by GDAX. Typically a 32 character value. |
secret |
Mandatory character value. This is the API secret as generated by GDAX. Typically a 88 character value. |
passphrase |
Mandatory character value. This is the passphrase as generated by GDAX. Typically a 11 character value. |
Dataframe with account activity for that currency. It indiactes the type of activity, when the activity occured and other associated details.
## Not run: account_hist(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) account_hist("BTC", api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) account_hist("ETH", api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) ## End(Not run)
## Not run: account_hist(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) account_hist("BTC", api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) account_hist("ETH", api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) ## End(Not run)
This is an auth based function. User must have valid api keys generated by GDAX which must be passed as mandatory arguments. The function takes no additional arguments and returns the account details for all accounts linked to that authenticated user. The account details currently include information about the currency (fiat or crypto) and the details on the balance (total, available and helpful information for other transactions). All accounts are returned even ones with zero balance.
accounts(api.key, secret, passphrase)
accounts(api.key, secret, passphrase)
api.key |
Mandatory character value. This is the API key as generated by GDAX. Typically a 32 character value. |
secret |
Mandatory character value. This is the API secret as generated by GDAX. Typically a 88 character value. |
passphrase |
Mandatory character value. This is the passphrase as generated by GDAX. Typically a 11 character value. |
Dataframe with a single row for each account_id, the currency, the current balance, available, holds and profile_id of the user.
## Not run: accounts(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) ## End(Not run)
## Not run: accounts(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) ## End(Not run)
This is an auth based function. User must have valid api keys generated by GDAX which must be passed as mandatory arguments. The users can place different types of orders like "limit"
, "stop"
or "market"
. Orders will be placed succesfully only if there is sufficient funds. Each order will result in a hold and the details of the hold can be tracked using holds
. Margin Orders are currently not supported.
add_order( api.key, secret, passphrase, product_id = "BTC-USD", type = "limit", stop = NULL, stop_price = NULL, side = "b", price = NULL, size )
add_order( api.key, secret, passphrase, product_id = "BTC-USD", type = "limit", stop = NULL, stop_price = NULL, side = "b", price = NULL, size )
api.key |
Mandatory character value. This is the API key as generated by GDAX. Typically a 32 character value. |
secret |
Mandatory character value. This is the API secret as generated by GDAX. Typically a 88 character value. |
passphrase |
Mandatory character value. This is the passphrase as generated by GDAX. Typically a 11 character value. |
product_id |
Optional character value for the currency pair. The default is |
type |
Optional character value for the order type. The default is |
stop |
Optional parameter. This parameter is required if a stop order needs to be placed. Possible values apart from default |
stop_price |
Optional parameter.The value is needed only if |
side |
Optional character value for the order side The default is |
price |
Conditional mandatory numeric value. It can either be an integer or float. Float values of greater than 2 decimals will be rounded to 2 decimals using the generic |
size |
Mandatory numeric value. It can either be an integer or float. Float values will NOT be rounded. The user must ensure that the fractional unit of a currency pair is valid for acceptance by GDAX. This information can also be determined by |
Dataframe with status of the order, posted details and created time stamp etc.
## Not run: add_order("BTC-USD", api.key = your_key, secret = your_api_secret, passphrase = your_api_pass, type="limit", side = "s", price = 1000.25, size = 1) ## End(Not run)
## Not run: add_order("BTC-USD", api.key = your_key, secret = your_api_secret, passphrase = your_api_pass, type="limit", side = "s", price = 1000.25, size = 1) ## End(Not run)
This is an internal function that will be used for all private connections to the user account. This function determines the kind of API call (GET / POST / DELETE).
auth(method, req.url = "/accounts/", api.key, secret, passphrase, order = NULL)
auth(method, req.url = "/accounts/", api.key, secret, passphrase, order = NULL)
method |
Mandatory character value. Value must be upper case. |
req.url |
THE URL component for the API. Default to "/accounts". |
api.key |
Mandatory character value. This is the API key as generated by GDAX. Typically a 32 character value. |
secret |
Mandatory character value. This is the API secret as generated by GDAX. Typically a 88 character value. |
passphrase |
Mandatory character value. This is the pass-phrase as generated by GDAX. Typically a 11 character value. |
order |
Optional named list. If method is |
A named list of server response.
This is an auth based function. User must have valid api keys generated by GDAX which must be passed as mandatory arguments. The users can cancel all pending orders except stop orders (GDAX does not treat STOP order as an open order unless the stop price is kicked in). User can now pass an optional order id to cancel a specific order including stop orders. Open orders can now be determined with open_orders
. This function is a common call to delete one individual order or deleting all open orders.
cancel_order(order_id = "all", api.key, secret, passphrase)
cancel_order(order_id = "all", api.key, secret, passphrase)
order_id |
Optional character value. This is the order id as generated by GDAX. Default value is "all" which will cancel all open orders. |
api.key |
Mandatory character value. This is the API key as generated by GDAX. Typically a 32 character value. |
secret |
Mandatory character value. This is the API secret as generated by GDAX. Typically a 88 character value. |
passphrase |
Mandatory character value. This is the passphrase as generated by GDAX. Typically a 11 character value. |
A Dataframe of order-ids of all orders that were cancelled.
## Not run: cancel_order(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) cancel_order(order_id = "a0a00000-0000-000a-a000-a0a0aa00000a", api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) ## End(Not run)
## Not run: cancel_order(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) cancel_order(order_id = "a0a00000-0000-000a-a000-a0a0aa00000a", api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) ## End(Not run)
This is an auth based function. User must have valid api keys generated by GDAX which must be passed as mandatory arguments. The functions takes product_id as an optional param and returns a list of all previously filled orders.
fills(api.key, secret, passphrase, product_id = NULL)
fills(api.key, secret, passphrase, product_id = NULL)
api.key |
Mandatory character value. This is the API key as generated by GDAX. Typically a 32 character value. |
secret |
Mandatory character value. This is the API secret as generated by GDAX. Typically a 88 character value. |
passphrase |
Mandatory character value. This is the passphrase as generated by GDAX. Typically a 11 character value. |
product_id |
Optional character value for the currency pair. The default is |
Dataframe with fills for all products or for the provided products. The volume is quoted in USD.
## Not run: fills(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass, product_id = "BTC-USD") ## End(Not run)
## Not run: fills(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass, product_id = "BTC-USD") ## End(Not run)
This is an auth based function. User must have valid api keys generated by GDAX which must be passed as mandatory arguments. The function takes a currency as an additional input and returns the hold information. Since currency and account id have one to one mapping, the currency is being used a proxy. The basic hold amounts can also be fetched using account
or accounts
, however this function provides additional details and ties to active open orders. Please note that each trade buy order, results in a hold on the currency like USD
and each sell order will result in a hold on the cryptoasset like BTC
.
holds(currency = "BTC", api.key, secret, passphrase)
holds(currency = "BTC", api.key, secret, passphrase)
currency |
Optional character value. The default is |
api.key |
Mandatory character value. This is the API key as generated by GDAX. Typically a 32 character value. |
secret |
Mandatory character value. This is the API secret as generated by GDAX. Typically a 88 character value. |
passphrase |
Mandatory character value. This is the passphrase as generated by GDAX. Typically a 11 character value. |
Dataframe with timestamp of all the holds for the currency, the amount & type of hold and a reference id which created the hold.
## Not run: holds(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) holds("ETH", api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) holds("USD", api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) ## End(Not run)
## Not run: holds(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) holds("ETH", api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) holds("USD", api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) ## End(Not run)
This is an auth based function. User must have valid api keys generated by GDAX which must be passed as mandatory arguments. The function will return all open orders by default for Bitcoin This is an extension of open_orders
.
list_orders( api.key, secret, passphrase, product_id = "BTC-USD", status = "open" )
list_orders( api.key, secret, passphrase, product_id = "BTC-USD", status = "open" )
api.key |
Mandatory character value. This is the API key as generated by GDAX. Typically a 32 character value. |
secret |
Mandatory character value. This is the API secret as generated by GDAX. Typically a 88 character value. |
passphrase |
Mandatory character value. This is the passphrase as generated by GDAX. Typically a 11 character value. |
product_id |
Optional character value for the currency pair. The default is |
status |
Optional character value. Limit list of orders to either of 'open', 'pending', or 'active' statuses. Passing 'all' returns orders of all statuses. |
Dataframe with all orders for a given status for that currency.
## Not run: list_orders(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) list_orders(api.key=your_api_key,secret=your_secret, passphrase=your_passphrase, product_id="BTC-EUR",status="active") ## End(Not run)
## Not run: list_orders(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) list_orders(api.key=your_api_key,secret=your_secret, passphrase=your_passphrase, product_id="BTC-EUR",status="active") ## End(Not run)
This is an auth based function. User must have valid api keys generated by GDAX which must be passed as mandatory arguments. The function will return all open orders for all currencies. This is an extendion of holds
& fills
.
open_orders(api.key, secret, passphrase)
open_orders(api.key, secret, passphrase)
api.key |
Mandatory character value. This is the API key as generated by GDAX. Typically a 32 character value. |
secret |
Mandatory character value. This is the API secret as generated by GDAX. Typically a 88 character value. |
passphrase |
Mandatory character value. This is the passphrase as generated by GDAX. Typically a 11 character value. |
Dataframe with all orders and their status for that currency.
## Not run: order_info(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) ## End(Not run)
## Not run: order_info(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) ## End(Not run)
An internal function to parse the api response for various public functions.
parse_response(path, query = NA)
parse_response(path, query = NA)
path |
Mandatory character parameter. This is an extension of the api end point and passed as an argument from the function calling |
query |
Optional named list parameter. This would consist of any named params to be passed to the api end point. |
A named list or a dataframe object of the response.
This function is a public function and will fetch historic rates for provided currency pair (product_id). Rates are returned in grouped buckets based on requested granularity. A maximum of 300 records are returned. If the date range and granularity are not within the resultant volume set, it will be rejected by Coinbase Pro.
public_candles( product_id = "BTC-USD", start = NULL, end = NULL, granularity = NULL )
public_candles( product_id = "BTC-USD", start = NULL, end = NULL, granularity = NULL )
product_id |
Optional character parameter. This is a case insensitive value of the product id for which the order book is desired. Default to |
start |
Optional string parameter. Start time in ISO 8601. Format YYYY-MM-DD |
end |
Optional string parameter. End time in ISO 8601. Format YYYY-MM-DD |
granularity |
Optional parameter. Desired timeslice in seconds. The granularity field must be one of the following values: |
Dataframe with a time of the candle, low, high, open , close and volume for that candle.
## Not run: public_candles() public_candles("ETH-EUR") ublic_candles("ETH-EUR",start="2012-01-18", end="2012-01-25",granularity=3600) ## End(Not run)
## Not run: public_candles() public_candles("ETH-EUR") ublic_candles("ETH-EUR",start="2012-01-18", end="2012-01-25",granularity=3600) ## End(Not run)
This function is a public function and will fetch get 24 hr stats for the provided currency pair (product_id). Volume is in base currency units. open, high, low are in quote currency units.
public_daystats(product_id = "BTC-USD")
public_daystats(product_id = "BTC-USD")
product_id |
Optional character parameter. This is a case insensitive value of the product id for which the order book is desired. Default to |
Dataframe with a single row of product's last 24 hour stats.
## Not run: public_daystats() ## End(Not run)
## Not run: public_daystats() ## End(Not run)
This function is a public function and will fetch all supported currency pairs by default. The function can also fetch all the supported currencies based on the source
argument.
public_info(product = TRUE)
public_info(product = TRUE)
product |
Optional Boolean Parameter. Default to |
Dataframe with ALL supported currency pairs. A dataframe of base currencies is returned when the flag is et as FALSE
.
## Not run: public_info() public_info(product = FALSE) ## End(Not run)
## Not run: public_info() public_info(product = FALSE) ## End(Not run)
This function is a public function and will fetch all bids/asks for provided currency pair (product_id). User should change the level to get the best bid/ask or to fetch all bids/asks.
public_orderbook(product_id = "BTC-USD", level = 1)
public_orderbook(product_id = "BTC-USD", level = 1)
product_id |
Optional character parameter. This is a case insensitive value of the product id for which the order book is desired. Default to |
level |
Optional parameter. Integer value of level denoting level of detail. Valid user values of 1, 2, 3. Default to 1. |
A named list with bids and asks for the provided currency pair.
## Not run: public_orderbook() public_orderbook(product_id = "BCH-USD", level = 3) public_orderbook(product_id = "BTC-EUR", level = 2) ## End(Not run)
## Not run: public_orderbook() public_orderbook(product_id = "BCH-USD", level = 3) public_orderbook(product_id = "BTC-EUR", level = 2) ## End(Not run)
Snapshot information about the last trade (tick), best bid/ask and 24h volume.
public_ticker(product_id = "BTC-USD")
public_ticker(product_id = "BTC-USD")
product_id |
Optional character parameter. This is a case insensitive value of the product id for which the order book is desired. Default to |
A dataframe of most recent trade and 24 hr volume.
## Not run: public_ticker() public_ticker("BTC-EUR") ## End(Not run)
## Not run: public_ticker() public_ticker("BTC-EUR") ## End(Not run)
Gets the server time from GDAX for reference purposes. This function does not take any arguments.
public_time()
public_time()
Dataframe with time in ISO and the epoch field represents decimal seconds since Unix Epoch.
## Not run: public_time() ## End(Not run)
## Not run: public_time() ## End(Not run)
This is a public function and will fetch the 100 latest trades for the provided currency pair (product_id).
public_trades(product_id = "BTC-USD")
public_trades(product_id = "BTC-USD")
product_id |
Optional character parameter. This is a case insensitive value of the product id for which the order book is desired. Default to |
A dataframe of most recent trades indicating if it was buy / sell and what the trade size was.
## Not run: public_trades() public_trades("BTC-EUR") ## End(Not run)
## Not run: public_trades() public_trades("BTC-EUR") ## End(Not run)
This is an auth based function. User must have valid api keys generated by GDAX which must be passed as mandatory arguments. These keys must have the appropriate access. Note that for this function to work, the API key must have transfer access.
pymt_methods(api.key, secret, passphrase)
pymt_methods(api.key, secret, passphrase)
api.key |
Mandatory character value. This is the API key as generated by GDAX. Typically a 32 character value. |
secret |
Mandatory character value. This is the API secret as generated by GDAX. Typically a 88 character value. |
passphrase |
Mandatory character value. This is the passphrase as generated by GDAX. Typically a 11 character value. |
A named list.
## Not run: pmt_methods(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) ## End(Not run)
## Not run: pmt_methods(api.key = your_key, secret = your_api_secret, passphrase = your_api_pass) ## End(Not run)