finplot icon indicating copy to clipboard operation
finplot copied to clipboard

Adding Trade & Arrows UI to finplot chart

Open Skinok opened this issue 2 years ago • 2 comments

Hi Sir,

I would like to share with you the little additions I have made to your amazing work.

My goal is to code a backtrading UI in Qt, based on backtrader, which displays a history of trades and a chart window using finplot. You can check my github repository here : backtrader-pyqt-ui Don't hesitate to change anythings in this PR and ask me if you have questions.

Best Regards,

Skinok.

Skinok avatar May 14 '23 13:05 Skinok

Hi and thanks for your work! There is one thing I'd ask of you first, and that is to squash away the nonsense commits (like "Remove useless example", "Clean finplot examples", remove things like "sys.path.append('C:/perso/trading/anaconda3/finplot')" in the code etc). There's also a bunch of unintentional white-space changes which would be nice to get edited out, if possible.

The second thing is I'd like to discuss are the arrows. There already is an API for adding triangles en masse pointing up, down, left, right of any color. Adding them one by one, as in your api, limits performance substantially when displaying a multi-year series of HFT. Also, I'd like the plotting library to be both finance-specific (candlestick plots) and generic (lines and bars). Adding two separate functions for "orders" and "trades" might be good, but seems a bit overly specific.

The dateStr2x() might be the minimum code required, it's a tough read though. I'll go through it thoroughly and see what I think. Also it's probably overdue to start naming things _to_ instead, as in datestr_to_x(). :)

I especially like what you did with your backtester! I'd like to take it for a spin and do the same with your finplot modifications, and come back with more thoughts. I'm travelling for the next week, so this might take some time unfortch. :)

highfestiva avatar May 14 '23 22:05 highfestiva

Thank you for taking the time to review this PR 👍

  1. I'll try to "squash away the nonsense commits" if my git knowledge allows me to ;)

  2. I havent' seen the API for adding triangles, I'll search for it and come back to you. Anyway, IMHO for financial backtesting it's mandatory to be able to review the trades on the chart. Let's maybe work together to find the best suitable option, including naming obvisouly :)

  3. the DateStr2x is not from me, it's a copy/paste from internet which works (as far as I've tested it). Don't blame me for this ugly code, i have to admit that I didn't even try to decrypt it :$ Renaming it with to seems to be a good idea.

  4. Thank you, the UX need to be changed, especially when choosing the AI model, but it's WIP :)

Do not hesitate to add comments if you have any!

Cheers.

Skinok avatar May 15 '23 16:05 Skinok