¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 ¿ªÔÆÌåÓý

TagValue Implementation, Java, Q: HistoricalData


 

?

Hi Everyone,

?

Hope everyone¡¯s doing great and all is well. I was wondering for the longest on TagValue implementation, especially as pertains to historical data. Would anyone care to comment or briefly say few words. Doesn't have to be here, but can continue elsewhere. Somewhat willing to compensate for any help, provided, response is continuously posted/public here, for public use.

For the longest, on historical data, I have been calling the method historicalData and saving the callback response into an ArrayList of <Bar> type and processing it for the opening of position. [In past I¡¯ve also used serialization, but I think that too costly]. My strategy is a simple momentum of ''look back'' one hour and whichever way the slope/momentum points, [[[ boom ;) ]]], and I go with that. I hope everyone dispenses with extraneous and tangential comments and lectures, not a pro programmer, am advanced to level of HashMaps/streams, etc. But tagValue, baffles me. Anyways, is there any use to the tagValue thing? The only pseudo-marginally (in applicability) yet inspirational helpful examples of implements have been Dmitry¡¯s TWS API FAQ. Thank you Dmitry. See Question is of course in java. See URL below. The properties of the Tag and Value are String. If wishing to work with doubles and int, lots of conversions would be required. Regardless worth it or not, I still would like to know basic how-to.

?

?

?

Basic outline of implementation would be helpful¡ªto the point of what classes needed (and how many :) ) and etc..??

Are we supposed to construct the TagValue thingie and then send it via the ¡°
public static void HistoricalData_MainOPERATIONS¡± in Main and then somehow pick it up or get the response from the Ewrapper_Implementation class using getter and setters?

?

?

Here¡¯s my present implement¡­. **Without** TagValue.




ArrayList<Bar>
??? ArrayList<Bar> barsHistDataArrayList = new ArrayList<>(); //new when making request
??? //! [historicaldata]

??? @Override
??? public void historicalData(int reqId, com.ib.client.Bar bar) {
??????? System.out.println("HistoricalData. " + reqId + " - Date: " + bar.time() + ", Open: " + bar.open() + ", High: " + bar.high() + ", Low: " + bar.low() + ", Close: " + bar.close() + ", Volume: " + bar.volume() + ", Count: " + bar.count() + ", WAP: " + bar.wap());
??????? barsHistDataArrayList.add(bar);
??? }
??? //! [historicaldata]

??? public ArrayList<Bar> getBarsHistDataArrayList() {
??????? return barsHistDataArrayList;
??? }

??? public void setBarsHistDataArrayList(ArrayList<Bar> barsHistDataArrayList) {
??????? this.barsHistDataArrayList = barsHistDataArrayList;
??? }

?? ?
??? //! [historicaldataend]
??? @Override
??? public void historicalDataEnd(int reqId, String startDateStr, String endDateStr) {
??????? System.out.println("HistoricalDataEnd. " + reqId + " - Start Date: " + startDateStr + ", End Date: " + endDateStr);
?????? ?
??? }
??? //! [historicaldataend]

?

?

Anyways, here¡¯s a sample of my program on GitHub if anyone cares to look into and help. -no rush

?

?

Main class

?

?

ReqHistorical is being called from line 132. I am hoping for some type of TagValue implement/help from lines 189-198. Do we have to construct it then pass to argument, and pick up from Ibkr response via Ewrapper_Implementation class.

?

On above github sample, I've deliberately, of course, left out some aspects. --Holy grail of profitability almost there..-- But the raw strategy is here.

?

?

?

No rush please- Please give help. Thank you forum as always!


?

-Rv


 

I can only give you a very generic answer since all links you provided to GitHub and the "Collaboration" group require non-public access permissions.

The List<TagValue> concept is not unique to IB. It allows communicating parties to transmit lists of "SomeTagName = SomeTagValue" pairs. Tags are also known as variables or parameters..The parties need to agree upon or understand the names of all valid tags and for each tag the valid values.

The signatures of several EClient request methods and EWrapper response methods define TagValue lists, but only few of them actually use them. I am not aware of any defined tags for the market data methods, at least not at API levels 9.72 and below. You would simply call those methods with empty lists.

If you are interested in seeing how TagValue lists work, take a look at the . Each algorithm defines a table with one or more parameters (tags) that make sense only for that algorithm. But the TagValue lists make it possible that all these algorithm can be selected and configured without making bloating the order object with possibly hundreds of extra fields.

Hope this helps,

´³¨¹°ù²µ±ð²Ô


 

´³¨¹°ù²µ±ð²Ô Reinold,

?

Sorry, visibility on the github URL was earlier set as ¡°private¡±. Now its set to public.

?

The ¡°Collaboration¡± is an easy join.

?

I really hope to learn this TagValue thing.

?

?

Thank you,

Rv


 

Hi All,

Any takers?? Provided code is posted here and for public use, I willing to pay 200USD.? Just need starter inspiration.. couple of lines.? no rush.? I am guessing need the codes here... [3 places]

Main.java
public static void main(String[] args)
public static void HistoricalData_MainOPERATIONS


EWrapper_Implementation.java
EWrapper_Implementation


Thank you,
best
Rv


 

Well, I did look at the code when you made the repository public and felt that my last post said it all:

  • Requests for historical data currently do not utilize Tag/Value parameters
  • That may change in the future, but for now you simply send and empty list (just like you do already)

No need to pay for that answer.

´³¨¹°ù²µ±ð²Ô