portfolio icon indicating copy to clipboard operation
portfolio copied to clipboard

dynamic/configurable SMA intervals

Open OnkelDok opened this issue 3 years ago • 3 comments

Aktuell sind fest definierte Intervalle/Filtergrößen für SMA und EMA vorgegeben. Hier und hier wurden frei konfigurierbare Intervalle angefragt.

EDIT: Änderung der Farbgebung der SMA/GD-Verläufe wurde im Forum hier angefragt

Ich habe mich mal dran gesetzt und geschaut wie man das ändern könnte. Der erste commit (c817fb7b0c0a24f6726a569fc5fa7c78e2e092c9) umfasst alles was (aus meiner Sicht) nötig ist um die festen Inervalle in eine dynamisch erweiterbare Liste zu bringen. Hiermit sähe für die Bediener alles erstmal aus aus wie bisher. Es ändert sich nur im Hintergrund das Datenhandling.

Etwas unsicher bin ich mir über die Art, wie die dynamischen Intervalle gespeichert werden. Mit dem commit wird das über eine 2D-Map gemacht (Map<Integer, TypedMap>). Dimension 1 = Intervalgröße in Tagen (z.B. 200 Tage). Dimension 2 = zu jedem Interval nötige Einstellungen (isActive + Farbe). In der xml-Datei ist so recht viel overhead vorhanden. Der Vorteil ist aber, dass die einzelnen Werte einfach geändert werden können (z.B. beim Ein-/Ausblenden eines Intervals oder das Ändern der Farbe). Leichtgewichtigeres Speichern wäre in einer 1D-Map möglich indem man als Key die Intervalgröße nimmt und als Value einen selbst zusammen gebauten string, welcher eben isActive und die Farbe beinhaltet. Vll hast du, @buchen da noch eine Idee (falls die 2D-Map ungünstig ist).

Die neue dynamische Liste kann mit diesem commit aber noch nicht erweitert werden. Dazu fehlt noch eine entsprechende Oberfläche. Meine Vorstellung aktuell wäre, dass man im Kontext-Menü einen "Verwalten..."-Button anbietet, welcher dann einen Dialog öffnet, in welchem man Intervalle einfügen/löschen und deren Farbe im Chart ändern kann: grafik

Ich schau mal ob ich zeitnah dazu komme den Dialog zu implementieren.

Grüße OnkelDok

EDIT: bisher wurden nur die Daten/Einstellungen der SMA-Charts angepasst. Für EMA müsste das dann aber genauso gehen. Ich wollte nur erstmal mit einem Typ das Ganze durchziehen.

OnkelDok avatar Nov 05 '21 19:11 OnkelDok

I have implemented the management of SMA intervals (or is another term for "intervals" more appropriate for this?) as a design:

https://user-images.githubusercontent.com/90478568/143719977-ff28d098-20f4-43c4-ad45-599221c2fb95.mov

Would this be a viable option for management in this form? Suggestions/feedback are welcome.

Open points are still:

  • Test the code thoroughly: Currently, this is more or less the first draft for the administration interface. For sure something has to be adjusted here and there (especially labels and text). I would generally go through it again and look for bugs. Also, the language keys need to be created and translated.
  • Fix code style: Here (portfolio-app/portfolioCheckstyle.xml) there is a checkstyle file in the project. I had included it once in Checkstyle. But I was surprised that a lot of checks are disabled. For example, the check for spaces after an "if" is inactive. Do I have the wrong file?
  • Adapt type storage of SMA intervals: As already mentioned in the first post, this would still need to be adapted if necessary. The current implementation gets by without any type definition for serialization/deserialization because it uses the TypedMap. @buchen: If you tell me what type of storage is desired/suitable and what needs to be done for it, I can still customize that.

OnkelDok avatar Nov 27 '21 19:11 OnkelDok

I have now found some time to continue here. I have added the language keys. I would like to run checkstyle over it: is there a definition file to use?

I haven't touched EMA yet. If the feature (configurable SMA intervals) should be accepted in principle, and SMA and EMA should be configurable at the same time, then I would like to implement it.

Otherwise, everything should be functionally ready now.

OnkelDok avatar Feb 21 '22 18:02 OnkelDok

I noticed that the forum also asked about changing the color scheme: https://forum.portfolio-performance.info/t/farbaenderung-im-performance-diagramm/6115

By the way, I set the PR back to Draft. Because: In connection with another function (Column with relative delta of SMAx to current price in securities overview), it may be necessary to proceed somewhat differently here.

@buchen I know that you have rather less time to examine larger PRs. My question in general would be only whether the following functions could generally come in or you rather say that will not come anyway (then I do not have to make the effort ;) ):

  1. SMA/EMAx line in price chart (so far you can "only" use predefined SMA/GD periods) (this PR here)

OnkelDok avatar Apr 30 '22 18:04 OnkelDok