gpt4 book ai didi

java - TWS Interactive Brokers API - 如何修复 "No security definition has been found for the request"?

转载 作者:搜寻专家 更新时间:2023-10-31 20:02:54 24 4
gpt4 key购买 nike

使用 Java API(我想这适用于任何其他 TWS Interactive Brokers 客户端 API)我收到错误消息“没有找到请求的安全定义”常见问题解答和其他资源毫无帮助。

    Contract contract = new Contract();

int id = incId;

System.out.println("Oder Id " + id );

// use UTC seconds as transaction id

// This is the problem you need to have a blank contractId
contract.m_conId = 12345;
contract.m_symbol = signal.symbol;
contract.m_secType = "STK";
contract.m_expiry = "";
contract.m_strike = 0;
contract.m_exchange = "SMART";
contract.m_primaryExch = "ISLAND";
contract.m_currency = "USD";

//etc

Order order = new Order();

// set order fields
order.m_account = "XXXXXX";
order.m_orderId = id;
//etc

GetInstance().wrapper.m_client.placeOrder(id, contract, order);

最佳答案

这里的关键是contractId字段应该留空。使用 contractId 提交会导致安全错误。

关于java - TWS Interactive Brokers API - 如何修复 "No security definition has been found for the request"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20552095/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com