add_order: Create a New Order For A Currency

Description Usage Arguments Value Examples

View source: R/add_order.R

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
add_order(
  api.key,
  secret,
  passphrase,
  product_id = "BTC-USD",
  type = "limit",
  stop = NULL,
  stop_price = NULL,
  side = "b",
  price = NULL,
  size
)

Arguments

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 "BTC-USD". This param is case insensitive and must be one of the valid currency-pair. The list of valid currency-pairs can be fetched using public_info.

type

Optional character value for the order type. The default is "limit". This param is case insensitive and must be one of the valid order types. The current valid order types is only "limit".

stop

Optional parameter. This parameter is required if a stop order needs to be placed. Possible values apart from default NULL are "loss" or "entry". If a non-default value is provided, stop_price argument must be defined.

stop_price

Optional parameter.The value is needed only if stop is defined. Sets the trigger price for stop order. If stop ="loss", the triger price is when market price is at or below the trigger. If stop = "entry", the trigger price is when market price is at or above the trigger.

side

Optional character value for the order side The default is "b" which stands for buy. This param is case insensitive and must be one of either "b" (buy) or "s" (sell).

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 round function from R. The value is mandatory for type = "limit".

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 public_info which provides the minimun and maximum order sizes for each currency pairs.

Value

Dataframe with status of the order, posted details and created time stamp etc.

Examples

1
2
3
4
5
## 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)

rgdax documentation built on Aug. 3, 2021, 9:06 a.m.