flex_web_service | R Documentation |
Retrieve queries via the Flex Web Service.
flex_web_service(file, token, query, version = 3, delay = 2,
no.write.msg = TRUE, no.write.warn = TRUE,
verbose = TRUE, ...)
file |
character: filename for the downloaded report |
token |
character (not numeric!) |
query |
integer |
version |
integer; currently only 3 is supported |
delay |
integer: number of seconds to wait between sending the token and retrieving the flex-data report |
no.write.msg |
logical: do not write file if it contains a message |
no.write.warn |
logical: do not write file if it contains a warning |
verbose |
logical: sets the 'quiet' argument of
|
Retrieve flex queries via download.file
.
The function also checks whether the downloaded file
contains messages from IB (lines that start with
“MSG
”).
The function is called for its side effect: downloading and storing the results of a flex query.
The function will first send token
and
query
to IB. If the response does not contain
a
<Status>Success</Status>
, the complete response will be printed and a value of 1 is invisibly returned.
Otherwise, an attempt to download the report is made,
and the return value of download.file
will be invisibly returned.
However, even if the download succeeds, the file may
contain error messages or warnings. Even mere
‘messages’ often indicate that something did
not work (e.g. particular accounts could not be
included). flex_web_service
will print
messages or warnings that it finds in the files, and
the return value will be invisible 1. The downloaded
file will not be written in such a case, unless
no.write.msg
and no.write.warn
are set
to FALSE
; both arguments default to
TRUE.
Enrico Schumann
https://www.interactivebrokers.com/campus/ibkr-api-page/flex-web-service/
ib_hist_data
, download.file
## Not run:
flex_web_service(file = "~/my_files/my_report.csv",
token = "12345678901234567890", ## character!
query = 123)
file <- "~/Downloads/Net_Asset_Value_NAV_in_Base"
ans <- read_flex_report(file)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.