IBREST2: IBREST Class

IBREST2R Documentation

IBREST Class

Description

Get data data from IB Client Portal API.

Super class

findata::DataAbstract -> IBREST2

Public fields

domain

Domain, by default localhost

port

Port, by default 5000

baseurl

Base url

Methods

Public methods


Method new()

Create a new IBREST object.

Usage
IBREST2$new(domain = "localhost", port = 5000L, azure_storage_endpoint = NULL)
Arguments
domain

Domain, by default localhost

port

Port, by default 5000

azure_storage_endpoint

Azure storage endpoint

Returns

A new 'IBREST' object.


Method ib_get()

IB GET object

Usage
IBREST2$ib_get(
  url = modify_url(self$baseurl, path = "v1/api/sso/validate"),
  query = NULL
)
Arguments
url

Url of GET endpoint.

query

Query of GET request.

Returns

GET response.


Method ib_post()

IB POST object

Usage
IBREST2$ib_post(
  url = modify_url(self$baseurl, path = "v1/api/tickle"),
  body = NULL
)
Arguments
url

Url of POST endpoint.

body

Body of POST request.

Returns

GET response.


Method get_api_spec()

Get IB REST API description.

Usage
IBREST2$get_api_spec()
Returns

JSON object with description.


Method get_unadjusted_market()

Get unadjusted market data.

Usage
IBREST2$get_unadjusted_market(
  conid,
  exchange = NULL,
  period = "5d",
  bar = "1h",
  outsideRth = TRUE,
  keep_nytime_10_16 = TRUE
)
Arguments
conid

Contract ID.

exchange

Exchange.

period

Period.

bar

Bar.

outsideRth

Data outside trading hours.

keep_nytime_10_16

If TRUE, timezone is changed to NY time and only trading hours kept.

Returns

Data table with unadjusted market data.


Method get_position()

Get portfolio positions.

Usage
IBREST2$get_position(account_id, con_id)
Arguments
account_id

Account ID.

con_id

Contract id.

Returns

list object with info on positions.


Method buy_and_confirm()

Place order.

Usage
IBREST2$buy_and_confirm(account_id, order_body)
Arguments
account_id

Account ID.

order_body

Body of POST request which place order.

Returns

list object with info on positions.


Method cancel_order()

Cancel order.

Usage
IBREST2$cancel_order(account_id, order_id)
Arguments
account_id

Account ID.

order_id

Order id from Place orders endpoint result.

Returns

list object with info on positions.


Method get_portfolio_summary()

Portfolio summary.

Usage
IBREST2$get_portfolio_summary(account_id)
Arguments
account_id

Account ID.

Returns

list object with info on podrtfolio summary.


Method clone()

The objects of this class are cloneable with this method.

Usage
IBREST2$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

References

https://www.interactivebrokers.com/api/doc.html

https://www.interactivebrokers.com/api/doc.html

https://www.interactivebrokers.com/api/doc.html#tag/Market-Data/paths/~1iserver~1marketdata~1history/get

https://www.interactivebrokers.com/api/doc.html#tag/Order/paths/~1iserver~1account~1%7Bacc€ountId%7D~1orders/post


MislavSag/findata documentation built on June 2, 2025, 12:34 p.m.