gpt4 book ai didi

c# - OpenOrder 仅针对第一个打开订单的交互式经纪人

转载 作者:太空宇宙 更新时间:2023-11-03 15:17:13 25 4
gpt4 key购买 nike

我正在尝试通过将他们的 API 与 .NET 结合使用来获取我在 Interactive Brokers TWS 上的所有未结订单。

像那样:

IBClient _client = new IBClient();
_client.Connect("127.0.0.1", 7495, 0);

if(_client.Connected)
{
_client.RequestAllOpenOrders();
}

void _client_OpenOrder(object sender, OpenOrderEventArgs e)
{
Console.WriteLine("Action " + e.Order.Action + " of " + e.Contract.Symbol + " in Status: " + e.OrderState.Status + " order id: " + e.OrderId);
}

但是,该事件似乎只发生一次,即第一个未结订单。

RequestAllOpenOrders()的说明:(IB的)

"Call this method to request the open orders that were placed from all clients and also from TWS. Each open order will be fed back through the openOrder() and orderStatus() functions on the EWrapper."

并且事件仅针对一个未结订单发生。

为什么?

我正在使用 Krs.Ats.IBNet.dll,v2.0.50727谢谢

最佳答案

好的。我得到了它...这一切都是因为从事件处理程序中抛出异常而发生的

    void _client_OrderStatus(object sender, OrderStatusEventArgs e)
{
throw new NotImplementedException();
}

但为什么我现在得到所有未结订单的订单 ID 0?

关于c# - OpenOrder 仅针对第一个打开订单的交互式经纪人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38609016/

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