使用Java API (我猜这适用于任何其他TWS Interactive Brokers客户端API),我得到一个错误“没有为请求找到安全定义”FAQ和其他资源完全没有帮助。
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);发布于 2013-12-13 04:12:06
这里的关键是contractId字段应该留空。使用contractId提交会导致安全错误。
https://stackoverflow.com/questions/20552095
复制相似问题