Open fmair opened 1 year ago
I also met the same issue when trying to incorporate algoParams
. So I am really happy to see this post. But is the code in #40 the same as that in #39? I failed to see how to add algoParams
in placeOrder()
... Any hint?
You add the algoParams
to the order object as above. The placeOrder
function needs to be changed, see: https://github.com/joshuaulrich/IBrokers/pull/40/files. It is just one line.
Cool!! Brilliant!! Problem solved!!
I am exploring other IB algoStrategy in R, and got stuck. For example, for VWAP order, I read the IB API document, and trying to implement that in R with this package.
It has the following parameters which I believe should be fill in the algoParams
I succeed in code like
algoStrategy = "Vwap",
algoParams = c("1", "maxPctVol", "0.2")
but get no luck when trying to incorporate more parameters, for example,
algoStrategy = "Vwap",
algoParams = c("1", "maxPctVol", "0.2",
"2", "startTime", "09:00:00 US/Eastern")
Do you have any suggestion? I guess I might have trouble to understand what the "1"
means in algoParams
. Thanks!
I got it... Key is to change the number in c("1", "maxPctVol", "0.2"). "1" means one argument specified.
For detailed example, I put it here: https://github.com/junyzhou10/IBrokers/tree/master
By adding
algoParams
toplaceOrder
isssue #39 is resolved.I tested the new function with an order for ES DEC 2023 with the following code and it worked as expected. Note that you'll need a running TWS version and trading access to CME futures:
Result in TWS: