placeOrder: Place an order on a broker/exchange platform

View source: R/placeOrder.R

placeOrderR Documentation

Place an order on a broker/exchange platform

Description

This function place an existing order on a specified broker or exchange platform

Usage

placeOrder(
  src = "tinkoff",
  symbol = "SBER",
  board = "MOEX",
  action = "BUY",
  orderType = "LMT",
  totalQuantity = "10",
  lmtPrice = "100",
  auxPrice = "",
  api.key = "",
  live = TRUE,
  tif = "",
  orderId = "",
  clientId = "",
  verbose = TRUE
)

Arguments

src

A character string indicating the broker/exchange. Currently supported sources are 'tinkoff', 'finam', and 'alor'.

symbol

A character string indicating the security symbol.

board

A character string indicating the exchange board.

action

A character string indicating the action to perform. Possible values are 'BUY' and 'SELL'.

orderType

A character string indicating the type of order. Possible values are 'LMT' (limit) and 'MKT' (market).

totalQuantity

A character string or numeric value indicating the quantity of securities to order.

lmtPrice

A character string or numeric value indicating the limit price for the order.

auxPrice

A character string or numeric value indicating the auxiliary price for the order. This parameter is only used when orderType is 'STP' (stop).

api.key

A character string indicating the API key to use for authentication with the broker/exchange.

live

A logical value indicating whether to place a live (real) order or a test (paper) order.

tif

A character string indicating the time-in-force of the order. Possible values are 'DAY', 'GTC' (good till cancel), and 'IOC' (immediate or cancel).

orderId

A character string indicating the order ID to use. If empty, a random ID is generated.

clientId

A character string indicating the client ID to use.

verbose

A logical value indicating whether to print verbose output.

Value

A list with the result of the order placement.

Note

Not for the faint of heart. All profits and losses related are yours and yours alone. If you don't like it, write it yourself.

Examples

myorder = placeOrder(src = 'alor',
                     symbol = 'MTLR-6.23',
                     board = 'MOEX',
                     action = 'BUY',
                     orderType = 'LMT',
                     totalQuantity = 1,
                     lmtPrice = 20000,
                     api.key = '',
                     clientId = 'cliendID')

rusquant documentation built on Sept. 30, 2024, 9:42 a.m.