factory: Helpers

factoryR Documentation

Helpers

Description

Helper functions that simplify the customization of common data structures.

Usage

IBContract(...)

IBOrder(...)

fCondition(type)

Arguments

...

Any combination of named arguments whose names are valid for Contract or Order respectively.

type

Type of condition: one of "Price", "Time", "Margin", "Execution", "Volume" or "PercentChange".

Details

The same result is achieved by making a copy of the respective structures and explicitly reassigning values to the desired fields. The two approaches can be complementary.

Value

IBContract returns a Contract.

IBOrder returns an Order.

fCondition returns a Condition.

See Also

Contract, Order.

Examples

stock <- IBContract(symbol="GOOG", secType="STK", exchange="SMART", currency="USD")

# Equivalent to
stock <- Contract
stock$symbol   <- "GOOG"
stock$secType  <- "STK"
stock$exchange <- "SMART"
stock$currency <- "USD"

order <- IBOrder(action="BUY", totalQuantity=10, orderType="LMT", lmtPrice=99)

condition <- fCondition("Time")
condition$is_more <- TRUE
condition$value   <- "20221114-12:00"

lbilli/rib documentation built on April 22, 2024, 7:26 p.m.