if (FALSE) {
# ***************** ATTENTION *****************
# - Price cannot extend beyond 2 decimals
# - Price * Quantity > $0.01
# - Stop triggers requires stop_price > 0
# ***************** ATTENTION *****************
# Login in to your RobinHood account
RH <- RobinHood("username", "password")
# Place an order, should generate an email confirmation
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
# Stop loss example
place_order(RH,
symbol="ABC",
type = 'market',
trigger = 'stop',
stop_price = 100,
time_in_force = "gtc", # Good till close
quantity = 10,
side = 'sell')
}
Run the code above in your browser using DataLab