0

任何人都知道如何使用algoStrategy和使用algoParamsIBrokers 包吗?我尝试创建一个列表algoParams但徒劳无功。

例如:

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被忽略了。如果这里有人可以提供帮助,我将不胜感激。谢谢!

4

1 回答 1

2

IBrokers 中的 placeOrder 函数没有实现 algoStrategy 和 algoParams。如果您检查函数的代码:

 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
             )

必须修改函数的结尾:

  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") 其中第一个字符是传递给算法策略的参数数量。

于 2018-02-22T08:58:02.910 回答