Learn R Programming

quantstrat (version 0.16.7)

tradeOrderStats: get order information associated with closing positions

Description

Combine perTradeStats output with closed order information.

Usage

tradeOrderStats(portfolio, symbol, ...)

Arguments

portfolio

text name of the portfolio the order book is associated with

symbol

text string defining the symbol to get trades and orders for

...

any other passthrough parameters

Value

A xts object containing:

Order.Qty

Order.Price

Order.Type

Order.Side

Order.Threshold

Order.Status

should be 'closed' only

Order.StatusTime

time of the closing trade, should match 'End' column

Prefer

prefer argument for getPrice

Order.Set

order set of the closing trade

Txn.Fees

and fees applied to the closing trade

Rule

the name of the rule that generated the order which closed the position

Start

the POSIXct timestamp of the start of the trade

Init.Pos

the initial position on opening the trade

Max.Pos

the maximum (largest) position held during the open trade

Num.Txns

the number of transactions included in this trade

Max.Notional.Cost

the largest notional investment cost of this trade

Net.Trading.PL

net trading P&L in the currency of Symbol

MAE

Maximum Adverse Excursion (MAE), in the currency of Symbol

MFE

Maximum Favorable Excursion (MFE), in the currency of Symbol

Pct.Net.Trading.PL

net trading P&L in percent of invested Symbol price gained or lost

Pct.MAE

Maximum Adverse Excursion (MAE), in percent

Pct.MFE

Maximum Favorable Excursion (MFE), in percent

tick.Net.Trading.PL

net trading P&L in ticks

tick.MAE

Maximum Adverse Excursion (MAE) in ticks

tick.MFE

Maximum Favorable Excursion (MFE) in ticks

Details

TODO: decide which of these columns are actually important TODO: add option for opening order/trade pairing rather than closing