开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: Help for an old coder. API 10.17 Bar class.


 

Hello,
?
Well, here is the problem number 2.
Data coming from the API to VB as a variant works but from VB to the API I got this problem
?
The IOrder class that I create using the call CreateOrder has a property totalQuantity.
?
The API wants to receive a decimal or an object.
?
I try to create the variable as variant, as object cannot figure how to make it work.
?
? ? ? ? Dim O As TWSLib.IOrder
? ? ? ? Set O = ORDERFORM.Tws1.CreateOrder
? ? ? ??
? ? ? ? O.orderType = orderType 'LMT,MKT
? ? ? ? O.lmtPrice = price
? ? ? ? O.auxPrice = 0
? ? ? ? If orderType = "STP" Then
? ? ? ? ? ? O.auxPrice = Price2
? ? ? ? ? ? O.outsideRth = True
? ? ? ? End If
? ? ? ? O.action = action
? ? ? ? O.totalQuantity = quantity? (here is the crash)
?
totalQuantity wants a decimal, actually the error message says?
?
Run-time Error '424'
Object required
?
The API activeX code shows the toralQuantity as decimal
?
Any idea how to go around this problem?
?
Thank you for the help.
?

Join [email protected] to automatically receive all group messages.