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
)
Mandatory character value. This is the API key as generated by GDAX. Typically a 32 character value.
Mandatory character value. This is the API secret as generated by GDAX. Typically a 88 character value.
Mandatory character value. This is the passphrase as generated by GDAX. Typically a 11 character value.
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
.
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"
.
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.
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.
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).
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"
.
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.
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)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab