drixie / royaloak

Starter using Vite2 + React + Typescript + Tailwind + Electron Starter.
MIT License
0 stars 0 forks source link

Ensure consistency in the display and availability of the Levels Data - V1/PP25 #5

Open drixie opened 2 years ago

drixie commented 2 years ago
  1. Review the current code written for managing levels (indicator levels and custom levels)
  2. Re-write levels code to ensure consistency in the display and availability of levels data per asset
rylorin commented 2 years ago

Should I convert Python code to NodeJS first?

drixie commented 2 years ago

@rylorin The python code right now is convoluted... because I was try to work around my limited knowledge of Python and IBKR API. I think it is best for us to have a discussion about it, and once you understand what I need to do, it will take you less time. Some of the node code right now is also redundant to an extent

fabiosalvi commented 2 years ago

In order to postpone the Python morass you may benefit to replace it with this:

https://www.npmjs.com/package/technicalindicators

It's not Pythn TA, but it does the job (it has VWAP).

I suggest removing every dependency from Python until you have a product that can go to market (so, the executable).

If you keep Python in there you may manage to make the executable without errors, but there would still be a dependancy on Python being installed on the machine of the user AND it must be the right version. ( So it's possible that the user has a previous version, then he tries to update, then he gets two versions overlapping and every kind of troubleshooting hell the user is gonna drag you into ).

On the other side, if you remove Python dependency and get to an executable in a sustainable way then, LATER, you may evaluate to bring it back again, with the security of having already touched first base.

Also, @drixie , if you see the other project of that guy, he seems to have know how about TradingView integrations the way you like it.

NOTE: I'm here because I'm an assignee of this task and I was notified of the conversation. : - ) @rylorin @drixie

drixie commented 2 years ago

@fabiosalvi The user of the app will not need to install python. See these links:

  1. https://stackoverflow.com/questions/67146654/how-to-compile-python-electron-js-into-desktop-app-exe
  2. https://stackoverflow.com/questions/59516767/do-users-have-to-install-non-standard-python-libraries-i-imported-to-run-my-pyth

The challenge I have with node-based technical indicators is that I have tested most of them and they all have one issue or the other, either with installation or accuracy of calculations. Have you actually used https://www.npmjs.com/package/technicalindicators before in a production application? The projects of the guy who wrote it seems to be abandoned and I don't think that library is being maintained anymore (since three years ago)

drixie commented 2 years ago

@fabiosalvi For comparison, this is the indicator library I have chosen. It is the only reason Python is being used and I think it is worth it - https://github.com/twopirllc/pandas-ta

It has 130+ indicators and helpful functions and the author is very responsive, rigorously tests the results to match output from ta-lib and is also open to being challenged if you have a standard output data source.

fabiosalvi commented 2 years ago

Ok, the theory of your process seems solid. But you still don't have the proof of the pudding. I think it's a test you better carry on before taking architectural decisions.

  1. https://stackoverflow.com/questions/67146654/how-to-compile-python-electron-js-into-desktop-app-exe

This link is good.

  1. https://stackoverflow.com/questions/59516767/do-users-have-to-install-non-standard-python-libraries-i-imported-to-run-my-pyth

This one is from 2019. Possibly stale.

Have you actually used https://www.npmjs.com/package/technicalindicators before in a production application?

No, I didn't. I found it some days ago. @drixie Did you test it and found wrong outputs?

https://github.com/twopirllc/pandas-ta

I 100% agree this is the best one.

rylorin commented 2 years ago

@drixie I noticed that you use the penultimate bar to display "levels" in the "Levels" pane and the last bar values in the "Watchlist" pane. Is this intentional?

drixie commented 2 years ago

@rylorin Yes, this is intentional. By the time the data is fetched, the most recent bar (i.e. the last item in the historical data array), is an incomplete candle based on the closing price, and the indicator values calculated from it will be very different to the value you will get when that bar is eventually complete. The penultimate bar represents the latest complete bar on which the traders will typically initiate rules.

Whereas in the watchlist pane, you are using the latest candle the same way you are reading realtime indicator on the chart in order to decide whether or not to enter a trade on that symbol.

Let me know if you understand my point. This is probably better explained in a Discord call.