Algorithms
Order behaviour can be further enhanced through Interactive Broker’s powerful algorithmic strategies. To make use of our variety of algorithms make use of IBApi.Order.AlgoStrategy and IBApi.Order.AlgoParams attributes.
【译】通过IB强大的算法策略,可以进一步增强订单的功能。为了使用我们的算法,您需要设置并使用IBApi.Order.AlgoStrategy以及IBApi.Order.AlgoParams标签。
IB Algorithms(IB算法)
CSFB Algorithms(CSFB算法)
Jefferies Algorithms(Jefferies算法)
Adaptive Algo(自适应算法)
The Adaptive Algo combines IB’s Smartrouting capabilities with user-defined priority settings in an effort to achieve further cost efficiency at the point of execution. Using the Adaptive algo leads to better execution prices on average than for regular limit or market orders.
【译】自适应算法,结合了IB的智能路由技术和用户自定义优先级,以便在执行时进一步的实现成本效益。使用自适应算法将获得比常规的市价单或限价单更优的执行价格。
Parameter | Description | Values |
---|---|---|
adaptivePriority | The ‘Priority’ selector determines the time taken to scan for better execution prices. The ‘Critical’ setting scans only briefly, while the ‘Patient’ scan works more slowly and has a higher chance of achieving a better overall fill for your order. | Critical > Urgent > Normal > Patient |
自适应优先级 | 优先级‘Priority’选项决定了从市场中获取最佳价格需要花费的时间。’Critical(重要)’选项,只查看简要信息,’Patient(耐心)’选项则执行速度缓慢,但有极高的几率找到最合适的执行价位。 | Critical(重要) > Urgent(急迫) > Normal(正常) > Patient(耐心) |
Order baseOrder = OrderSamples.LimitOrder("BUY", 1000, 1);
…
AvailableAlgoParams.FillAdaptiveParams(baseOrder, "Normal"); client.placeOrder(nextOrderId++, ContractSamples.USStockAtSmart(), baseOrder);
…
public static void FillAdaptiveParams(Order baseOrder, String priority) { baseOrder.algoStrategy("Adaptive"); baseOrder.algoParams(new ArrayList<>()); baseOrder.algoParams().add(new TagValue("adaptivePriority", priority)); }
ArrivalPrice(到达价格)
The Arrival Price algorithmic order type will attempt to achieve, over the course of the order, the bid/ask midpoint at the time the order is submitted. The Arrival Price algo is designed to keep hidden orders that will impact a high percentage of the average daily volume (ADV). The pace of execution is determined by the user-assigned level of risk aversion and the user-defined target percent of average daily volume. How quickly the order is submitted during the day is determined by the level of urgency: the higher the urgency the faster it will execute but will expose it to a greater market impact.
【译】达到价格算法订单,将在订单提交后,在完成交易前达到出价/询价的中点。达到价格算法用于隐藏可能会对日均成交量产生较大影响的订单。执行速度取决于用户指定的风险厌恶水平和用户定义的平均日交易量的目标百分比。订单在当天提交的速度取决于紧急程度:紧迫性越高,执行速度越快,但会受到更大的市场影响。
Market impact can be lessened by assigning lesser urgency, which is likely to lengthen the duration of the order. The user can set the max percent of ADV from 1 to 50%. The order entry screen allows the user to determine when the order will start and end regardless of whether or not the full amount of the order has been filled. By checking the box marked Allow trading past end time the algo will continue to work past the specified end time in an effort to fill the remaining portion of the order.
【译】市场影响可以通过指定较少紧迫性来减少,也就是说将延长订单执行时间。用户可以设置ADV百分比从100%调整到50%。用户可以通过订单窗口输入何时开始和结束,而不需要关心订单是否完全成交。通过选择“允许(Allow)”持续工作,算法将一直运行到指定的时间,以尽量保证订单剩余部分获得成交。
Parameter | Description | Values |
---|---|---|
maxPctVol | Maximum percentage of ADV | 0.1 (10%) - 0.5 (50%) |
riskAversion | Urgency/risk aversion | Get Done, Aggressive, Neutral, Passive |
startTime | Algorithm starting time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
endTime | Algorithm ending time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
allowPastEndTime | Allow trading past end time | 1 (true) or 0 (false) |
forceCompletion | Attempt completion by the end of the day | 1 (true) or 0 (false) |
monetaryValue Cash | Quantity |
Order baseOrder = OrderSamples.LimitOrder("BUY", 1000, 1);
…
AvailableAlgoParams.FillArrivalPriceParams(baseOrder, 0.1, "Aggressive", "09:00:00 CET", "16:00:00 CET", true, true, 100000); client.placeOrder(nextOrderId++, ContractSamples.USStockAtSmart(), baseOrder);
…
public static void FillArrivalPriceParams(Order baseOrder, double maxPctVol, String riskAversion, String startTime, String endTime, boolean forceCompletion, boolean allowPastTime, double monetaryValue) { baseOrder.algoStrategy("ArrivalPx"); baseOrder.algoParams(new ArrayList<>()); baseOrder.algoParams().add(new TagValue("maxPctVol", String.valueOf(maxPctVol))); baseOrder.algoParams().add(new TagValue("riskAversion", riskAversion)); baseOrder.algoParams().add(new TagValue("startTime", startTime)); baseOrder.algoParams().add(new TagValue("endTime", endTime)); baseOrder.algoParams().add(new TagValue("forceCompletion", forceCompletion ? "1" : "0")); baseOrder.algoParams().add(new TagValue("allowPastEndTime", allowPastTime ? "1" : "0")); baseOrder.algoParams().add(new TagValue("monetaryValue", String.valueOf(monetaryValue))); }
Close Price(收盘价)
Investors submitting market or limit orders into the closing auction may adversely affect the closing price, especially when the size of the order is large relative to the average close auction volume. In order to help investors attempting to execute towards the end of the trading session we have developed the Close Price algo Strategy. This algo breaks down large order amounts and determines the timing of order entry so that it will continuously execute in order to minimize slippage. The start and pace of execution are determined by the user who assigns a level of market risk and specifies the target percentage of volume, while the algo considers the prior volatility of the stock.
【译】投资者提交市价或限价订单在关闭拍卖时可能会影响到收盘价,尤其是当成交量相对于收盘时有较大比例时。为了帮助投资者试图在收盘时完成交易,我们为投资者开发了收盘价算法策略。该算法将大量订单拆散,并且判断入场时机,因此将持续的成交最小化市价的扰动。在开始阶段,由用户指定一个市场风险偏好,以及目标成交量百分比,算法将自主的发挥。
Parameter | Description | Values |
---|---|---|
maxPctVol | Maximum percentage of ADV | 0.1 (10%) - 0.5 (50%) |
riskAversion | Urgency/risk aversion | Get Done, Aggressive, Neutral, Passive |
startTime | Algorithm starting time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
forceCompletion | Attempt completion by the end of the day | 1 (true) or 0 (false) |
monetaryValue Cash | Quantity |
Order baseOrder = OrderSamples.LimitOrder("BUY", 1000, 1);
…
AvailableAlgoParams.FillClosePriceParams(baseOrder, 0.5, "Neutral", "12:00:00 EST", true, 100000); client.placeOrder(nextOrderId++, ContractSamples.USStockAtSmart(), baseOrder);
…
public static void FillClosePriceParams(Order baseOrder, double maxPctVol, String riskAversion, String startTime, boolean forceCompletion, double monetaryValue){ baseOrder.algoStrategy("ClosePx"); baseOrder.algoParams(new ArrayList<>()); baseOrder.algoParams().add(new TagValue("maxPctVol", String.valueOf(maxPctVol))); baseOrder.algoParams().add(new TagValue("riskAversion", riskAversion)); baseOrder.algoParams().add(new TagValue("startTime", startTime)); baseOrder.algoParams().add(new TagValue("forceCompletion", forceCompletion ? "1" : "0")); baseOrder.algoParams().add(new TagValue("monetaryValue", String.valueOf(monetaryValue))); }
DarkIce(黑冰)
The Dark Ice order type develops the concept of privacy adopted by orders such as Iceberg or Reserve, using a proprietary algorithm to further hide the volume displayed to the market by the order. Clients can determine the timeframe an order remains live and have the option to allow trading past end time in the event it is unfilled by the stated end time.
黑冰订单类型开发了诸如冰山或储备等订单所采用的隐私概念,使用专有算法进一步隐藏订单显示给市场的数量。 客户可以确定订单的生效时间表,并且可以选择允许交易超过交收时间,以便在指定的结束时间内没有交易时间。
In order to minimize market impact in the event of large orders, users can specify a display size to be shown to the market different from the actual order size. Additionally, the Dark Ice algo randomizes the display size +/- 50% based upon the probability of the price moving favorably. Further, using calculated probabilities, the algo decides whether to place the order at the limit price or one tick lower than the current offer for buy orders and one tick higher than the current bid for sell orders.
【译】黑冰订单的概念由Iceberg(冰山)或Reserve(保留)发展而来,使用专有的算法掩盖实际成交量。客户端可以判定
为了在大订单的情况下将市场影响降至最低,用户可以指定显示尺寸以向市场显示与实际订单尺寸不同的尺寸。 此外,暗冰算法根据价格移动的可能性将显示尺寸随机化为+/- 50%。 此外,使用计算的概率,算法决定是将订单放在限价价格还是比当前买入订单低一个订单,并比当前卖出订单出价高一个订单。
Parameter | Description | Values |
---|---|---|
displaySize | Order size to be displayed | |
startTime | Algorithm starting time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
endTime | Algorithm ending time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
allowPastEndTime Allow | trading past end time | 1 (true) or 0 (false) |
monetaryValue Cash | Quantity |
Order baseOrder = OrderSamples.LimitOrder("BUY", 1000, 1);
…
AvailableAlgoParams.FillDarkIceParams(baseOrder, 10, "09:00:00 CET", "16:00:00 CET", true, 100000); client.placeOrder(nextOrderId++, ContractSamples.USStockAtSmart(), baseOrder);
…
public static void FillDarkIceParams(Order baseOrder, int displaySize, String startTime, String endTime, boolean allowPastEndTime, double monetaryValue) { baseOrder.algoStrategy("DarkIce"); baseOrder.algoParams(new ArrayList<>()); baseOrder.algoParams().add(new TagValue("displaySize", String.valueOf(displaySize))); baseOrder.algoParams().add(new TagValue("startTime", startTime)); baseOrder.algoParams().add(new TagValue("endTime", endTime)); baseOrder.algoParams().add(new TagValue("allowPastEndTime", allowPastEndTime ? "1" : "0")); baseOrder.algoParams().add(new TagValue("monetaryValue", String.valueOf(monetaryValue))); }
Accumulate/Distribute(聚集/分发)
The Accumulate/Distribute algo can help you to achieve the best price for a large volume order without being noticed in the market, and can be set up for high frequency trading. By slicing your order into smaller randomly-sized order increments that are released at random time intervals within a user-defined time period, the algo allows the trading of large blocks of stock and other instruments without being detected in the market. The algo allows limit, market, and relative order types. When you put in a Relative Order, you must specify what it is relative to, and here you have a lot of choices. Of course, if it is relative to a fixed value then it is really a Limit Order, but you can make it relative to things like the prevailing bid, the ask, the last price, the VWAP or moving VWAP, the moving average or exponential moving average, your last trade price or the number of shares you have bought so far.
【译】聚集/分发算法,能够帮助您的大额订单获得市场最佳价格,而不被发现,可以被用于高频交易。通过将您的订单分割成不同大小的部分,在指定的时间范围内随机的交易。算法允许在市场中交易各类投资品时,而不被发现。算法支持限价单,市价单,以及相关订单类型。当您提交一个关联订单,您必须指定它关联什么,这里,您将有多种选择。当然,如果它关联一个固定价格,那么它将是一个限价单,当然,您也可以关联到其他的,比如询价、报价、最新价格、VWAP或移动VWAP,移动平均或指数移动平均,或者是您最近的交易价格,或迄今为止的股份。
Parameter | Description | Values |
---|---|---|
componentSize | Quantity of increment | Cannot exceed initial size |
timeBetweenOrders | Time interval in seconds between each order | |
randomizeTime20 | Randomise time period by +/- 20% | 1 (true) or 0 (false) |
randomizeSize55 | Randomise size by +/- 55% | 1 (true) or 0 (false) |
giveUp | Number associated with the clearing | |
catchUp | Catch up in time | 1 (true) or 0 (false) |
waitForFill | Wait for current order to fill before submitting next order | 1 (true) or 0 (false) |
startTime | Algorithm starting time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
endTime | Algorithm ending time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
Order baseOrder = OrderSamples.LimitOrder("BUY", 1000, 1);
…
// The Time Zone in "startTime" and "endTime" attributes is ignored and always defaulted to GMT AvailableAlgoParams.FillAccumulateDistributeParams(baseOrder, 10, 60, true, true, 1, true, true, "20161010-12:00:00 GMT", "20161010-16:00:00 GMT"); client.placeOrder(nextOrderId++, ContractSamples.USStockAtSmart(), baseOrder);
…
public static void FillAccumulateDistributeParams(Order baseOrder, int componentSize, int timeBetweenOrders, boolean randomizeTime20, boolean randomizeSize55, int giveUp, boolean catchUp, boolean waitForFill, String startTime, String endTime) { baseOrder.algoStrategy("AD"); baseOrder.algoParams(new ArrayList<>()); baseOrder.algoParams().add(new TagValue("componentSize", String.valueOf(componentSize))); baseOrder.algoParams().add(new TagValue("timeBetweenOrders", String.valueOf(timeBetweenOrders))); baseOrder.algoParams().add(new TagValue("randomizeTime20", randomizeTime20 ? "1" : "0")); baseOrder.algoParams().add(new TagValue("randomizeSize55", randomizeSize55 ? "1" : "0")); baseOrder.algoParams().add(new TagValue("giveUp", String.valueOf(giveUp))); baseOrder.algoParams().add(new TagValue("catchUp", catchUp ? "1" : "0")); baseOrder.algoParams().add(new TagValue("waitForFill", waitForFill ? "1" : "0")); baseOrder.algoParams().add(new TagValue("startTime", startTime)); baseOrder.algoParams().add(new TagValue("endTime", endTime)); }
Percentage of Volume(总量百分比)
The Percent of Volume algo can limit the contribution of orders to overall average daily volume in order to minimize impact. Clients can set a value between 1-50% to control their participation between stated start and end times. Order quantity and volume distribution over the day is determined using the target percent of volume you entered along with continuously updated volume forecasts calculated from TWS market data. In addition, the algo can be set to avoid taking liquidity, which may help avoid liquidity-taker fees and could result in liquidity-adding rebates. By checking the Attempt to never take liquidity box, the algo is discouraged from hitting the bid or lifting the offer if possible. However, this may also result in greater deviations from the benchmark, and in partial fills, since the posted bid/offer may not always get hit as the price moves up/down. IB will use best efforts not to take liquidity when this box is checked, however, there will be times that it cannot be avoided.
【译】总量百分比算法能限制订单对日均成交量的影响力。客户可以在规定的时间内设置一个1-50%参与比例。订单与成交量在当天的分布情况,由你输入的目标百分比,并根据TWS市场交易数据持续的进行预测计算。此外,可以设置算法以避免占用流动性,这可以避免占用流动性的费用,但是会增加由于流动性增加导致的交易费用。通过选取永不尝试占用流动性的选项,算法将可能不主动参与询价投标或取消报价。因此,它将可能导致更严重的偏离基准,或者局部成交,因为提交的报价/询价可能无法准确击中市价的变动。当用户点选该选项后,IB将尽最大的努力不占用用户的流动性,但是并不能保证每次都可以这样做。
Parameter | Description | Values |
---|---|---|
pctVol | Target Percentage | 0.1 (10%) - 0.5 (50%) |
startTime | Algorithm starting time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
endTime | Algorithm ending time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
noTakeLiq | Attempt to never take liquidity | 1 (true) or 0 (false) |
monetaryValue Cash | Quantity |
Order baseOrder = OrderSamples.LimitOrder("BUY", 1000, 1);
…
AvailableAlgoParams.FillPctVolParams(baseOrder, 0.5, "12:00:00 EST", "14:00:00 EST", true, 100000); client.placeOrder(nextOrderId++, ContractSamples.USStockAtSmart(), baseOrder);
…
public static void FillPctVolParams(Order baseOrder, double pctVol, String startTime, String endTime, boolean noTakeLiq, double monetaryValue) { baseOrder.algoStrategy("PctVol"); baseOrder.algoParams(new ArrayList<>()); baseOrder.algoParams().add(new TagValue("pctVol", String.valueOf(pctVol))); baseOrder.algoParams().add(new TagValue("startTime", startTime)); baseOrder.algoParams().add(new TagValue("endTime", endTime)); baseOrder.algoParams().add(new TagValue("noTakeLiq", noTakeLiq ? "1" : "0")); baseOrder.algoParams().add(new TagValue("monetaryValue", String.valueOf(monetaryValue))); }
TWAP
The TWAP algo aims to achieve the time-weighted average price calculated from the time you submit the order to the time it completes. Incomplete orders at the end of the stated completion time will continue to fill if the box ‘allow trading past end time’ is checked. Users can set the order to trade only when specified conditions are met. Those user-defined inputs include when the order is marketable, when the midpoint matches the required price, when the same side (buy or sell) matches to make the order marketable or when the last traded price would make the order marketable. For the TWAP algo, the average price calculation is calculated from the order entry time through the close of the market and will only attempt to execute when the criterion is met. The order may not fill throughout its stated duration and so the order is not guaranteed. TWAP is available for all US equities.
【译】TWAP 算法,旨在从您提交订单到完成的时间段内,完成基于时间权重的平均价格计算。未完成的订单,如果勾选了“允许超过交易时间”,那么会在一定的时间内持续成交。用户可以设置当满足某些情况,订单成交的条件。那些用户定义的输入包含,当订单是可交易的,当中值达到某个价格,当在同侧(买入或卖出)价位可交易时,或者最后一次成交价使得订单可交易。对于 TWAP 算法,平均价格的计算从订单进场时间直到闭市,并将在满足特定条件时执行。订单可能不会在该时间内全部执行,所以它是不可保证的。TWAP 对于所有的美国普通股有效。
Parameter | Description | Values |
---|---|---|
strategyType | Trade strategy | Marketable, Matching, Midpoint, Matching Same Side, Matching Last |
startTime | Algorithm starting time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
endTime | Algorithm ending time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
allowPastEndTime | Allow trading past end time | 1 (true) or 0 (false) |
monetaryValue Cash | Quantity |
Order baseOrder = OrderSamples.LimitOrder("BUY", 1000, 1);
…
AvailableAlgoParams.FillTwapParams(baseOrder, "Marketable", "09:00:00 CET", "16:00:00 CET", true, 100000); client.placeOrder(nextOrderId++, ContractSamples.USStockAtSmart(), baseOrder);
…
public static void FillTwapParams(Order baseOrder, String strategyType, String startTime, String endTime, boolean allowPastEndTime, double monetaryValue) { baseOrder.algoStrategy("Twap"); baseOrder.algoParams(new ArrayList<>()); baseOrder.algoParams().add(new TagValue("strategyType", strategyType)); baseOrder.algoParams().add(new TagValue("startTime", startTime)); baseOrder.algoParams().add(new TagValue("endTime", endTime)); baseOrder.algoParams().add(new TagValue("allowPastEndTime", allowPastEndTime ? "1" : "0")); baseOrder.algoParams().add(new TagValue("monetaryValue", String.valueOf(monetaryValue))); }
Price Variant Percentage of Volume Strategy (基于价格变化百分比)
Price Variant Percentage of Volume Strategy - This algo allows you to participate in volume at a user-defined rate that varies over time depending on the market price of the security. This algo allows you to buy more aggressively when the price is low and be more passive as the price increases, and just the opposite for sell orders. The order quantity and volume distribution over the time during which the order is active is determined using the target percent of volume you entered along with continuously updated volume forecasts calculated from TWS market data.
【译】基于价格变化百分比,该算法允许你自定义一个价格变化百分比范围,根据市价变化情况动态的调整订单的成交量。该算法允许你在价格更低时更激进的买入,价格更高时消极的卖出,或者相反。订单量与成交量,将基于TWS数据与你所设定的目标价格变动范围,进行动态的调整。
Parameter | Description | Values |
---|---|---|
pctVol | Target Percentage | 0.1 (10%) - 0.5 (50%) |
deltaPctVol | Target Percentage Change Rate | 0.1 (10%) - 0.5 (50%) |
minPctVol4Px | Minimum Target Percentage | 0.1 (10%) - 0.5 (50%) |
maxPctVol4Px | Maximum Target Percentage | 0.1 (10%) - 0.5 (50%) |
startTime | Algorithm starting time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
endTime | Algorithm ending time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
noTakeLiq | Attempt to never take liquidity | 1 (true) or 0 (false) |
monetaryValue | Cash Quantity |
Order baseOrder = OrderSamples.LimitOrder("BUY", 1000, 1);
…
AvailableAlgoParams.FillPriceVariantPctVolParams(baseOrder, 0.1, 0.05, 0.01, 0.2, "12:00:00 EST", "14:00:00 EST", true, 100000); client.placeOrder(nextOrderId++, ContractSamples.USStockAtSmart(), baseOrder);
…
public static void FillPriceVariantPctVolParams(Order baseOrder, double pctVol, double deltaPctVol, double minPctVol4Px, double maxPctVol4Px, String startTime, String endTime, boolean noTakeLiq, double monetaryValue){ baseOrder.algoStrategy("PctVolPx"); baseOrder.algoParams(new ArrayList<>()); baseOrder.algoParams().add(new TagValue("pctVol", String.valueOf(pctVol))); baseOrder.algoParams().add(new TagValue("deltaPctVol", String.valueOf(deltaPctVol))); baseOrder.algoParams().add(new TagValue("minPctVol4Px", String.valueOf(minPctVol4Px))); baseOrder.algoParams().add(new TagValue("maxPctVol4Px", String.valueOf(maxPctVol4Px))); baseOrder.algoParams().add(new TagValue("startTime", startTime)); baseOrder.algoParams().add(new TagValue("endTime", endTime)); baseOrder.algoParams().add(new TagValue("noTakeLiq", noTakeLiq ? "1" : "0")); baseOrder.algoParams().add(new TagValue("monetaryValue", String.valueOf(monetaryValue)));
Size Variant Percentage of Volume Strategy (基于订单量变化百分比)
Size Variant Percentage of Volume Strategy - This algo allows you to participate in volume at a user-defined rate that varies over time depending on the remaining size of the order. Define the target percent rate at the start time (Initial Participation Rate) and at the end time (Terminal Participation Rate), and the algo calculates the participation rate over time between the two based on the remaining order size. This allows the order to be more aggressive initially and less aggressive toward the end, or vice versa.
【译】基于订单变化百分比策略,该算法允许你自定义一个成交百分比范围,根据时间的变化成交部分的订单。你需要定义开始时以及结束时需要成交的百分比,算法将计算在有效时间内需要成交的百分比。算法允许你开始时激进,而随着时间逐渐保守,又或者相反。
Parameter | Description | Values |
---|---|---|
startPctVol | Initial Target Percentage | 0.1 (10%) - 0.5 (50%) |
endPctVol | Terminal Target Percentage | 0.1 (10%) - 0.5 (50%) |
startTime | Algorithm starting time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
endTime | Algorithm ending time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
noTakeLiq | Attempt to never take liquidity | 1 (true) or 0 (false) |
monetaryValue Cash | Quantity |
Order baseOrder = OrderSamples.LimitOrder("BUY", 1000, 1);
…
AvailableAlgoParams.FillSizeVariantPctVolParams(baseOrder, 0.2, 0.4, "12:00:00 EST", "14:00:00 EST", true, 100000); client.placeOrder(nextOrderId++, ContractSamples.USStockAtSmart(), baseOrder);
…
public static void FillSizeVariantPctVolParams(Order baseOrder, double startPctVol, double endPctVol, String startTime, String endTime, boolean noTakeLiq, double monetaryValue) { baseOrder.algoStrategy("PctVolSz"); baseOrder.algoParams(new ArrayList<>()); baseOrder.algoParams().add(new TagValue("startPctVol", String.valueOf(startPctVol))); baseOrder.algoParams().add(new TagValue("endPctVol", String.valueOf(endPctVol))); baseOrder.algoParams().add(new TagValue("startTime", startTime)); baseOrder.algoParams().add(new TagValue("endTime", endTime)); baseOrder.algoParams().add(new TagValue("noTakeLiq", noTakeLiq ? "1" : "0")); baseOrder.algoParams().add(new TagValue("monetaryValue", String.valueOf(monetaryValue))); }
Time Variant Percentage of Volume Strategy (基于时间变化百分比)
Time Variant Percentage of Volume Strategy - This algo allows you to participate in volume at a user-defined rate that varies with time. Define the target percent rate at the start time and at the end time, and the algo calculates the participation rate over time between the two. This allows the order to be more aggressive initially and less aggressive toward the end, or vice versa.
【译】基于时间变化百分比,该算法允许你定义一个随时间变化的百分比。通过设置在开始和结束时的成交量,算法会计算在持续时间中的成交量。该算法允许你开始时激进,结束时较为激进,或者相反。
(译者注:Time Variant Percentage 与 Size Variant Percentage 的最大区别是后在每次执行命令是基于剩余订单量的百分比。)
Parameter | Description | Values |
---|---|---|
startPctVol | Initial Target Percentage | 0.1 (10%) - 0.5 (50%) |
endPctVol | Terminal Target Percentage | 0.1 (10%) - 0.5 (50%) |
startTime | Algorithm starting time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
endTime | Algorithm ending time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
noTakeLiq | Attempt to never take liquidity | 1 (true) or 0 (false) |
monetaryValue Cash | Quantity |
Order baseOrder = OrderSamples.LimitOrder("BUY", 1000, 1);
…
AvailableAlgoParams.FillTimeVariantPctVolParams(baseOrder, 0.2, 0.4, "12:00:00 EST", "14:00:00 EST", true, 100000); client.placeOrder(nextOrderId++, ContractSamples.USStockAtSmart(), baseOrder);
…
public static void FillTimeVariantPctVolParams(Order baseOrder, double startPctVol, double endPctVol, String startTime, String endTime, boolean noTakeLiq, double monetaryValue){ baseOrder.algoStrategy("PctVolTm"); baseOrder.algoParams(new ArrayList<>()); baseOrder.algoParams().add(new TagValue("startPctVol", String.valueOf(startPctVol))); baseOrder.algoParams().add(new TagValue("endPctVol", String.valueOf(endPctVol))); baseOrder.algoParams().add(new TagValue("startTime", startTime)); baseOrder.algoParams().add(new TagValue("endTime", endTime)); baseOrder.algoParams().add(new TagValue("noTakeLiq", noTakeLiq ? "1" : "0")); baseOrder.algoParams().add(new TagValue("monetaryValue", String.valueOf(monetaryValue))); }
VWAP
IB’s best-efforts VWAP algo seeks to achieve the Volume-Weighted Average price (VWAP), calculated from the time you submit the order to the close of the market.
【译】 IB最佳效果的 VWAP 算法,寻求达成基于成交量权重平均价格(VWAP),从你提交订单的时间直到市场结束交易。
If you require a guaranteed VWAP, please refer to IB’s Guaranteed VWAP order type.
【译】如果你寻求一个保证的 VWAP,请参考 IB 的VWAP保证交易订单类型。
Best-efforts VWAP algo is a lower-cost alternative to the Guaranteed VWAP that enables the user to attempt never to take liquidity while also trading past the end time. Because the order may not be filled on the bid or at the ask prices, there is a trade-off with this algo. The order may not fully fill if the user is attempting to avoid liquidity-taking fees and/or maximize liquidity-adding rebates, and may miss the benchmark by asking to stay on the bid or ask. The user can determine the maximum percentage of average daily volume (up to 50%) his order will comprise.
The system will generate the VWAP from the time the order is entered through the close of trading, and the order can be limited to trading over a pre-determined period. The user can request the order to continue beyond its stated end time if unfilled at the end of the stated period. The best-efforts VWAP algo is available for all US equities.
【译】最有效VWAP算法,是一种较保证VWAP算法低花费的改良,它允许用户尽量不占用流动性,同时也可以在结束时间后进行交易的算法。因为订单可能不会在卖出/买入价完全成交,所以产生了这样的算法。如果用户试图避免占用流动性,或者产生流动性成本,那么可能导致订单无法完全交易,并且错过买入/卖出价的基准。用户可以确定自己的日交易量50%的订单量。
系统将会从输入订单直至结束交易生成 VWAP 算法,订单可以在一个预设时间内限制交易。如果在指定时间仍然未执行完毕,那么用户可以要求该订单在结束时间之后继续执行。所有美国股票都可以使用最有效VWAP算法。
Parameter | Description | Values |
---|---|---|
maxPctVol | Maximum percentage of average daily volume | 0.1 (10%) - 0.5 (50%) |
startTime | Algorithm starting time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
endTime | Algorithm ending time | hh:mm:ss TMZ or YYYYMMDD-hh:mm:ss TMZ |
allowPastEndTime | Allow trading past end time | 1 (true) or 0 (false) |
noTakeLiq | Attempt to never take liquidity | 1 (true) or 0 (false) |
speedUp | Compensate for the decreased fill rate due to presence of limit price | 1 (true) or 0 (false) |
monetaryValue Cash | Quantity |
Order baseOrder = OrderSamples.LimitOrder("BUY", 1000, 1);
…
AvailableAlgoParams.FillVwapParams(baseOrder, 0.2, "09:00:00 CET", "16:00:00 CET", true, true, true, 100000); client.placeOrder(nextOrderId++, ContractSamples.USStockAtSmart(), baseOrder);
…
public static void FillVwapParams(Order baseOrder, double maxPctVol, String startTime, String endTime, boolean allowPastEndTime, boolean noTakeLiq, boolean speedUp, double monetaryValue) { baseOrder.algoStrategy("Vwap"); baseOrder.algoParams(new ArrayList<>()); baseOrder.algoParams().add(new TagValue("maxPctVol", String.valueOf(maxPctVol))); baseOrder.algoParams().add(new TagValue("startTime", startTime)); baseOrder.algoParams().add(new TagValue("endTime", endTime)); baseOrder.algoParams().add(new TagValue("allowPastEndTime", allowPastEndTime ? "1" : "0")); baseOrder.algoParams().add(new TagValue("noTakeLiq", noTakeLiq ? "1" : "0")); baseOrder.algoParams().add(new TagValue("speedUp", speedUp ? "1" : "0")); baseOrder.algoParams().add(new TagValue("monetaryValue", String.valueOf(monetaryValue))); }
Balance Impact Risk (平衡影响风险)
The Balance Impact Risk balances the market impact of trading the option with the risk of price change over the time horizon of the order. This strategy considers the user-assigned level of risk aversion to define the pace of the execution, along with the user-defined target percent of volume.
【译】平衡影响风险,用于平衡期权市场因为股票价格变动导致的风险。算法考虑用户指定的风险厌恶级别,以及用户希望执行的成交量百分比。
Parameter | Description | Values |
---|---|---|
maxPctVol | Maximum percentage of average daily volume | 0.1 (10%) - 0.5 (50%) |
riskAversion | Urgency/risk aversion | Get Done, Aggressive, Neutral, Passive |
forceCompletion | Attempt completion by the end of the day | 1 (true) or 0 (false) |
Order baseOrder = OrderSamples.LimitOrder("BUY", 1000, 1);
…
AvailableAlgoParams.FillBalanceImpactRiskParams(baseOrder, 0.1, "Aggressive", true); client.placeOrder(nextOrderId++, ContractSamples.USOptionContract(), baseOrder);
…
public static void FillBalanceImpactRiskParams(Order baseOrder, double maxPctVol, String riskAversion, boolean forceCompletion) { baseOrder.algoStrategy("BalanceImpactRisk"); baseOrder.algoParams(new ArrayList<>()); baseOrder.algoParams().add(new TagValue("maxPctVol", String.valueOf(maxPctVol))); baseOrder.algoParams().add(new TagValue("riskAversion", riskAversion)); baseOrder.algoParams().add(new TagValue("forceCompletion", forceCompletion ? "1" : "0")); }
Minimise Impact (最小影响)
The Minimise Impact algo minimises market impact by slicing the order over time to achieve a market average without going over the given maximum percentage value.
最小影响算法,通过将订单切割成小订单,在市场均价水平成交,而避免市场波动带来的影响。
Parameter | Description | Values |
---|---|---|
maxPctVol | Maximum percentage of average daily volume | 0.1 (10%) - 0.5 (50%) |
Order baseOrder = OrderSamples.LimitOrder("BUY", 1000, 1);
…
AvailableAlgoParams.FillMinImpactParams(baseOrder, 0.3); client.placeOrder(nextOrderId++, ContractSamples.USOptionContract(), baseOrder);
…
public static void FillMinImpactParams(Order baseOrder, double maxPctVol) { baseOrder.algoStrategy("BalanceImpactRisk"); baseOrder.algoParams(new ArrayList<>()); baseOrder.algoParams().add(new TagValue("maxPctVol", String.valueOf(maxPctVol))); }
(P.S. 最近发现IB更新了API文档,新增加了一些章节,准备之后再回头来翻译。这一章内容翻译时间较久,主要是这段时间一直忙加班,所以拖了一些时间。水平有限,翻译的章节内容可能多少存在理解有误,若您发现了,不妨指正。)
共同学习,写下你的评论
评论加载中...
作者其他优质文章