Learn R Programming

RobinHood (version 1.6)

place_order: Place a buy or sell order against your RobinHood account

Description

**Note**: Price cannot extend beyond 2 decimals **Note**: Quantity must be a whole number **Note**: Price * Quantity > $0.01

Usage

place_order(
  RH,
  symbol,
  type,
  time_in_force,
  trigger,
  price,
  stop_price = NA,
  quantity,
  side
)

Arguments

RH

object of class RobinHood

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, must be a whole number

side

(string) "buy" or "sell"

Examples

Run this code
# NOT RUN {
# Login in to your RobinHood account
RH <- RobinHood("username", "password")

# Place an order, should generate an email confirmation
x <- place_order(RH = RH,
                 symbol = "GE",          # Ticker symbol you want to trade
                 type = "market",        # Type of market order (market, limit)
                 time_in_force = "gfd",  # Time period the order is good for (gfd: good for day)
                 trigger = "immediate",  # Trigger or delay order
                 price = 8.96,           # The highest price you are willing to pay
                 quantity = 1,           # Number of shares you want
                 side = "buy")           # buy or sell
# }

Run the code above in your browser using DataLab