State of things, to dos and thoughts. #1
Replies: 16 comments
-
|
I currently have a nasty bug in the real time execution. Operating with series starts producing nan as result. I'm removing the series_c class. It was a nice idea but having to refresh the np.array views all the time creates too much trouble. The backtesting works fine, but I can't be used for realtime trading right now. The PnL calculations are better now, with the exception that in the accumulative liquidity the fees are not subtracted at closing part of the position and adding the collateral back to liquidity. So they give a slightly better result than they should. I'll fix it when I sort of the bigger bug I have. We're talking about a fraction of a percent point off. |
Beta Was this translation helpful? Give feedback.
-
|
The nasty real time execution bug has been hunted and exterminated now. Scripts can be run. |
Beta Was this translation helpful? Give feedback.
-
|
The nasty bug is definitely fixed. It's working solid now. I'm now testing that the results of the backtests match the real time execution, which takes a lot of time to test since I can only do it by letting a script run and then compare it to a backtest of the same period. I got rid of the series_c class, which created problems with outdated views of numpy arrays. I had it handled, but it was an unnecesary mess. I'm now using the generatedSeries_c class for all arrays (which reside in the dataframe) and not only the ones that auto-generate their values (like a SMA), so I should probably rename them to series_c. I'll wait a while to do it, tho. I have PTSD with that name. I fixed a problem with ccxt crashing because of the websockets handling. I can't fix CCXT, but I can restart the connection when it happens. I'm not currently making any efforts in implementing more visualization capabilities. I can make my strategies which what I have, and I have bigger priorities, like making sure I can trust them. Adding tables will have to wait. I did however improve the console so it can have a static message at the prompt where one can print the script status to check how it's doing without having to open the chart. Things are feeling good right now. The series operations seem rock solid and the script seems reliable. I'm also pretty sure that it's executing one candle earlier than Tradingview when using data from a higher timeframe. Not 100% sure about it yet, but I think it does. |
Beta Was this translation helpful? Give feedback.
-
|
Yep, there was a bug in the realtime execution. The entries didn't perfectly match the backtests. It's fixed and tested. Now they do. |
Beta Was this translation helpful? Give feedback.
-
|
I still have to fine tune the strategy stats calculations, but creating and running scripts is now solid. I have a couple trading and they are behaving as expected. |
Beta Was this translation helpful? Give feedback.
-
|
So, I found out another bug in the numpy code of the autogenerated series calculations. When the source of a calculation had nan values the nans could be propagated to the whole resulting array. I reviewed all the calculations and these should be solid now. |
Beta Was this translation helpful? Give feedback.
-
|
(I'm keeping this as a pseudo-blog if anyone wonders) I've been successfully running a couple of strategies for a month now. They made their entries and exits and when I open a backtest of them, they look the same as the operations they did realtime. Yay. The pnl calculations are still a little off because I still didn't fix the fees issue. I'll fix that very soon. |
Beta Was this translation helpful? Give feedback.
-
|
I'm improving the documentation in miniDoc.MD. It's still written by Copilot, but I'm making it do it step by step and it's much, much better. It will still miss methods and other stuff, but this time it will be usable. |
Beta Was this translation helpful? Give feedback.
-
|
I did some file renaming in order to create a pip module in a near future. Script execution still running realtime flawlessly. Trade manager still has the fees unfixed. When I fix this I'll make the module. |
Beta Was this translation helpful? Give feedback.
-
|
I fixed the issues with fees. pnls are more correct now. I'll probably make a pip release in a near future. |
Beta Was this translation helpful? Give feedback.
-
|
With the profit calculations now being solid the framework is now 100% functional. It doesn't have every feature, but the things it has work 100%. My scripts keep running real time in a perfect match with the backtest. It is not impossible that some "indicator" (Calculated series) that I haven't used since I originally added the code might be failing. A quick check hasn't shown anything, but I'm not running all of them realtime, so it's not impossible. Other than that possibility, everything is working like a clock. |
Beta Was this translation helpful? Give feedback.
-
|
I considered adding the orderbook, but as far as I know there is no history of the orderbook, so what would be the point if we can't backtest any strategy using the orderbook? If you want to code a strategy that uses it you can request it yourself using ccxt. |
Beta Was this translation helpful? Give feedback.
-
|
Made the first pip release as 0.1.0 Changelog for 0.1.1:
Thoughts: |
Beta Was this translation helpful? Give feedback.
-
|
With v0.1.1 algorizer is working pretty solid with my real time scripts. I will probably slow down the updates for a while. I'll focus more on making some strategies that I can run ;) |
Beta Was this translation helpful? Give feedback.
-
|
Changelog for 0.1.1:
|
Beta Was this translation helpful? Give feedback.
-
|
Thanks. I solved it. It turned out the crash wasn't coming from ccxt, It just happened that ccxt output some warnings coincident to the crash which misled me (It was a nan propagation in numpy that only happened in real time). I will check your security doc, tho. Sounds very interesting. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There is something wrong with the PnL in the current strategy class. It's not a 'bug' (in the sense the code isn't broken) but some flaw in the logic when applying the profits. I have to spend some time testing it until I figure it out, or rewrite the code where profits are applied.
I'm considering merging the generatedSeries_c class (calculates series based on provided formulas, the 'ta' functions equivalent) with series_c (a np.array wrapper subclass). It would make the series_c class a bit bloated but the interoperability simpler. It's quite a bit of work anyway, so I probably won't do it anytime soon.
I'm considering using pySide6 for the chart window. Upside: Proper menus, posibility of adding a settings window (Tradingview style). Downside: It takes quite some time. Do we really need it to write trading scripts? Another option would be to use bn_lightweight-charts-python which works really nice in the browser, but my background is at coding in C. I know nothing about webcoding, and I'm not sure if I have the will to figure it out.
Beta Was this translation helpful? Give feedback.
All reactions