• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Order类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.ib.client.Order的典型用法代码示例。如果您正苦于以下问题:Java Order类的具体用法?Java Order怎么用?Java Order使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Order类属于com.ib.client包,在下文中一共展示了Order类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: AdjustedPanel

import com.ib.client.Order; //导入依赖的package包/类
public AdjustedPanel(JDialog parentDlg, Order order) {
	m_parentDlg = parentDlg;
	m_order = order;
	m_adjustedOrderType.setSelectedItem(m_order.adjustedOrderType());

	m_triggerPrice.setText(m_order.triggerPrice());
	m_adjustedStopPrice.setText(m_order.adjustedStopPrice());
	m_adjustedStopLimitPrice.setText(m_order.adjustedStopLimitPrice());
	m_adjustedTrailingAmount.setText(m_order.adjustedTrailingAmount());
	m_adjustedTrailingAmountUnit.setSelectedItem(AmntUnit.fromInt(m_order.adjustableTrailingUnit()));
	
	add("Adjust to order type", m_adjustedOrderType);
	add("Trigger price", m_triggerPrice);
	add("Adjusted stop price", m_adjustedStopPrice);
	add("Adjusted stop limit price", m_adjustedStopLimitPrice);
	add("Adjusted trailing amount", m_adjustedTrailingAmount);
	add("Adjusted trailing amount unit", m_adjustedTrailingAmountUnit);
}
 
开发者ID:qerio,项目名称:goib,代码行数:19,代码来源:AdjustedPanel.java


示例2: PegBenchPanel

import com.ib.client.Order; //导入依赖的package包/类
public PegBenchPanel(JDialog parentDlg, Order order, ContractLookuper lookuper) {
	m_parentDlg = parentDlg;
	m_order = order;
	m_startingPrice.setText(m_order.startingPrice());
	m_startingRefPrice.setText(m_order.stockRefPrice());
	m_pegChangeAmount.setText(m_order.peggedChangeAmount());
	m_refChangeAmount.setText(m_order.referenceChangeAmount());
	m_pegChangeType.setSelectedIndex(m_order.isPeggedChangeAmountDecrease() ? 1 : 0);

	m_refCon = new ContractLookupButton(m_order.referenceContractId(), m_order.referenceExchangeId(), lookuper) {
		@Override
		protected void actionPerformed(int refConId, String refExchId) {
			PegBenchPanel.this.m_order.referenceContractId(refConId);
			PegBenchPanel.this.m_order.referenceExchangeId(refExchId);
		}; 
	};
	
	add("Starting price", m_startingPrice);
	add("Reference contract", m_refCon);
	add("Starting reference price", m_startingRefPrice);
	add("Pegged change amount", m_pegChangeAmount);
	add("Pegged change type", m_pegChangeType);
	add("Reference change amount", m_refChangeAmount);
}
 
开发者ID:qerio,项目名称:goib,代码行数:25,代码来源:PegBenchPanel.java


示例3: 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);
	}
}
 
开发者ID:qerio,项目名称:goib,代码行数:17,代码来源:OrdersPanel.java


示例4: getValueAt

import com.ib.client.Order; //导入依赖的package包/类
@Override public Object getValueAt(int row, int col) {
	OrderRow fullOrder = m_orders.get( row);
	Order order = fullOrder.m_order;
	switch( col) {
		case 0: return order.permId();
		case 1: return order.clientId();
		case 2: return order.orderId();
		case 3: return order.account();
		case 4: return order.modelCode();
		case 5: return order.action();
		case 6: return order.totalQuantity();
		case 7: return fullOrder.m_contract.description();
		case 8: return fullOrder.m_state.status();
		default: return null;
	}
}
 
开发者ID:qerio,项目名称:goib,代码行数:17,代码来源:OrdersPanel.java


示例5: placeOrder

import com.ib.client.Order; //导入依赖的package包/类
void placeOrder(boolean whatIf) {
    // run m_orderDlg
    m_orderDlg.init("Order Misc Options", true, "Order Misc Options",  m_orderDlg.m_order.orderMiscOptions());

    m_orderDlg.show();
    if( !m_orderDlg.m_rc ) {
        return;
    }

    Order order = m_orderDlg.m_order;
    order.orderMiscOptions(m_orderDlg.getOptions());

    // save old and set new value of whatIf attribute
    boolean savedWhatIf = order.whatIf();
    order.whatIf(whatIf);

    // place order
    m_client.placeOrder( m_orderDlg.m_id, m_orderDlg.m_contract, order );

    // restore whatIf attribute
    order.whatIf(savedWhatIf);
}
 
开发者ID:qerio,项目名称:goib,代码行数:23,代码来源:SampleFrame.java


示例6: OcaSample

import com.ib.client.Order; //导入依赖的package包/类
private static void OcaSample(EClientSocket client, int nextOrderId) {
	
	//OCA order
	//! [ocasubmit]
	List<Order> OcaOrders = new ArrayList<Order>();
	OcaOrders.add(OrderSamples.LimitOrder("BUY", 1, 10));
	OcaOrders.add(OrderSamples.LimitOrder("BUY", 1, 11));
	OcaOrders.add(OrderSamples.LimitOrder("BUY", 1, 12));
	OcaOrders = OrderSamples.OneCancelsAll("TestOCA_" + nextOrderId, OcaOrders, 2);
	for (Order o : OcaOrders) {
		
		client.placeOrder(nextOrderId++, ContractSamples.USStock(), o);
	}
	//! [ocasubmit]
	
}
 
开发者ID:qerio,项目名称:goib,代码行数:17,代码来源:Testbed.java


示例7: conditionSamples

import com.ib.client.Order; //导入依赖的package包/类
private static void conditionSamples(EClientSocket client, int nextOrderId) {
	
	//! [order_conditioning_activate]
	Order mkt = OrderSamples.MarketOrder("BUY", 100);
	//Order will become active if conditioning criteria is met
	mkt.conditionsCancelOrder(true);
	mkt.conditions().add(OrderSamples.PriceCondition(208813720, "SMART", 600, false, false));
	mkt.conditions().add(OrderSamples.ExecutionCondition("EUR.USD", "CASH", "IDEALPRO", true));
	mkt.conditions().add(OrderSamples.MarginCondition(30, true, false));
	mkt.conditions().add(OrderSamples.PercentageChangeCondition(15.0, 208813720, "SMART", true, true));
	mkt.conditions().add(OrderSamples.TimeCondition("20160118 23:59:59", true, false));
	mkt.conditions().add(OrderSamples.VolumeCondition(208813720, "SMART", false, 100, true));
	client.placeOrder(nextOrderId++, ContractSamples.EuropeanStock(), mkt);
	//! [order_conditioning_activate]
	
	//Conditions can make the order active or cancel it. Only LMT orders can be conditionally canceled.
	//! [order_conditioning_cancel]
	Order lmt = OrderSamples.LimitOrder("BUY", 100, 20);
	//The active order will be cancelled if conditioning criteria is met
	lmt.conditionsCancelOrder(true);
	lmt.conditions().add(OrderSamples.PriceCondition(208813720, "SMART", 600, false, false));
	client.placeOrder(nextOrderId++, ContractSamples.EuropeanStock(), lmt);
	//! [order_conditioning_cancel]
	
}
 
开发者ID:qerio,项目名称:goib,代码行数:26,代码来源:Testbed.java


示例8: hedgeSample

import com.ib.client.Order; //导入依赖的package包/类
private static void hedgeSample(EClientSocket client, int nextOrderId) throws InterruptedException {
	
	//F Hedge order
	//! [hedgesubmit]
	//Parent order on a contract which currency differs from your base currency
	Order parent = OrderSamples.LimitOrder("BUY", 100, 10);
	parent.orderId(nextOrderId++);
	//Hedge on the currency conversion
	Order hedge = OrderSamples.MarketFHedge(parent.orderId(), "BUY");
	//Place the parent first...
	client.placeOrder(parent.orderId(), ContractSamples.EuropeanStock(), parent);
	//Then the hedge order
	client.placeOrder(nextOrderId++, ContractSamples.EurGbpFx(), hedge);
	//! [hedgesubmit]
	
}
 
开发者ID:qerio,项目名称:goib,代码行数:17,代码来源:Testbed.java


示例9: FillAccumulateDistributeParams

import com.ib.client.Order; //导入依赖的package包/类
public static void FillAccumulateDistributeParams(Order baseOrder, int componentSize, int timeBetweenOrders, boolean randomizeTime20, boolean randomizeSize55,
           int giveUp, boolean catchUp, boolean waitOrFill, String startTime, String endTime) {
	
	baseOrder.algoStrategy("AD");
	baseOrder.algoParams(new ArrayList<TagValue>());
	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("waitOrFill", waitOrFill ? "1" : "0"));
	baseOrder.algoParams().add(new TagValue("startTime", startTime));
	baseOrder.algoParams().add(new TagValue("endTime", endTime));
	
}
 
开发者ID:qerio,项目名称:goib,代码行数:17,代码来源:AvailableAlgoParams.java


示例10: LimitOrderForComboWithLegPrices

import com.ib.client.Order; //导入依赖的package包/类
public static Order LimitOrderForComboWithLegPrices(String action, double quantity, boolean nonGuaranteed, double[] legPrices) {
	// ! [limitordercombolegprices]
	Order order = new Order();
	order.action(action);
	order.orderType("LMT");
	order.totalQuantity(quantity);
	order.orderComboLegs(new ArrayList<OrderComboLeg>());
	
	for(double price : legPrices) {
		OrderComboLeg comboLeg = new OrderComboLeg();
		comboLeg.price(5.0);
		order.orderComboLegs().add(comboLeg);
	}
	
	if (nonGuaranteed)
	{
		List<TagValue> smartComboRoutingParams = new ArrayList<TagValue>();
		smartComboRoutingParams.add(new TagValue("NonGuaranteed", "1"));
	}
	// ! [limitordercombolegprices]
	return order;
}
 
开发者ID:qerio,项目名称:goib,代码行数:23,代码来源:OrderSamples.java


示例11: 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;
}
 
开发者ID:qerio,项目名称:goib,代码行数:18,代码来源:OrderSamples.java


示例12: 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;
}
 
开发者ID:qerio,项目名称:goib,代码行数:20,代码来源:OrderSamples.java


示例13: 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;
}
 
开发者ID:qerio,项目名称:goib,代码行数:22,代码来源:OrderSamples.java


示例14: isUnknownOrder

import com.ib.client.Order; //导入依赖的package包/类
private boolean isUnknownOrder(OrderRecord orderRecord) {
    if (orderRecord == null
            || !orderRecord.isSubmitted()
            || orderRecord.isWorking()) {
        return false;
    }

    int orderId = orderRecord.getOrderId();

    for (Order order : openOrders) {
        if (orderId == order.m_orderId) {
            return false;
        }
    }

    log(Level.WARNING, "Unknown order is found: #{0}", orderId);
    return true;
}
 
开发者ID:AnyObject,项目名称:OAT,代码行数:19,代码来源:IbTradingClient.java


示例15: main

import com.ib.client.Order; //导入依赖的package包/类
public static void main(String[] args) {

        // create connection object for to communicate with TWS
        EClientSocket eClientSocket = new EClientSocket(new TWSClientInterface());

        // try to connect to TWS
        eClientSocket.eConnect("127.0.0.1", 7496, 0);

        // initialize a contract for symbols to BUY
        Contract SPY = ContractFactory.GenericStockContract("SPY");

        // create an order to specify account info, order type, price, etc
        Order order = OrderFactory.GenericLimitOrder("DU207406", "BUY", 100, 198.5);

        // place the order
        eClientSocket.placeOrder(8840,SPY,order);
    }
 
开发者ID:softwarespartan,项目名称:TWS,代码行数:18,代码来源:OrderPlacement.java


示例16: GenericMarketOrder

import com.ib.client.Order; //导入依赖的package包/类
public static Order GenericMarketOrder(String account, String action, int quantity){

        // init new order
        Order order = new Order();

        // set the order type to limit
        order.m_orderType = "MKT";

        // set the account id
        order.m_account = account;

        // set the order type
        switch (action.toUpperCase()){
            case "BUY" : order.m_action = "BUY" ; break;
            case "SELL": order.m_action = "SELL"; break;
            default:
                System.out.println("invalid order action: "+action);
                order.m_action = "";
        }

        // set the number of shares
        order.m_totalQuantity = quantity;

        // that's it ..
        return order;
    }
 
开发者ID:softwarespartan,项目名称:TWS,代码行数:27,代码来源:OrderFactory.java


示例17: openOrder

import com.ib.client.Order; //导入依赖的package包/类
@Override public void openOrder(int orderId, Contract contract, Order orderIn, OrderState orderState) {
	NewOrder order = new NewOrder( orderIn);

	IOrderHandler handler = m_orderHandlers.get( orderId);
	if (handler != null) {
		handler.orderState( new NewOrderState( orderState) );
	}

	if (!order.whatIf() ) {
		for (ILiveOrderHandler liveHandler : m_liveOrderHandlers) {
			liveHandler.openOrder( new NewContract( contract), order, new NewOrderState( orderState) );
		}
	}
	recEOM();
}
 
开发者ID:rterp,项目名称:SumZeroTrading,代码行数:16,代码来源:ApiController.java


示例18: placeOrModifyOrder

import com.ib.client.Order; //导入依赖的package包/类
public void placeOrModifyOrder(Contract contract, final Order order, final IOrderHandler handler) {
	if (!checkConnection())
		return;

	// when placing new order, assign new order id
	if (order.orderId() == 0) {
		order.orderId( m_orderId++);
		if (handler != null) {
			m_orderHandlers.put( order.orderId(), handler);
		}
	}

	m_client.placeOrder( contract, order);
	sendEOM();
}
 
开发者ID:qerio,项目名称:goib,代码行数:16,代码来源:ApiController.java


示例19: openOrder

import com.ib.client.Order; //导入依赖的package包/类
@Override public void openOrder(int orderId, Contract contract, Order order, OrderState orderState) {
	IOrderHandler handler = m_orderHandlers.get( orderId);
	if (handler != null) {
		handler.orderState(orderState);
	}

	if (!order.whatIf() ) {
		for (ILiveOrderHandler liveHandler : m_liveOrderHandlers) {
			liveHandler.openOrder( contract, order, orderState );
		}
	}
	recEOM();
}
 
开发者ID:qerio,项目名称:goib,代码行数:14,代码来源:ApiController.java


示例20: placeOrder

import com.ib.client.Order; //导入依赖的package包/类
public synchronized void placeOrder(Contract contract, Order order) {
	// not connected?
	if( !isConnected() ) {
           notConnected();
		return;
	}

	// ApiController requires TWS 932 or higher; this limitation could be removed if needed
	if (serverVersion() < 66) {
           error( EClientErrors.NO_VALID_ID, EClientErrors.UPDATE_TWS, "ApiController requires TWS build 932 or higher to place orders.");
           return;
	}

    placeOrder(order.orderId(), contract, order);
}
 
开发者ID:qerio,项目名称:goib,代码行数:16,代码来源:ApiConnection.java



注:本文中的com.ib.client.Order类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LogUtils类代码示例发布时间:2022-05-22
下一篇:
Java EmptyRequestProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap