Skip to contents

Backend function called by place_order(), get_order_status(), cancel_order(). Issues a buy/sell order or returns the status of an order. When issuing a buy order use the url column in the return data to check the status or cancel the order.

Usage

api_orders(
  RH,
  action,
  status_url = NULL,
  cancel_url = NULL,
  instrument_id = NULL,
  symbol = NULL,
  type = NULL,
  time_in_force = NULL,
  trigger = NULL,
  price = NULL,
  stop_price = NULL,
  quantity = NULL,
  side = NULL,
  page_size = NULL
)

Arguments

RH

object of class RobinHood

action

(string) one of "order", "status", "cancel", or "history"

status_url

(string) if action = "status", status_url is required (output from place_order())

cancel_url

(string) if action = "cancel", cancel_url is required (output from place_order())

instrument_id

(string) URL of the instrument_id

symbol

(string) Ticket symbol you are attempting to buy or sell

type

(string) "market" or "limit"

time_in_force

(string) Good For Day ("gfd"), Good Till Canceled ("gtc"), Immediate or Cancel ("ioc"), or Opening ("opg")

trigger

(string) "immediate" or "stop"

price

(number) the price you are willing to sell or buy at

stop_price

(number) if trigger = stop, enter stop price, otherwise leave blank

quantity

(int) number of shares you wish to transact

side

(string) "buy" or "sell"

page_size

(int) for get_order_history, refers to the number of historical records to return