TDIInstrument: Instrument (R6 class constructor)

TDIInstrumentR Documentation

Instrument (R6 class constructor)

Description

Instrument is an abstract class for (tradeable) market instrument(s). The class provides generic methods and defines the instrument data structure.

Details

The instrument class and its generic methods are to be used by calling packages. The class is abstract and should be implemented for each API.

Super classes

TDI::baseTDI -> TDI::TDIResult -> TDIInstrument

Public fields

source

Identifier for the data source.

symbol

Unique identification symbol.

type

Instrument type classification.

name

Name for the instrument.

exchange

Market for the instrument.

sector

Main sector of the business.

industry

Main industry of the business.

country

Country of registration.

quote

List with latest price data.

keyData

Key data object.

annualCashFlow

Annual cash flow data.

quarterlyCashFlow

Quarterly cash flow data.

series

Xts time series with (historical) data.

Methods

Public methods

Inherited methods

Method setQuote()

Set the latest quote for the instrument.

Usage
TDIInstrument$setQuote(Open, High, Low, Close, Volume)
Arguments
Open

Latest open price.

High

Latest high price.

Low

Latest low price.

Close

Latest close price.

Volume

Volume traded.

Returns

The object itself.


Method setSeries()

Set series or add additional column(s) to the existing data. In case the input is a data-frame it is converted to 'xts'.

Usage
TDIInstrument$setSeries(x)
Arguments
x

Xts time series with (historical) data.

Returns

The object itself.


Method getSession()

Retrieve the trading session data for the input date plus 'n' periods.

Usage
TDIInstrument$getSession(date, n = 0)
Arguments
date

Input date-time.

n

Optional lag number of sessions.

Returns

Requested session data.


Method getReturn()

Return the *returns* calculated from the 'Close' price(s).

Usage
TDIInstrument$getReturn()
Returns

Instrument returns time series.


Method getWealthIndex()

Return the *wealth index* calculated from the returns.

Usage
TDIInstrument$getWealthIndex()
Returns

Instrument returns time series.


Method TechnicalAnalysis()

Execute the specified technical analysis calculations.

Usage
TDIInstrument$TechnicalAnalysis(ta = NULL)
Arguments
ta

Technical analysis indicator object.

Returns

The object itself.


n0Trader/TDI documentation built on July 30, 2023, 7:48 p.m.