Learn R Programming

rib (version 0.25.3)

factory: Helpers

Description

Helper functions that simplify the customization of common data structures.

Usage

IBContract(...)

IBOrder(...)

fCondition(type)

Value

IBContract returns a Contract.

IBOrder returns an Order.

fCondition returns a Condition.

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.

See Also

Contract, Order.

Examples

Run this code
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"

Run the code above in your browser using DataLab