Keyboard Shortcuts
Likes
- Twsapi
- Messages
Search
Re: Cannot transmit order (main order and stop loss orders)
On Tue, Jan 10, 2023 at 06:17 PM, GreenGreen wrote:
Do you think that could be because it saw a transmit on an individual order that wasn't part of a parent order? |
Re: Cannot transmit order (main order and stop loss orders)
Thank you, I saw it. I can make it look the way they showed, but I do not think it matters. They simply have two functions. One creates three orders and puts them into list. The other routine simply loops through the list and places orders.?
|
Re: Cannot transmit order (main order and stop loss orders)
On Tue, Jan 10, 2023 at 05:37 PM, GreenGreen wrote:
Ok, so I'm a polyglot :-P If you go to the docs and click the Python button at the top it will translate for you...
Let us know if this helps :-) |
Re: Cannot transmit order (main order and stop loss orders)
No errors. Here is console output:
NextValidId: 39
Error:? -1? ?2104? ?Market data farm connection is OK:usfuture.nj??
Error:? -1? ?2104? ?Market data farm connection is OK:usfarm.nj??
Error:? -1? ?2104? ?Market data farm connection is OK:usfarm??
Error:? -1? ?2106? ?HMDS data farm connection is OK:euhmds??
Error:? -1? ?2106? ?HMDS data farm connection is OK:ushmds.nj??
Error:? -1? ?2106? ?HMDS data farm connection is OK:cashhmds??
Error:? -1? ?2106? ?HMDS data farm connection is OK:fundfarm??
Error:? -1? ?2106? ?HMDS data farm connection is OK:ushmds??
Error:? -1? ?2158? ?Sec-def data farm connection is OK:secdefil I do not know what precautions I can check. Everything worked find a day ago. |
Re: Cannot transmit order (main order and stop loss orders)
IDK... no errors? You check precautions?
|
Cannot transmit order (main order and stop loss orders)
I am trying to submit two orders, one main order (parent order) and the other is stop loss order. I am following TWS API documentation?
But for some reason my main order does not show in TWS as submitted. It only show us with "Transmit" option. I am expecting both order to be transmitted without any problems. Here is my Python code: from ibapi.client import EClient
from ibapi.wrapper import EWrapper
from ibapi.contract import Contract
from ibapi.ticktype import TickTypeEnum
import time
import datetime
import threading
from ibapi.contract import Contract
from ibapi.order import Order
?
class TestApp(EWrapper, EClient):
? ? def __init__(self):
? ? ? ? EClient.__init__(self, self)
? ? ? ? self.nextValidOrderId = None
? ? ? ??
? ? # this is getting called upon establishing connection? ??
? ? def nextValidId(self, orderId: int):
? ? ? ? super().nextValidId(orderId)
? ? ? ? self.nextValidOrderId = orderId
? ? ? ? print("NextValidId:", orderId)
? ? ? ??
? ? def error(self, reqId, errorCode, errorString, advancedOrderRejectJson):
? ? ? ? print("Error: ", reqId, " ", errorCode, " ", errorString, "", advancedOrderRejectJson)
contract = Contract()
contract.symbol = "SPY"
contract.secType = "STK"
contract.exchange = "SMART"
contract.currency = "USD"
contract.primaryExchange = "ARCA"
?
order = Order()
order.OrderType = "LMT";
order.action = 'BUY'
order.totalQuantity = 3
order.orderType = 'LMT'
order.lmtPrice = '21'
order.transmit = False
?
stopLossOrder = Order()
stopLossOrder.OrderType = 'STP'
stopLossOrder.action = 'SELL'
stopLossOrder.totalQuantity = 3
stopLossOrder.auxPrice = 18
stopLossOrder.transmit = True
app = TestApp()
app.connect("127.0.0.1", 7497, 1)
?
api_thread = threading.Thread(target=app.run)
api_thread.start()
time.sleep(2)
?
order.orderId = app.nextValidOrderId
stopLossOrder.orderId = app.nextValidOrderId + 1
stopLossOrder.parentId = app.nextValidOrderId
?
app.placeOrder(app.nextValidOrderId, contract, order)
app.placeOrder(app.nextValidOrderId+1, contract, stopLossOrder)
?
?
app.disconnect()
What am I doing wrong? ?
? |
Re: How is auction price calculated?
¿ªÔÆÌåÓýNot sure as I don¡¯t typically trade US stocks but I¡¯d be interested to hear the answer if someone else knows.On 10 Jan 2023, at 6:00 am, JZcgQR2N <wingnut293@...> wrote:
|
Re: TWS API Linux - Segmentation fault - __bid64_to_string
I won't directly blame the machine, look very similar to same issue on Mac and Windows if using the wrong Decimal lib. |
Re: TWS API Linux - Segmentation fault - __bid64_to_string
On Mon, Jan 9, 2023 at 04:40 AM, bannerman1985@... wrote:
Ok, I just managed to recreate this problem and (I think this may have been mentioned) but it seems to be a platform issue. The library provided by IB is built for x86_64, not i686. You can determine what your system is based on by running I'm not sure why anyone would need to run their trading software on an i686 in this day and age. But, I'll freely admit I have a very old thinkpad I still like to use sometimes (just not for trading). Anyway, that's my story and I'm sticking to it until conflicting information comes to light. |
Re: TWS API Linux - Segmentation fault - __bid64_to_string
On Mon, Jan 9, 2023 at 05:14 AM, bannerman1985@... wrote:
Hopefully it doesn't hurt them either though... because I just built the Cpp sample from api ver. 1019.01 and 1020.01 on...
All of the builds succeeded and I didn't see the "dangerous relocation". But I remember a while back someone else had that problem too. So, I can't help but wonder if somehow your environment and theirs share some kind of aberration. Was this on a fresh install? |
Re: TWS API Linux - Segmentation fault - __bid64_to_string
Ok finally got it working by locating where the intel floating point math library was located, named:?libintelrdfpmath-dev :?
?root@Ubuntu-22:/bin# dpkg -L libintelrdfpmath-dev /. /usr /usr/include /usr/include/bid_conf.h /usr/include/bid_functions.h /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/share /usr/share/doc /usr/share/doc/ /usr/share/doc/ /usr/share/doc/ /usr/share/doc/ I edited the makefile to include the path to these libraries, now which one??? I added?/usr/lib/x86_64-linux-gnu/ My make file looks like:? CXX=g++ CXXFLAGS=-pthread -Wall -Wno-switch -Wpedantic -Wno-unused-function -std=c++11 ROOT_DIR=../../../source/ BASE_SRC_DIR=${ROOT_DIR}/ INCLUDES=-I${BASE_SRC_DIR} -I${ROOT_DIR} SHARED_LIB_DIRS=${BASE_SRC_ SHARD_LIBS=libTwsSocketClient. TARGET=TestCppClient $(TARGET)Static: $(CXX) $(CXXFLAGS) $(INCLUDES) $(BASE_SRC_DIR)/*.cpp ./*.cpp /usr/lib/x86_64-linux-gnu/ $(TARGET): $(CXX) $(CXXFLAGS) $(INCLUDES) ./*.cpp $(BASE_SRC_DIR)/lib/libbid.so $(SHARED_LIB_DIRS)/$(SHARD_ clean: rm -f $(TARGET) $(TARGET)Static *.o requested real time bars, decimal places looks as intended RealTimeBars. 3001 - Time: 1673241105, Open: 0.87948, High: 0.87951, Low: 0.87947, Close: 0.87951, Volume: -1, Count: -1, WAP: -1 hopefully this solves others issues with this.? Thanks for those who took the time to look at this and give responses.? |
Re: TWS API Linux - Segmentation fault - __bid64_to_string
well virtulbox and ubuntu?
lare9x@Ubuntu-22:~/IBJts/ g++ -pthread -Wall -Wno-switch -Wpedantic -Wno-unused-function -std=c++11 -I../../../source/cppclient/ /usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail ../../bfd/reloc.c:8580 ../../../source/cppclient/ compilation terminated. make: *** [makefile:11: TestCppClientStatic] Error 1 Well something going on with?libbid.a |
Re: TWS API Linux - Segmentation fault - __bid64_to_string
I strongly recommend to use a containerized setup for tws/ib-gateway in wsl.
If you chose ubuntu as host for wsl, then lxd (sudo snap install lxd) should do it. There is an automated setup for a trading-environment in a lxd-container:? If needed, you can just copy the instance to a cloud-instance or a ?real? ubuntu-machine. hartmut |
Re: TWS API Linux - Segmentation fault - __bid64_to_string
Only reason really have windows installed on this machine is the wife and kids use it - however - running a few strategies on python / c++ - cpu usuage was about 8%. So using linux here on VM maybe wont slow too much BUT there is a whole GUI with ubuntu to the point i dont think my wife and kids would get lost for general browing of the internet. Dual boot maybe - lets see if i can get this whole thing up and running on linux.?
|