Skip to main content

PnL.ai Intro


Part of my covid project and part of my long obsession with prediction markets, I have created a web page that displays and allows to compare best and worst performing trading strategies.

TL;DR: best stocks + best strategies -> the list of top and bottom performing trading algorithms. 

Product

Typically, trading newsletters and stock-scanners display only price return for top market gainers and losers. I have forever been interested in inspecting top and bottom performing trading strategies for a given set of securities and could not find any websites that do that. So, I decided to create a tool of my own.

I wanted the tool that would help me to answer questions like if there is a better strategy than buy and hold, should I follow greed and fear indicator of the market or do the opposite.

Top and bottom performing securities do not tell you if a stock is going to go up or down, but they do alert you to rapidly changing market conditions, such as change in the competitive landscape, impending lawsuits, changes in the company's management and, at the very least, the stocks you should avoid in your programmatic trading.

Top strategies do all that, but they can also alert you to a change in the market regime. For example, MACD strategy, which is a variant of oscillator strategy, executed on Citibank stock returned 20% in the first half of 2020. In the same time period, the Citibank stock went down and "BuyAndHold" strategy, which is pretty much what it sounds, lost 45%. Now, compare that to the end of 2020 through spring of 2021, when MACD lost 1% and "BuyAndHold" gained 70%. This happened due to the change in the market due to the rally in financial stocks at the end of 2020. The market player who detect change in the market conditions first will reap most benefits.

Another example, TSLA since the beginning of 2021 until end of April lost 7%. The StopLoss strategy sells the position after abrupt price drop and waits until the price returns to the level before the drop. For the same time interval the StopLoss strategy gained 10%. In this particular example, StopLoss outperformed BuyAndHold. See the graph and table results below.

To me personally, the most important feature is the ability to quickly tweak and modify trading strategies and observe change in their performance. You can change strategies parameters on the fly and even design your own custom trading strategy.

In the end, I developed a tool I can use for myself but hope other investors who are experimenting with trading algorithms will find it useful as well. I called it "Profit and Loss AI", or PnL.ai for short.

PnL.ai Description

The web-tool in the link below allows you to customize parameters of existing strategies and essentially create your own strategy and seeing how it will compare to the set of original strategies.

http://ec2-54-185-19-38.us-west-2.compute.amazonaws.com:5006/srv

  • In the section above you can specify security and data range.
  • In the section below you can choose strategy to customize and modify it's parameters.
  • The strategy comparison table will automatically update and will display a newly created strategy side by side with the original strategies.

Technology

The tool is developed on bokeh and python and allows you to edit configuration parameters of each strategy all without programming knowledge.

The strategies are fully specified via key/value pairs in the format of ini files used to initialize programs. The strategy classes are autogenerated by reading the ini config files dynamically using "factory" pattern.

You can find a simplified code in this github repo: https://github.com/varturas/PnlAITk

Next Steps

In the future I want to give users ability to monitor their chosen strategy by receiving trading algo alerts whenever performance of their custom trading algo is changes significantly.

I'm going to be adding more strategies, some of standard technical analysis variety and some will be more custom and more advanced. I'll also be adding more columns to the performance table to give better information.

You can receive daily newsletter with the list of trading strategies generated by above-mentioned web-tool by registering on http://pnl.ai/ and checking subscribe checkmark.




Comments

Popular posts from this blog

Can Crypto Find a Purpose? A Blockchain Approach to Optimizing Neural Networks

Authors: Igor Arsenin and Arturas Vaitaitis Can Crypto Find a Purpose? A Blockchain Approach to Optimizing Neural Networks As training ever-larger transformer-based models encounters diminishing returns, a novel blockchain protocol could advance AI by emphasizing the optimization of neural network architectures, harnessing the decentralized computational power of blockchain technology. The innovative protocol would replace arbitrary decryption tasks in the proof-of-work concept with a focus on enhancing benchmark scores of AI models on standardized datasets, utilizing interfaces like the Open Neural Network Exchange (ONNX) protocol to define architectures. The economic potential of blockchain technology could draw a diverse range of players into the field, sparking a competitive drive for the development of more efficient and effective neural networks, potentially giving blockchain a purpose beyond digital currency while democratizing the field of AI. The remarkable progress in large l

Chronicles of Alma Mater in April and Other Phystech Stories

"I am a student, I am glad I am a student. Only two month ago I was a schoolboy, Mathematics and Physics were always of interest to me.That's why I am here. " From Phystech 1 year English textbook. As a result of a natural process of clutter accumulation in my brain my stories are loosing colors and details and some of them disappeared all together. The only way to preserve some of those silly, yet dear memories is to put them in writing. First few big words: Back in the old country, the proud name of Phystech had stood for the Excellency in physics and math. It shaped the minds of several generations of Russian scientists. In simple words, our school kicked ass. This Excellency, as all good things in life, did not come for free. It was not the difficult exams or the rats in our dorm showers or god-awful food in the campus cafeteria. We had very few women. They say that a sum of looks and smarts form a constant. In my year among 90 or so, borderline genius guys