-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TradingRecord: support consecutive trades from same TradeType #755
Comments
I totally agree with you, that this would be a nice and usefull feature, especially for better backtesting. But so far, the library's implementation is not ready to be reworked in such a big way.
All in all I would suggest to start with the small parts first, before we can implement arbitrary variations of entry and exit trades - especially the complex manual caching and index-behaviour should be reworked completely with more sophisticated structures like PriorityQueues, LinkedHashMap or even Caches and Sets. |
I agree. One of the main reason, why ArrayList was choosen: because it has the best overall performance (and can be accessed by indices). Well there are java built-in structures like (un)bounded queues/caches which would be worth to discuss.. |
Normally I would say we use a TreeMap<Integer, T> for the cache and remove the map.firstEntry as soon as the cache is overfull. But there is the LinkedHashMap<Integer,T>, which automatically can remove the eldest/first indices: https://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashMap.html#removeEldestEntry-java.util.Map.Entry- I implemented this already here: https://github.com/MarcDahlem/ta4j/blob/feature/indicator_cache_enhancements/ta4j-core/src/main/java/org/ta4j/core/indicators/CachedIndicator.java#L40 The problem with LinkedHashMap is, that it does not sort by Key, so the value we remove could be a newer value... |
Tada: #758 |
Hi, @nimo23 I'm really interested in seeing this issue resolved, and I'm wondering if there have any updates. |
No updates so far. Any updates, will be published here or in the form of a PR. Feel free to help :) |
This is the way forward because this is a normal way of doing transactions as you process more larger portfolio ... So I vote to implement it .... ;-) |
This issue is for discussion (brainstorming) the best solution (implementation) to provide the ability to record consecutive trades from the same
TradeType
. After discussion, a PR should be created.In short:
The actual
(Base)TradingRecord
(and allCriteria
) does not support the following:Additional informations:
The text was updated successfully, but these errors were encountered: