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

Java Execution类代码示例

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

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



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

示例1: logExecution

import com.ib.client.Execution; //导入依赖的package包/类
private void logExecution(String string, Execution execution) {
    if (string == null || execution == null) {
        return;
    }

    log(Level.INFO,
            "{0} #{8} {3} QTY={4} @ {5} CUMQTY={6} CURPOS={1} {7} at {2}",
            new Object[]{
                string,
                currentPosition,
                execution.m_time == null ? "" : execution.m_time.substring(10, execution.m_time.length()),
                execution.m_side,
                execution.m_shares,
                execution.m_price,
                execution.m_cumQty,
                execution.m_acctNumber,
                execution.m_orderId});
}
 
开发者ID:AnyObject,项目名称:OAT,代码行数:19,代码来源:TradingThread.java


示例2: insertExecution

import com.ib.client.Execution; //导入依赖的package包/类
public void insertExecution(Contract contract, Execution execution) throws SQLException, ClassNotFoundException {
    executeUpdate(
            "REPLACE INTO `executions`"
            + " (m_execId, m_permId, m_conId, m_orderId, m_clientId,  m_time,"
            + " m_acctNumber, m_exchange, m_side, m_shares, m_price,"
            + " m_liquidation, m_cumQty, m_avgPrice, exe_time_long)"
            + " VALUES("
            + SqlUtil.formatValues(
            execution.m_execId,
            execution.m_permId,
            contract.m_conId,
            execution.m_orderId,
            execution.m_clientId,
            execution.m_time,
            execution.m_acctNumber,
            execution.m_exchange,
            execution.m_side,
            execution.m_shares,
            execution.m_price,
            execution.m_liquidation,
            execution.m_cumQty,
            execution.m_avgPrice,
            DateUtil.getTime(execution.m_time))
            + " );");
}
 
开发者ID:AnyObject,项目名称:OAT,代码行数:26,代码来源:TradingSchema.java


示例3: execDetails

import com.ib.client.Execution; //导入依赖的package包/类
@Override
public void execDetails(int reqId, Contract contract, Execution execution) {
	try {
		if (logger.isDebugEnabled())
			logger.debug("execDetails: {} {} {}", new Object[] { reqId, Util.toString(contract), Util.toString(execution) });

		OpenOrder openOrder = openOrdersById.get(execution.m_orderId);
		DateTime dt = DateTimeFormat.forPattern("yyyyMMdd  HH:mm:ss").parseDateTime(execution.m_time);
		if (openOrder != null) {
			int quantityChange = openOrder.isBuy() ? execution.m_shares : -execution.m_shares;
			openOrder.update(quantityChange, execution.m_price, dt);
			logExecution(openOrder, quantityChange);
		} else {
			logger.info("Execution does not match any open order {} {}", Util.toString(contract), Util.toString(execution));
		}
	} catch (Throwable t) {
		// Do not allow exceptions come back to the socket -- it will cause
		// disconnects
		logger.error(t.getMessage(), t);
	}
}
 
开发者ID:klon,项目名称:jtrade,代码行数:22,代码来源:IBTrader.java


示例4: execDetails

import com.ib.client.Execution; //导入依赖的package包/类
@Override public void execDetails(int reqId, Contract contract, Execution execution) {
	if (m_tradeReportHandler != null) {
		int i = execution.m_execId.lastIndexOf( '.');
		String tradeKey = execution.m_execId.substring( 0, i);
		m_tradeReportHandler.tradeReport( tradeKey, new NewContract( contract), execution);
	}
	recEOM();
}
 
开发者ID:rterp,项目名称:SumZeroTrading,代码行数:9,代码来源:ApiController.java


示例5: execDetails

import com.ib.client.Execution; //导入依赖的package包/类
@Override public void execDetails(int reqId, Contract contract, Execution execution) {
	if (m_tradeReportHandler != null) {
		int i = execution.execId().lastIndexOf( '.');
		String tradeKey = execution.execId().substring( 0, i);
		m_tradeReportHandler.tradeReport( tradeKey, contract, execution);
	}
	recEOM();
}
 
开发者ID:qerio,项目名称:goib,代码行数:9,代码来源:ApiController.java


示例6: tradeReport

import com.ib.client.Execution; //导入依赖的package包/类
@Override public void tradeReport(String tradeKey, Contract contract, Execution trade) {
	FullExec full = m_map.get( tradeKey);
	
	if (full != null) {
		full.m_trade = trade;
	}
	else {
		full = new FullExec( contract, trade);
		m_trades.add( full);
		m_map.put( tradeKey, full);
	}
	
	m_model.fireTableDataChanged();
}
 
开发者ID:qerio,项目名称:goib,代码行数:15,代码来源:TradesPanel.java


示例7: execDetails

import com.ib.client.Execution; //导入依赖的package包/类
@Override
    public void execDetails(final int reqId, final Contract contract, final Execution execution) {
//        new Thread(new Runnable() {
//
//            @Override
//            public void run() {
                try {
                    TradingThread tradingThread = Main.getStrategy(contract);

                    if (tradingThread != null) {
//                        && contract.m_symbol.equals(tradingThread.getTradingSymbol())
//                        && contract.m_secType.equals(tradingThread.getSecurityType())) {

                        OrderRecord orderRecord;

                        if (tradingThread.addExecution(execution)) {
                            orderRecord = orderRecordMap.get(execution.m_orderId);

                            if (orderRecord != null) {
                                orderRecord.setBar(tradingThread.getPrimaryChart().getLast(), false);
                                orderRecord.setExecution(execution);
                            }
                        }

                        Main.tradingSchema.insertExecution(contract, execution);

                        tradingThread.insertWebExecution(execution);
                    }
                } catch (Exception e) {
                    log(Level.SEVERE, null, e);
                }
//            }
//        }).start();

        super.execDetails(reqId, contract, execution);
    }
 
开发者ID:AnyObject,项目名称:OAT,代码行数:37,代码来源:IbTradingClient.java


示例8: executeOrder

import com.ib.client.Execution; //导入依赖的package包/类
private void executeOrder(OrderRecord orderRecord) {
    if (!orderRecord.isSubmitted()) {
        return;
    }

    Side side = orderRecord.getSide();
    String orderType = orderRecord.getOrder().m_orderType;
    long lastTickTime = getLastTickTime();
    double lastPrice = getLastTickPrice();

    if (orderType.contains("STP")
            && side.sign * lastPrice < side.sign * orderRecord.getOrder().m_auxPrice) {
        return;
    }

    if (orderType.contains("LMT")
            && side.sign * lastPrice > side.sign * orderRecord.getOrder().m_lmtPrice) {
        return;
    }

    orderRecord.setCommission(commission);

    Execution execution = new Execution(
            orderRecord.getOrderId(),
            getThreadId(),
            "" + orderRecord.getOrderId(),
            "" + lastTickTime,
            "",
            contract.m_exchange,
            side.executionSimpleName,
            p_Default_Qty, lastPrice, 0, 0, p_Default_Qty, lastPrice);

    if (addExecution(execution)) {
        orderRecord.setBar(primaryChart.getLast(), false);
        orderRecord.setExecution(execution);
    }
}
 
开发者ID:AnyObject,项目名称:OAT,代码行数:38,代码来源:BacktestStrategy.java


示例9: reloadExecutions

import com.ib.client.Execution; //导入依赖的package包/类
private void reloadExecutions() throws Exception {
    long reloadSince = tradingHours.getLastOpen().getTimeInMillis();

    executions = Main.tradingSchema.getExecutions(
            getThreadId(),
            reloadedConId,
            reloadSince);

    for (Execution execution : executions) {
        insertWebExecution(execution);
    }

    log(Level.INFO, "Reloaded executions: {0}", executions.size());
}
 
开发者ID:AnyObject,项目名称:OAT,代码行数:15,代码来源:TradingThread.java


示例10: reloadOrders

import com.ib.client.Execution; //导入依赖的package包/类
private void reloadOrders() throws Exception {
    long reloadSince = tradingHours.getLastOpen().getTimeInMillis();

    if (currentPosition != 0) {
        OrderRecord enterOrderRecord = createNewEnterOrderRecord();
        OrderRecord exitOrderRecord = getLastExitOrderRecord();

        Main.tradingSchema.getLastFilledOrder(
                getThreadId(),
                reloadedConId,
                reloadSince,
                enterOrderRecord);

        Main.tradingSchema.getSubmittedOrder(
                getThreadId(),
                reloadedConId,
                reloadSince,
                exitOrderRecord);

        for (Execution execution : executions) {
            OrderRecord orderRecord = getOrderRecord(execution.m_orderId);

            if (orderRecord != null) {
                orderRecord.setExecution(execution, false);
            }
        }
    }
}
 
开发者ID:AnyObject,项目名称:OAT,代码行数:29,代码来源:TradingThread.java


示例11: getLastExecution

import com.ib.client.Execution; //导入依赖的package包/类
/**
 *
 * @return
 */
public Execution getLastExecution() {
    if (executions.isEmpty()) {
        return null;
    }

    return executions.get(executions.size() - 1);
}
 
开发者ID:AnyObject,项目名称:OAT,代码行数:12,代码来源:TradingThread.java


示例12: isValidExecution

import com.ib.client.Execution; //导入依赖的package包/类
protected boolean isValidExecution(Execution execution) {
    if (isBacktesting() || !Main.isAdvisorAccount()) {
        return true;
    }

    if ((execution.m_shares > 0 && execution.m_acctNumber.contains("F"))
            || execution.m_clientId == 0) {
        return true;
    }

    return false;
}
 
开发者ID:AnyObject,项目名称:OAT,代码行数:13,代码来源:TradingThread.java


示例13: getLastExitOrderRecord

import com.ib.client.Execution; //导入依赖的package包/类
protected OrderRecord getLastExitOrderRecord() {//boolean needsPattern) {//, boolean notify) {
        Trade lastTrade = getLastTrade();

        if (lastTrade == null) {
            lastTrade = createNewTrade();
        }

        OrderRecord exitOrder = lastTrade.getExitOrderRecord();

        if (exitOrder == null
                || (!exitOrder.isSubmitted() && !exitOrder.isWorking())) {
            exitOrder = createNewOrderRecord();
            lastTrade.addExitOrderRecord(exitOrder, false);
        }

        if (lastTrade.getEnterOrderRecord() == null) {
            lastTrade.addEnterOrderRecord(new OrderRecord(), false);
            Execution execution = new Execution();
            execution.m_side = getCurrentSide().toString();
            lastTrade.getEnterOrderRecord().setExecution(execution, false);
        }

//        if (notify) {
//            exitOrder.fireChanged();
//        }

        return exitOrder;
    }
 
开发者ID:AnyObject,项目名称:OAT,代码行数:29,代码来源:TradingThread.java


示例14: insertWebExecution

import com.ib.client.Execution; //导入依赖的package包/类
public void insertWebExecution(Execution execution) {
    if (execution.m_shares < 0) {
        return;
    }

    if (DateUtil.getTime(execution.m_time)
            >= DateUtil.getMidnightTime(tradingHours.getTimeZone())) {
        try {
            Main.webSchema.insertWebExecution(contractId, execution);
        } catch (Exception ex) {
            log(Level.SEVERE, null, ex);
        }
    }
}
 
开发者ID:AnyObject,项目名称:OAT,代码行数:15,代码来源:TradingThread.java


示例15: getExecutions

import com.ib.client.Execution; //导入依赖的package包/类
public List<Execution> getExecutions(int clientId, int conId, long since) throws SQLException, ParseException, ClassNotFoundException {
        List<Execution> executions = new ArrayList<Execution>();

        ResultSet resultSet = callProcedure("getExecutions",
                conId, since, "");

        while (resultSet.next()) {
            Execution execution = new Execution();

            execution.m_execId = resultSet.getString("m_execId");
            execution.m_permId = resultSet.getInt("m_permId");
            execution.m_clientId = resultSet.getInt("m_clientId");
            execution.m_orderId = resultSet.getInt("m_orderId");
            execution.m_time = DateUtil.getTimeStamp(
                    resultSet.getLong("exe_time_long"), "yyyyMMdd  HH:mm:ss");
//            execution.m_time = DateUtil.convertDateString(
//                    resultSet.getString("m_time"),
//                    "yyyy-MM-dd HH:mm:ss",
//                    "yyyyMMdd  HH:mm:ss");
            execution.m_acctNumber = resultSet.getString("m_acctNumber");
            execution.m_exchange = resultSet.getString("m_exchange");
            execution.m_side = resultSet.getString("m_side");
            execution.m_shares = resultSet.getInt("m_shares");
            execution.m_price = resultSet.getDouble("m_price");
            execution.m_liquidation = resultSet.getInt("m_liquidation");
            execution.m_cumQty = resultSet.getInt("m_cumQty");
            execution.m_avgPrice = resultSet.getDouble("m_avgPrice");

            executions.add(execution);
        }

        return executions;
    }
 
开发者ID:AnyObject,项目名称:OAT,代码行数:34,代码来源:TradingSchema.java


示例16: insertWebExecution

import com.ib.client.Execution; //导入依赖的package包/类
public void insertWebExecution(int id, Execution execution) throws SQLException, ClassNotFoundException {
    insertWebExecution(id,
            execution.m_side,
            execution.m_shares,
            execution.m_price,
            execution.m_time,
            //                orderRecord == null ? 0 : orderRecord.getCommission(),
            execution.m_execId.contains("U+") || execution.m_execId.contains("F-")
            ? execution.m_execId.substring(0, execution.m_execId.length() - 3)
            : execution.m_execId,
            execution.m_orderId,
            execution.m_acctNumber);
}
 
开发者ID:AnyObject,项目名称:OAT,代码行数:14,代码来源:WebSchema.java


示例17: tradeReport

import com.ib.client.Execution; //导入依赖的package包/类
@Override public void tradeReport(String tradeKey, NewContract contract, Execution trade) {
	FullExec full = m_map.get( tradeKey);
	
	if (full != null) {
		full.m_trade = trade;
	}
	else {
		full = new FullExec( contract, trade);
		m_trades.add( full);
		m_map.put( tradeKey, full);
	}
	
	m_model.fireTableDataChanged();
}
 
开发者ID:softwarespartan,项目名称:TWS,代码行数:15,代码来源:TradesPanel.java


示例18: execDetails

import com.ib.client.Execution; //导入依赖的package包/类
@Override
public void execDetails(int reqId, Contract contract, Execution execution) {
    //not implemented
}
 
开发者ID:rterp,项目名称:SumZeroTrading,代码行数:5,代码来源:BaseIBConnectionDelegate.java


示例19: execDetails

import com.ib.client.Execution; //导入依赖的package包/类
@Override
public void execDetails(int reqId, Contract contract, Execution execution) {
    ibConnectionDelegates.stream().forEach((delegate) -> {
        delegate.execDetails(reqId, contract, execution);
    });
}
 
开发者ID:rterp,项目名称:SumZeroTrading,代码行数:7,代码来源:IBConnection.java


示例20: execDetails

import com.ib.client.Execution; //导入依赖的package包/类
@Override
public void execDetails(int orderId, Contract contract, Execution execution) {
    logger.debug("Execution details: orderId: " + orderId + " contract: " + contract + " Execution: " + execution);
}
 
开发者ID:rterp,项目名称:SumZeroTrading,代码行数:5,代码来源:InteractiveBrokersBroker.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java WebHistory类代码示例发布时间:2022-05-22
下一篇:
Java FsPermissionProto类代码示例发布时间: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