本文整理汇总了Java中com.ib.client.Order.auxPrice方法的典型用法代码示例。如果您正苦于以下问题:Java Order.auxPrice方法的具体用法?Java Order.auxPrice怎么用?Java Order.auxPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ib.client.Order
的用法示例。
在下文中一共展示了Order.auxPrice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onAttachOrder
import com.ib.client.Order; //导入方法依赖的package包/类
protected void onAttachOrder() {
OrderRow row = getSelectedOrder();
if (row != null) {
Order parent = row.m_order;
Order child = new Order();
child.parentId( parent.orderId() );
child.action( parent.action() );
child.totalQuantity( parent.totalQuantity() );
child.orderType( OrderType.TRAIL);
child.auxPrice( 1);
TicketDlg dlg = new TicketDlg( row.m_contract.clone(), child);
dlg.setVisible( true);
}
}
示例2: AttachAdjustableToStop
import com.ib.client.Order; //导入方法依赖的package包/类
public static Order AttachAdjustableToStop(Order parent, double attachedOrderStopPrice, double triggerPrice, double adjustStopPrice) {
//! [adjustable_stop]
Order order = new Order();
//Attached order is a conventional STP order in opposite direction
order.action(parent.action().equals("BUY") ? "SELL" : "BUY");
order.totalQuantity(parent.totalQuantity());
order.auxPrice(attachedOrderStopPrice);
order.parentId(parent.orderId());
//When trigger price is penetrated
order.triggerPrice(triggerPrice);
//The parent order will be turned into a STP order
order.adjustedOrderType(OrderType.STP);
//With the given STP price
order.adjustedStopPrice(adjustStopPrice);
//! [adjustable_stop]
return order;
}
示例3: AttachAdjustableToStopLimit
import com.ib.client.Order; //导入方法依赖的package包/类
public static Order AttachAdjustableToStopLimit(Order parent, double attachedOrderStopPrice, double triggerPrice, double adjustStopPrice, double adjustedStopLimitPrice) {
//! [adjustable_stop_limit]
Order order = new Order();
//Attached order is a conventional STP order
order.action(parent.action().equals("BUY") ? "SELL" : "BUY");
order.totalQuantity(parent.totalQuantity());
order.auxPrice(attachedOrderStopPrice);
order.parentId(parent.orderId());
//When trigger price is penetrated
order.triggerPrice(triggerPrice);
//The parent order will be turned into a STP LMT order
order.adjustedOrderType(OrderType.STP_LMT);
//With the given stop price
order.adjustedStopPrice(adjustStopPrice);
//And the given limit price
order.adjustedStopLimitPrice(adjustedStopLimitPrice);
//! [adjustable_stop_limit]
return order;
}
示例4: AttachAdjustableToTrail
import com.ib.client.Order; //导入方法依赖的package包/类
public static Order AttachAdjustableToTrail(Order parent, double attachedOrderStopPrice, double triggerPrice, double adjustStopPrice, double adjustedTrailAmount, int trailUnit) {
//! [adjustable_trail]
Order order = new Order();
//Attached order is a conventional STP order
order.action(parent.action().equals("BUY") ? "SELL" : "BUY");
order.totalQuantity(parent.totalQuantity());
order.auxPrice(attachedOrderStopPrice);
order.parentId(parent.orderId());
//When trigger price is penetrated
order.triggerPrice(triggerPrice);
//The parent order will be turned into a TRAIL order
order.adjustedOrderType(OrderType.TRAIL);
//With a stop price of...
order.adjustedStopPrice(adjustStopPrice);
//traling by and amount (0) or a percent (1)...
order.adjustableTrailingUnit(trailUnit);
//of...
order.adjustedTrailingAmount(adjustedTrailAmount);
//! [adjustable_trail]
return order;
}
示例5: MarketIfTouched
import com.ib.client.Order; //导入方法依赖的package包/类
public static Order MarketIfTouched(String action, double quantity, double price) {
//! [market_if_touched]
Order order = new Order();
order.action(action);
order.orderType("MIT");
order.totalQuantity(quantity);
order.auxPrice(price);
//! [market_if_touched]
return order;
}
示例6: PeggedToMarket
import com.ib.client.Order; //导入方法依赖的package包/类
public static Order PeggedToMarket(String action, double quantity, double marketOffset) {
//! [pegged_market]
Order order = new Order();
order.action(action);
order.orderType("PEG MKT");
order.totalQuantity(100);
order.auxPrice(marketOffset);//Offset price
//! [pegged_market]
return order;
}
示例7: RelativePeggedToPrimary
import com.ib.client.Order; //导入方法依赖的package包/类
public static Order RelativePeggedToPrimary(String action, double quantity, double priceCap, double offsetAmount) {
//! [relative_pegged_primary]
Order order = new Order();
order.action(action);
order.orderType("REL");
order.totalQuantity(quantity);
order.lmtPrice(priceCap);
order.auxPrice(offsetAmount);
//! [relative_pegged_primary]
return order;
}
示例8: AuctionRelative
import com.ib.client.Order; //导入方法依赖的package包/类
public static Order AuctionRelative(String action, double quantity, double offset) {
//! [auction_relative]
Order order = new Order();
order.action(action);
order.orderType("REL");
order.totalQuantity(quantity);
order.auxPrice(offset);
//! [auction_relative]
return order;
}
示例9: LimitIfTouched
import com.ib.client.Order; //导入方法依赖的package包/类
public static Order LimitIfTouched(String action, double quantity, double limitPrice, double triggerPrice) {
// ! [limitiftouched]
Order order = new Order();
order.action(action);
order.orderType("LIT");
order.totalQuantity(quantity);
order.lmtPrice(limitPrice);
order.auxPrice(triggerPrice);
// ! [limitiftouched]
return order;
}
示例10: PassiveRelative
import com.ib.client.Order; //导入方法依赖的package包/类
public static Order PassiveRelative(String action, double quantity, double offset) {
// ! [passive_relative]
Order order = new Order();
order.action(action);
order.orderType("PASSV REL");
order.totalQuantity(quantity);
order.auxPrice(offset);
// ! [passive_relative]
return order;
}
示例11: PeggedToMidpoint
import com.ib.client.Order; //导入方法依赖的package包/类
public static Order PeggedToMidpoint(String action, double quantity, double offset) {
// ! [pegged_midpoint]
Order order = new Order();
order.action(action);
order.orderType("PEG MID");
order.totalQuantity(quantity);
order.auxPrice(offset);
// ! [pegged_midpoint]
return order;
}
示例12: BracketOrder
import com.ib.client.Order; //导入方法依赖的package包/类
public static List<Order> BracketOrder(int parentOrderId, String action, double quantity, double limitPrice, double takeProfitLimitPrice, double stopLossPrice) {
//This will be our main or "parent" order
Order parent = new Order();
parent.orderId(parentOrderId);
parent.action(action);
parent.orderType("LMT");
parent.totalQuantity(quantity);
parent.lmtPrice(limitPrice);
//The parent and children orders will need this attribute set to false to prevent accidental executions.
//The LAST CHILD will have it set to true.
parent.transmit(false);
Order takeProfit = new Order();
takeProfit.orderId(parent.orderId() + 1);
takeProfit.action(action.equals("BUY") ? "SELL" : "BUY");
takeProfit.orderType("LMT");
takeProfit.totalQuantity(quantity);
takeProfit.lmtPrice(takeProfitLimitPrice);
takeProfit.parentId(parentOrderId);
takeProfit.transmit(false);
Order stopLoss = new Order();
stopLoss.orderId(parent.orderId() + 2);
stopLoss.action(action.equals("BUY") ? "SELL" : "BUY");
stopLoss.orderType("STP");
//Stop trigger price
stopLoss.auxPrice(stopLossPrice);
stopLoss.totalQuantity(quantity);
stopLoss.parentId(parentOrderId);
//In this case, the low side order will be the last child being sent. Therefore, it needs to set this attribute to true
//to activate all its predecessors
stopLoss.transmit(true);
List<Order> bracketOrder = new ArrayList<Order>();
bracketOrder.add(parent);
bracketOrder.add(takeProfit);
bracketOrder.add(stopLoss);
return bracketOrder;
}
示例13: Stop
import com.ib.client.Order; //导入方法依赖的package包/类
public static Order Stop(String action, double quantity, double stopPrice) {
// ! [stop]
Order order = new Order();
order.action(action);
order.orderType("STP");
order.auxPrice(stopPrice);
order.totalQuantity(quantity);
// ! [stop]
return order;
}
示例14: StopLimit
import com.ib.client.Order; //导入方法依赖的package包/类
public static Order StopLimit(String action, double quantity, double limitPrice, double stopPrice) {
// ! [stoplimit]
Order order = new Order();
order.action(action);
order.orderType("STP LMT");
order.lmtPrice(limitPrice);
order.auxPrice(stopPrice);
order.totalQuantity(quantity);
// ! [stoplimit]
return order;
}
示例15: StopWithProtection
import com.ib.client.Order; //导入方法依赖的package包/类
public static Order StopWithProtection(String action, double quantity, double stopPrice) {
// ! [stopwithprotection]
Order order = new Order();
order.action(action);
order.orderType("STP PRT");
order.auxPrice(stopPrice);
order.totalQuantity(quantity);
// ! [stopwithprotection]
return order;
}