Requesting transactions with IB using reqExecutions

I am trying to request transactions with IB using the reqExecutions function:

library(IBrokers) con <- twsConnect(clientId=1) id <- reqIds(con) Order <- twsOrder(orderId=id, action="BUY", totalQuantity = 1, orderType="LMT", lmtPrice = 600, tif="GTC") placeOrder(con, twsSTK("AAPL", Order) print(reqExecutions(con, reqId = as.character(.Last.orderId), ExecutionFilter = twsExecutionFilter(clientId="1"))) 

although transactions are executed in IB, it always returns NULL.

+4
source share
1 answer

Can't you use reqOpenOrders?

Warning: The following will execute the transaction. Before running this code, make sure you are connected to paper trading !

 library(IBrokers) #con <- twsConnect(clientId=1) con <- ibgConnect(clientId=1) id <- reqIds(con) Order <- twsOrder(orderId=id, action="BUY", totalQuantity = 1, orderType="LMT", lmtPrice = 600, tif="GTC") placeOrder(con, twsSTK("AAPL"), Order) > reqOpenOrders(twsconn=con) TWS Message: 2 -1 2100 New account data requested. API client has been unsubscribed from account data. TWS Execution: orderId=1 time=2012-03-26 08:47:29 side=BOT shares=1 symbol=AAPL conId=265598 price=597.91 
+4
source

Source: https://habr.com/ru/post/1403406/


All Articles