R IBrokers(互动经纪人API) [英] R IBrokers (Interactive Brokers API)
问题描述
任何人都知道如何在IBrokers软件包中使用algoStrategy
和algoParams
吗?我尝试为algoParams
创建一个列表,但没有成功.
Anyone has any idea how to use algoStrategy
and algoParams
in IBrokers package? I tried creating a list for algoParams
but in vain.
例如:
library(IBrokers)
twsOrder(reqIds(twsconn),
"BUY",
"10",
"MKT",
transmit = TRUE,
algoStrategy = "VWAP",
algoParams = list(maxPctVol = "0.2", startTime = "13:00:00 HKT",
endTime = "13:30:00 HKT", allowPastEndTime = 0,
noTakeLiq = 0, speedUp = 0, monetaryValue = ""))
我的订单原来是市场订单.因此,我假设我对algoStrategy
和algoParams
的输入已被忽略.如果这里有人可以伸出援手,我将不胜感激.谢谢!
My orders turn out to be Market Orders. Thus, I assume my input into algoStrategy
and algoParams
have been ignored. I will be grateful if anyone here can give a helping hand. Thank you!
推荐答案
IBrokers中的placeOrder函数未实现algoStrategy和algoParams.如果您检查该功能的代码:
The function placeOrder in IBrokers isn't implementing algoStrategy and algoParams. If you check the code of the function :
order <- c(order,
"", # DEPRECATED FIELD
Order$discretionaryAmt,
Order$goodAfterTime,
Order$goodTillDate,
Order$faGroup,
Order$faMethod,
Order$faPercentage,
Order$faProfile,
Order$shortSaleSlot,
Order$designatedLocation,
Order$ocaType,
Order$rule80A,
Order$settlingFirm,
Order$allOrNone,
Order$minQty,
Order$percentOffset,
Order$eTradeOnly,
Order$firmQuoteOnly,
Order$nbboPriceCap,
Order$auctionStrategy,
Order$startingPrice,
Order$stockRefPrice,
Order$delta,
Order$stockRangeLower,
Order$stockRangeUpper,
Order$overridePercentageConstraints,
Order$volatility,
Order$volatilityType,
Order$deltaNeutralOrderType,
Order$deltaNeutralAuxPrice,
Order$continuousUpdate,
Order$referencePriceType,
Order$trailStopPrice,
Order$scaleInitLevelSize,
Order$scaleSubsLevelSize,
Order$scalePriceIncrement,
Order$clearingAccount,
Order$clearingIntent,
Order$notHeld,
"0", # Order$underComp .. not yet supported by IBrokers
"", # Order$algoStrategy .. not yet supported by IBrokers
Order$whatIf
)
该函数的结尾必须进行修改:
The end of the function has to be modified :
order <- c(order,
Order$clearingAccount,
Order$clearingIntent,
Order$notHeld,
"0", #underComp # FALSE #NEW but not using it
Order$algoStrategy,
Order$algoParams,
Order$whatIf, # "0",
"" # miscOptionsStr("")
)
并且参数应该类似于:
algoParams=c("6","maxPctVol","0.2","startTime","08:50:00 GMT","endTime","allowPastEndTime","1","noTakeLiq","1","monetaryValue","100000")
第一个字符是要传递到算法策略的参数数.
And the parameters should be similar to :
algoParams=c("6","maxPctVol","0.2","startTime","08:50:00 GMT","endTime","allowPastEndTime","1","noTakeLiq","1","monetaryValue","100000")
where the first character is the number of parameters that are being passed to the algo strategy.
这篇关于R IBrokers(互动经纪人API)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!