place_order: Place a new order

View source: R/wrappers.R

place_orderR Documentation

Place a new order

Description

Place a new order

Usage

place_order(
  token,
  live = FALSE,
  uic,
  buy_sell,
  asset_type = "Stock",
  amount = 1,
  amount_type = "Quantity",
  order_price = 1,
  order_type = "Market",
  to_open_close = "ToOpen",
  wait = 1,
  ...
)

Arguments

token

either a character or a token2.0 reference class (RC) object as returned by httr::oauth2.0_token(). Sim environment uses character, (a '24 hour token'); live environment a token object.

live

boolean, TRUE for live environment, i.e. real money. Defaults to FALSE, i.e. simulation environment.

uic

character, instrument identifier

buy_sell

character, "Buy" or "Sell

asset_type

character, type of asset to buy or sell, e.g. "Stock" (default)

amount

numeric, amount to buy or sell, either by number of stocks ("Quantity") or by value ("CashAmount") as specified by amount_type

amount_type

character, either "CashAmount" or "Quantity" (default)

order_price

numeric, the price of the order, optional for market orders, see order_type parameter

order_type

character, defaults to "Market", see link in Details for more information

to_open_close

Whether the order should be created to open/increase or close/decrease a position. (Only relevant for options)

wait

numeric, passed onto sys.sleep(), seconds to wait (in order not to exceed rate limits)

...

parameters passed on to response_df()

Details

See the Open API Documentation

Value

tibble


lassehjorthmadsen/sherwood documentation built on Sept. 6, 2022, 3:47 p.m.