kernc / kernc/backtesting.py

Plot P/L triangles in absolute currency units

Open
#177 2 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue Hacktoberfest
Dominant language
Python
Stars
9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

I have set the reference price for the cash PnL at the spread between two securities (I am backtesting a mean reversion strategy). However, in the html output of the plot I am getting the PnL in terms of the differnce in the spread as a function of the entry price of the spread when the trade was initiated. Instead, I want to get the PnL based off of the prices of the sum of the two securities (VIX futures) which make up the spread. This would look like `cash difference in spread / sum(security_1, security_2)`. I have tried to add an additional class which could be inherited from `Order` but it's not working out.

Any ideas on how to provide custom data points (column names of our data) to compute the PnL during `run()`?

Contributor guide

Open the contributing guide

Research direction

Start by tracing how run() uses Order data to calculate PnL and how the HTML plot renders the result. Review the attempted custom Order approach and determine how column names or other custom data points could be supplied; done means the plot supports PnL in absolute currency units based on the sum of the two securities.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization, fintech-quant
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.