cancel_order: Cancel an existing order on RobinHood

View source: R/cancel_order.R

cancel_orderR Documentation

Cancel an existing order on RobinHood

Description

Send a cancel signal for a particular order to RobinHood. You will need to retain the buy/sell order url returned from place_order.

Usage

cancel_order(RH, cancel_url)

Arguments

RH

object of class RobinHood

cancel_url

(string) cancel url returned from place_order()

Examples

## 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
                 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

# Cancel the order, should also generate an email confirmation
cancel_order(RH, x$cancel_url)

## End(Not run)

RobinHood documentation built on Jan. 7, 2023, 1:11 a.m.