开云体育

ctrl + shift + ? for shortcuts
© 2025 Groups.io
Date

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

 

Carlos, place this function Richard sent to you:

Public Function CreateDecimalObject(value As Variant) As Object

??? Dim collection As New collection

??? collection.Add CDec(value)

??? Set CreateDecimalObject = collection

End Function


Directly in your VB code and call it from the same VB, don't create an ActiveX object nor class or new module, just try the function on your code.
Maybe this way will work or maybe not.


El jue, 18 ago 2022 a las 22:27, carlos via (<ctalmeida=aol.com@groups.io>) escribió:
Hi Richard,

If I understood I will need to edit the IB ativex API to include that function and then recompile it?

Is that what you mean?

I created and activeX using 2010 version put this code in

Public Function CreateDecimalObject(value As Variant) As Object

??? Dim collection As New collection

??? collection.Add CDec(value)

??? Set CreateDecimalObject = collection

End Function

It did not work. I tried?to change the function to decimal with no collection, did other combinations nothing seem to work.
I get Invalid procedure call or Object required errors.

If you mean to put the CreateDecimalObject inside my VB6 code not sure how that will work. As far as I know VB6 has no collection class.


I am just confuse here what you want me to try.

Yes, sure if you have a code that will work I would love to have it.

Again thank you very much for your time on this

Carlos



Re: Timestamp of reqTickByTickData and timezone in TWS

 

开云体育

Editing posts is nearly always a bad idea. It’s much better to send another (as a reply to the original one) one pointing out what you want to say differently, so that the full history of what’s been said is preserved. Otherwise you get can replies to posts that have changed from what the replier was actually responding to, and other ills.

?

As a matter of fact, although the Group settings in theory don’t allow users to edit their posts, I believe that you CAN actually do this because the developers of the groups.io software received legal advice that not permitting this was dubious under GDPR rules.

?

However I urge people not to do this unless it’s a trivial change that doesn’t affect the sense of the original post. Adding new stuff would be a bad idea. Fixing a typo or adding a missing word, less so.

?

So what you’ve actually done here is just fine.

?

Richard King

Moderator

?

?

From: twsapi@groups.io <twsapi@groups.io> On Behalf Of GreenGreen via groups.io
Sent: 18 August 2022 21:51
To: twsapi@groups.io
Subject: Re: [TWS API] Timestamp of reqTickByTickData and timezone in TWS

?

Sorry, I just want to clarify that my question about different IBGM settings was about time zone settings. It would be great to see how choosing EST time zone would generate different code response.?

P.S. Too bad it is not possible to edit the post.


Re: Timestamp of reqTickByTickData and timezone in TWS

 

Correct, but Coordinated Universal Time (UTC) is not a time zone, but a reference time standard:

  • .

All TWS API objects that return absolute time strings will be impacted by your configuration selection. One that comes to mind immediately is , where you can select the returned time format as epoch time stamp or absolute time. Absolute time will follow your IBGW/TWS time zone configuration.

We stay away from absolute times as much as we can since time zones get complicated very quickly even before you bring in daylight saving time. Epoch time is unambiguous and the same number defines exactly the same point on the time line anywhere on earth regardless how the locals refer to that point in time.

闯ü谤驳别苍


Re: Timestamp of reqTickByTickData and timezone in TWS

 

Sorry, I just want to clarify that my question about different IBGM settings was about time zone settings. It would be great to see how choosing EST time zone would generate different code response.?

P.S. Too bad it is not possible to edit the post.


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

 

Hi Richard,

If I understood I will need to edit the IB ativex API to include that function and then recompile it?

Is that what you mean?

I created and activeX using VB.NET 2010 version put this code in

Public Function CreateDecimalObject(value As Variant) As Object

??? Dim collection As New collection

??? collection.Add CDec(value)

??? Set CreateDecimalObject = collection

End Function

It did not work. I tried?to change the function to decimal with no collection, did other combinations nothing seem to work.
I get Invalid procedure call or Object required errors.

If you mean to put the CreateDecimalObject inside my VB6 code not sure how that will work. As far as I know VB6 has no collection class.


I am just confuse here what you want me to try.

Yes, sure if you have a code that will work I would love to have it.

Again thank you very much for your time on this

Carlos



Re: Timestamp of reqTickByTickData and timezone in TWS

 

Thank you so much, 闯ü谤驳别苍!

I was under impression that Epoch Time is number of second counted from UTC datetime.?

Do you by any chance have an example of how differente IBGM settings are reflected in API code?

Regards


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

 

开云体育

I’m not sure whether I understand you correctly. Yes, you could certainly create an ActiveX wrapper around the IB ActiveX API that includes the function, but that would be a lot of work because you’d have to expose all the classes, methods, properties and events via the wrapper.

?

If you want to do this sort of thing, a much better approach would be what I offered to IB: I’ve already done the code for that and I have a working sample application. It would be relatively straightforward to maintain as the C# AI evolves. In fact it only requires very little change in the C# and ActiveX APIs, nearly all the work involved was in fixing up the VBA code in the Excel sample to use the revised properties and method/event signatures.

?

I’d be happy to supply you with that code and the sample program, though it was back in February that I produced it so it might need to be brought up-to-date a little.

?

But by far the easiest thing to do is simply to include that CreateDecimalObject function in your code base.

?

?

From: twsapi@groups.io <twsapi@groups.io> On Behalf Of carlos via groups.io
Sent: 18 August 2022 18:42
To: twsapi@groups.io
Subject: Re: [TWS API] Help for an old coder. API 10.17 Bar class.

?

Thank you Richard,

?

Then the solution could be create an activex in C# or VB.NET with that function that returns this object, then from the VB6 code I call this function?

?

Do you think that would work?

?

Thank you

?

Carlos

-----Original Message-----
From: Richard L King <rlking@...>
To: twsapi@groups.io
Sent: Thu, Aug 18, 2022 12:54 pm
Subject: Re: [TWS API] Help for an old coder. API 10.17 Bar class.

Sorry Carlos, I’ve been through all this before but I’d forgotten how to do this.

?

IB’s handling of the decimal problem in the ActiveX API is sadly lacking. It has to be supplemented by additional functions which should be in the API but aren’t. If you look at the VBA code in the Excel ActiveX demo, you’ll find a code module called Utils.bas that has a couple of relevant functions, in particular one called SetVariantDecimal. This that takes a string and returns the required object to use in properties like totalQuantity.

?

The following function is based on that, but I think it’s better named and is more applicable because it can take any variant as an argument:

?

Public Function CreateDecimalObject(value As Variant) As Object

??? Dim collection As New collection

??? collection.Add CDec(value)

??? Set CreateDecimalObject = collection

End Function

?

Ideally you’d add this function to a module (not a class module) so that it would be accessible everywhere within your code. But if you only need it within a single class, you could just add it to that class (in which case it should be Private rather than Public).

?

So now your failing piece of code would look like this:

?

??????? O.totalQuantity = CreateDecimalObject(quantity)

?

?

[Comment: if you think this CreateDecimalObject function looks very strange, you’re right! I modified IB’s API code to use a new class called BoxedDecimal, so that everywhere where IB has a Variant to hold a size value, there is instead a BoxedDecimal instead: this is much more documentary, because you can see exactly what you’re dealing with without having to guess. It also makes the ActiveX API much easier to use from C# or Visual Basic .Net. I offered this to IB as an improvement? (see if you have access to the API repository), but they have shown no interest…]

?

?

From: twsapi@groups.io <twsapi@groups.io> On Behalf Of carlos via groups.io
Sent: 18 August 2022 15:00
To: twsapi@groups.io
Subject: Re: [TWS API] Help for an old coder. API 10.17 Bar class.

?

Hi Richard,

Yesterday after I email here I found this option and try that.

The same error happens
O.totalQuantity = CDec(quantity)
returns

Run-time Error '424'

Object required

Somehow I need to create an object that is a C# decimal or so.

If you guys have any other ideas let me know.

Thank you very much for all the help.

Carlos


Re: Timestamp of reqTickByTickData and timezone in TWS

 

Time stamps have no time zone. They are relative measures of time (integer values such as 1660847370) often referred to as "". And since they are independent of time zones, they are also independent of daylight saving times or other local adjustments. But you are free to convert them to an absolute time in any time zone you prefer. You just have to let your conversion or print function know which time zone to convert to.

Time zone selections in IBGW and TWS relate only to data with absolute date/time strings, such as "20220818 10:21:33". Here you must know the timezone (and daylight saving compensation) in order to know the exact described time, unless the time zone name or offset is attracted to the end of the string (such as "20220818 10:21:33 US/Eastern").

闯ü谤驳别苍


Timestamp of reqTickByTickData and timezone in TWS

 

In IB Gateway, I selected timezone: "(UTC-05:00) America/New York", but in my?reqTickByTickData, I am still getting UTC.?

Here is my 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
?
class TestApp(EWrapper, EClient):
? ? def __init__(self):
? ? ? ? EClient.__init__(self, self)
? ? ? ? ? ? ? ?
?
? ? def error(self, reqId, errorCode, errorString):
? ? ? ? print("Error: ", reqId, " ", errorCode, " ", errorString)
?
? ? def tickByTickAllLast(self, reqId, tickType, time, price, size, tickAtrribLast, exchange, specialConditions):
? ? ? ? print("Tick Price. Ticker Id:", reqId, "tickType:", TickTypeEnum.to_str(tickType),
? ? ? ? ? ? ? "tickTypeNumeric:", tickType,
? ? ? ? ? ? ? "Price:", price,
? ? ? ? ? ? ? "Exchange", exchange,
? ? ? ? ? ? ? "market_time:", datetime.datetime.fromtimestamp(time) ,? "server time :", datetime.datetime.now())
? ? ? ? print("_______________________")
? ??
contract2 = Contract()
contract2.symbol = "SPY"
contract2.secType = "STK"
contract2.exchange = "SMART"
contract2.currency = "USD"
contract2.primaryExchange = "ARCA"

app = TestApp()
app.connect("127.0.0.1", 4002, 0)
time.sleep(1)
app.reqTickByTickData(1 ,contract2, "Last", 0, True)
api_thread = threading.Thread(target=app.run)
api_thread.start()
time.sleep(5)
app.cancelTickByTickData(1)
app.disconnect()

Here is output

Error:? -1? ?2104? ?Market data farm connection is OK:usfarm
Error:? -1? ?2106? ?HMDS data farm connection is OK:ushmds
Error:? -1? ?2158? ?Sec-def data farm connection is OK:secdefil
Tick Price. Ticker Id: 1 tickType: BID tickTypeNumeric: 1 Price: 426.96 Exchange CHX market_time: 2022-08-18 18:05:59 server time : 2022-08-18 18:05:59.622034
_______________________
Tick Price. Ticker Id: 1 tickType: BID tickTypeNumeric: 1 Price: 426.96 Exchange ARCA market_time: 2022-08-18 18:06:00 server time : 2022-08-18 18:06:00.587073
_______________________
Tick Price. Ticker Id: 1 tickType: BID tickTypeNumeric: 1 Price: 426.96 Exchange ISLAND market_time: 2022-08-18 18:06:00 server time : 2022-08-18 18:06:00.590668
? ?
?
The EST timestamp should be something like 13:06:00.xxxxxx. Am I missing something?


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

 

Thank you Richard,

Then the solution could be create an activex in C# or VB.NET with that function that returns this object, then from the VB6 code I call this function?

Do you think that would work?

Thank you

Carlos


-----Original Message-----
From: Richard L King <rlking@...>
To: twsapi@groups.io
Sent: Thu, Aug 18, 2022 12:54 pm
Subject: Re: [TWS API] Help for an old coder. API 10.17 Bar class.

Sorry Carlos, I’ve been through all this before but I’d forgotten how to do this.
?
IB’s handling of the decimal problem in the ActiveX API is sadly lacking. It has to be supplemented by additional functions which should be in the API but aren’t. If you look at the VBA code in the Excel ActiveX demo, you’ll find a code module called Utils.bas that has a couple of relevant functions, in particular one called SetVariantDecimal. This that takes a string and returns the required object to use in properties like totalQuantity.
?
The following function is based on that, but I think it’s better named and is more applicable because it can take any variant as an argument:
?
Public Function CreateDecimalObject(value As Variant) As Object
??? Dim collection As New collection
??? collection.Add CDec(value)
??? Set CreateDecimalObject = collection
End Function
?
Ideally you’d add this function to a module (not a class module) so that it would be accessible everywhere within your code. But if you only need it within a single class, you could just add it to that class (in which case it should be Private rather than Public).
?
So now your failing piece of code would look like this:
?
??????? O.totalQuantity = CreateDecimalObject(quantity)
?
?
[Comment: if you think this CreateDecimalObject function looks very strange, you’re right! I modified IB’s API code to use a new class called BoxedDecimal, so that everywhere where IB has a Variant to hold a size value, there is instead a BoxedDecimal instead: this is much more documentary, because you can see exactly what you’re dealing with without having to guess. It also makes the ActiveX API much easier to use from C# or Visual Basic .Net. I offered this to IB as an improvement? (see if you have access to the API repository), but they have shown no interest…]
?
?
From: twsapi@groups.io <twsapi@groups.io> On Behalf Of carlos via groups.io
Sent: 18 August 2022 15:00
To: twsapi@groups.io
Subject: Re: [TWS API] Help for an old coder. API 10.17 Bar class.
?
Hi Richard,

Yesterday after I email here I found this option and try that.

The same error happens
O.totalQuantity = CDec(quantity)
returns
Run-time Error '424'
Object required

Somehow I need to create an object that is a C# decimal or so.

If you guys have any other ideas let me know.

Thank you very much for all the help.

Carlos


Is it able to auto reconnect?

 

If the API shows the error messages,is it able to auto reconnect by code?
I used to detect the gap between now and the last data received time and?raise EOFError.
I am seeking new method to do it.Any ideas is welcome.

-------error message-------
2022-08-18 20:06:28 Error: ?-1 ? 2157 ? Sec-def data farm connection is broken:secdefnj
2022-08-18 20:06:28 Error: ?-1 ? 2105 ? HMDS data farm connection is broken:ushmds
2022-08-18 20:06:32 Error: ?-1 ? 2103 ? Market data farm connection is broken:cashfarm
2022-08-18 20:06:33 Error: ?-1 ? 2103 ? Market data farm connection is broken:eufarm
2022-08-18 20:07:09 Error: ?-1 ? 2105 ? HMDS data farm connection is broken:cashhmds
2022-08-18 20:07:09 Error: ?3 ? 10182 ? Failed to request live updates (disconnected).
2022-08-18 20:07:10 Error: ?6 ? 10182 ? Failed to request live updates (disconnected).
2022-08-18 20:07:10 Error: ?2 ? 10182 ? Failed to request live updates (disconnected).
2022-08-18 20:07:10 Error: ?1 ? 10182 ? Failed to request live updates (disconnected).
2022-08-18 20:07:10 Error: ?7 ? 10182 ? Failed to request live updates (disconnected).
2022-08-18 20:07:10 Error: ?5 ? 10182 ? Failed to request live updates (disconnected).
2022-08-18 20:07:10 Error: ?0 ? 10182 ? Failed to request live updates (disconnected).
2022-08-18 20:07:10 Error: ?4 ? 10182 ? Failed to request live updates (disconnected).
2022-08-18 22:43:27 Error: ?-1 ? 2103 ? Market data farm connection is broken:usfarm
2022-08-18 22:43:52 Error: ?-1 ? 2103 ? Market data farm connection is broken:usfarm
2022-08-18 22:43:54 Error: ?-1 ? 2103 ? Market data farm connection is broken:eufarm
2022-08-18 22:43:55 Error: ?-1 ? 2103 ? Market data farm connection is broken:cashfarm
2022-08-18 22:43:56 Error: ?-1 ? 2157 ? Sec-def data farm connection is broken:secdefnj
2022-08-18 22:43:58 Error: ?-1 ? 2105 ? HMDS data farm connection is broken:ushmds
2022-08-18 22:45:21 Error: ?-1 ? 2157 ? Sec-def data farm connection is broken:secdefnj
2022-08-18 22:45:21 Error: ?-1 ? 2103 ? Market data farm connection is broken:cashfarm
2022-08-18 22:46:06 Error: ?-1 ? 2105 ? HMDS data farm connection is broken:cashhmds
2022-08-18 22:46:11 Error: ?-1 ? 2103 ? Market data farm connection is broken:eufarm

--


------
Forex trader
David Liao


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

 

开云体育

Sorry Carlos, I’ve been through all this before but I’d forgotten how to do this.

?

IB’s handling of the decimal problem in the ActiveX API is sadly lacking. It has to be supplemented by additional functions which should be in the API but aren’t. If you look at the VBA code in the Excel ActiveX demo, you’ll find a code module called Utils.bas that has a couple of relevant functions, in particular one called SetVariantDecimal. This that takes a string and returns the required object to use in properties like totalQuantity.

?

The following function is based on that, but I think it’s better named and is more applicable because it can take any variant as an argument:

?

Public Function CreateDecimalObject(value As Variant) As Object

??? Dim collection As New collection

??? collection.Add CDec(value)

??? Set CreateDecimalObject = collection

End Function

?

Ideally you’d add this function to a module (not a class module) so that it would be accessible everywhere within your code. But if you only need it within a single class, you could just add it to that class (in which case it should be Private rather than Public).

?

So now your failing piece of code would look like this:

?

??????? O.totalQuantity = CreateDecimalObject(quantity)

?

?

[Comment: if you think this CreateDecimalObject function looks very strange, you’re right! I modified IB’s API code to use a new class called BoxedDecimal, so that everywhere where IB has a Variant to hold a size value, there is instead a BoxedDecimal instead: this is much more documentary, because you can see exactly what you’re dealing with without having to guess. It also makes the ActiveX API much easier to use from C# or Visual Basic .Net. I offered this to IB as an improvement? (see if you have access to the API repository), but they have shown no interest…]

?

?

From: twsapi@groups.io <twsapi@groups.io> On Behalf Of carlos via groups.io
Sent: 18 August 2022 15:00
To: twsapi@groups.io
Subject: Re: [TWS API] Help for an old coder. API 10.17 Bar class.

?

Hi Richard,

Yesterday after I email here I found this option and try that.

The same error happens
O.totalQuantity = CDec(quantity)
returns

Run-time Error '424'

Object required

Somehow I need to create an object that is a C# decimal or so.

If you guys have any other ideas let me know.

Thank you very much for all the help.

Carlos


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

 

Hi Richard,

Yesterday after I email here I found this option and try that.

The same error happens
O.totalQuantity = CDec(quantity)
returns

Run-time Error '424'
Object required

Somehow I need to create an object that is a C# decimal or so.

If you guys have any other ideas let me know.

Thank you very much for all the help.

Carlos


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

 

开云体育

Try this:

?

??????? O.totalQuantity = CDec(quantity)

?

?

Richard

?

?

From: twsapi@groups.io <twsapi@groups.io> On Behalf Of carlos via groups.io
Sent: 18 August 2022 05:58
To: twsapi@groups.io
Subject: Re: [TWS API] 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.

?


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.
?


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

 

Thank you very much joanmarcel119 and Richard.

For now the variant type use on histvolume and WAP worked, it did compile and the part that gets real time data and historical data seems to be working OK.

I will do more testing make sure all works and then go to the order processing part that is more complicate, hope the variant solution will work there also.

The for now the decimal type using variant type is a solution for this problem.

Thank so much for the help on this.

Richard, thank you for clarifying this
"Regarding the Bar class, there is no such thing in the ActiveX API (there never has been). This is in the C# API, but is not exposed via the ActiveX API."
I was confuse on where was the Bar class, now I know. Thank you.

Carlos

2 abd


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

 

开云体育

In order to support crypto contracts, IB have changed many ‘size’ parameters and properties (for example in TickSize and HistoricalData events) from 32-bit integers (ie Long in VB6) to Decimal type.

?

In .Net, the Decimal type can be easily used exactly the same as any other numeric type. So if you’re using the C# API from Visual Basic.Net you can declare decimal variables, and use them, in the obvious way:

?

Dim size As Decimal = 499.7366214562341954

?

But VB6, although it provides some support for Decimal values, is less friendly. Here’s what the VB6 documentation has to say about the Decimal type:

?

Decimal variables are stored as 96-bit (12-byte) signed integers scaled by a variable power of 10. The power of 10 scaling factor specifies the number of digits to the right of the decimal point, and ranges from 0 to 28. With a scale of 0 (no decimal places), the largest possible value is +/-79,228,162,514,264,337,593,543,950,335. With a 28 decimal places, the largest value is +/-7.9228162514264337593543950335 and the smallest, non-zero value is +/-0.0000000000000000000000000001.

?

Note?? At this time the Decimal data type can only be used within a Variant, that is, you cannot declare a variable to be of type Decimal. You can, however, create a Variant whose subtype is Decimal using the CDec function.

?

For example, the equivalent to the above Visual Basic .Net statement would be:

?

Dim size As Variant : size = CDec(499.7366214562341954)

?

So the ActiveX API now has lots of Variant values scattered through it wherever there used to be a Long size value (other non-size Long values such as request ids are still Longs).

?

So your HistoricalData event handler should now be declared like this:

?

Private Sub TWS_historicalData(reqId As Long, date As String, open As Double, high As Double, low As Double, close As Double, volume, barCount As Long, WAP, hasGaps As Long)

.

.

.

End Sub

?

You’ll need to check all the various events you handle to discover where Longs have been replaced with Variants. The easiest way to do this is either to simply recreate the event handlers in the usual way, or you can use the Object Browser (press F2) to inspect all the various classes and events.

?

You don’t have to do anything special to actually use these values in VB6. You can do all the usual arithmetic operations on them, and because Variants carry the actual data type internally the VB6 runtime always knows what kind of value it’s dealing with.

?

Regarding the Bar class, there is no such thing in the ActiveX API (there never has been). This is in the C# API, but is not exposed via the ActiveX API.

?

Richard

?

?

From: twsapi@groups.io <twsapi@groups.io> On Behalf Of carlos almeida via groups.io
Sent: 17 August 2022 20:39
To: twsapi@groups.io
Subject: [TWS API] Help for an old coder. API 10.17 Bar class.

?

Hello,

This looks odd but I have been using the IB API on Visual Basic 6 forever.

I have an app that collects data, historical and put orders in the market and works great.

I saw this new API 10.17 and as I always do I try it to see what will happen.

It is broken now, I did look on the forum here trying to find something about it but could not find.

?

Problem is on this new Bar class.

For example on the Api 9.7X the function like historicalData would return (ByVal reqId As Long, ByVal date1 As String, ByVal open1 As Double, ByVal high As Double, ByVal low As Double, ByVal close1 As Double, ByVal volume As Long, ByVal barCount As Long, ByVal WAP As Double, ByVal hasGaps As Long)

?

Using API 10.17 when I go to the events list and select historicalData event it show a broken all in red historicalData(ByVal reqId As Long, ByVal date1 As String, ByVal open1 As Double, ByVal high As Double, ByVal low As Double, ByVal close1 As Double, ByVal volume As Long, ByVal barCount As Long, ByVal WAP As Double, ByVal hasGaps As Long)

?

There is nothing with Bar. Naturally the code does not work.

?

The API documentation shows the historicalData event as void historicalData(int reqid, Bar bar)

?

I change the event return to historicalData(ByVal reqId As Long, bar1 as Bar), the red disappear, but I cannot find class bar in the API.

?

For example on contract I use IContract and then the function createContract to create and and use that contract class.

?

On Bar I cannot find nothing for BAr inside the API.

?

I try to create a Bar class inside the VB code with the definition on the API documentation but naturally it did not work, I think I need to use the Bar class from the API, but do not see how to get it.

?

Anyone has any clue what is going on here?

I know that is not much information but maybe someone had to deal with something similar.

?

Thank you

?


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

 

Carlos, prueba esto, try this:

(ByVal reqId As Long, ByVal histDate As String, ByVal histOpen As Double, ByVal histHigh As Double, ByVal histLow As Double, ByVal histClose As Double, ByVal histVolume As Variant, ByVal barCount As Long, ByVal WAP As Variant, ByVal hasGaps As Long)

I took a look into how the?historicalData wrapper method is declared in the activex sample provided by IB and maybe this also works with visual basic as they are related.

Hope this helps


El mié, 17 ago 2022 a las 21:38, carlos almeida via (<ctalmeida=aol.com@groups.io>) escribió:
Hello,
This looks odd but I have been using the IB API on Visual Basic 6 forever.
I have an app that collects data, historical and put orders in the market and works great.
I saw this new API 10.17 and as I always do I try it to see what will happen.
It is broken now, I did look on the forum here trying to find something about it but could not find.
?
Problem is on this new Bar class.
For example on the Api 9.7X the function like historicalData would return (ByVal reqId As Long, ByVal date1 As String, ByVal open1 As Double, ByVal high As Double, ByVal low As Double, ByVal close1 As Double, ByVal volume As Long, ByVal barCount As Long, ByVal WAP As Double, ByVal hasGaps As Long)
?
Using API 10.17 when I go to the events list and select historicalData event it show a broken all in red historicalData(ByVal reqId As Long, ByVal date1 As String, ByVal open1 As Double, ByVal high As Double, ByVal low As Double, ByVal close1 As Double, ByVal volume As Long, ByVal barCount As Long, ByVal WAP As Double, ByVal hasGaps As Long)
?
There is nothing with Bar. Naturally the code does not work.
?
The API documentation shows the historicalData event as void historicalData(int reqid, Bar bar)
?
I change the event return to historicalData(ByVal reqId As Long, bar1 as Bar), the red disappear, but I cannot find class bar in the API.
?
For example on contract I use IContract and then the function createContract to create and and use that contract class.
?
On Bar I cannot find nothing for BAr inside the API.
?
I try to create a Bar class inside the VB code with the definition on the API documentation but naturally it did not work, I think I need to use the Bar class from the API, but do not see how to get it.
?
Anyone has any clue what is going on here?
I know that is not much information but maybe someone had to deal with something similar.
?
Thank you
?


Help for an old coder. API 10.17 Bar class.

 

Hello,
This looks odd but I have been using the IB API on Visual Basic 6 forever.
I have an app that collects data, historical and put orders in the market and works great.
I saw this new API 10.17 and as I always do I try it to see what will happen.
It is broken now, I did look on the forum here trying to find something about it but could not find.
?
Problem is on this new Bar class.
For example on the Api 9.7X the function like historicalData would return (ByVal reqId As Long, ByVal date1 As String, ByVal open1 As Double, ByVal high As Double, ByVal low As Double, ByVal close1 As Double, ByVal volume As Long, ByVal barCount As Long, ByVal WAP As Double, ByVal hasGaps As Long)
?
Using API 10.17 when I go to the events list and select historicalData event it show a broken all in red historicalData(ByVal reqId As Long, ByVal date1 As String, ByVal open1 As Double, ByVal high As Double, ByVal low As Double, ByVal close1 As Double, ByVal volume As Long, ByVal barCount As Long, ByVal WAP As Double, ByVal hasGaps As Long)
?
There is nothing with Bar. Naturally the code does not work.
?
The API documentation shows the historicalData event as void historicalData(int reqid, Bar bar)
?
I change the event return to historicalData(ByVal reqId As Long, bar1 as Bar), the red disappear, but I cannot find class bar in the API.
?
For example on contract I use IContract and then the function createContract to create and and use that contract class.
?
On Bar I cannot find nothing for BAr inside the API.
?
I try to create a Bar class inside the VB code with the definition on the API documentation but naturally it did not work, I think I need to use the Bar class from the API, but do not see how to get it.
?
Anyone has any clue what is going on here?
I know that is not much information but maybe someone had to deal with something similar.
?
Thank you
?


Re: Which Java version to use?

 

Thank you for the recommendations. I'm using Netbeans 8.2 (yes, a very old version). But I fear that Ubuntu somehow changed the Java version when it upgraded from 20.04 to 22.04. Maybe a tool like Maven is able to prevent this in the future. I would have to investigate Maven as I have only heard the name, but am totally unaware of what it is and does.