kernc / kernc/backtesting.py

Better Logging to help understand trade logic

Open
#1,352 7 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

### Enhancement description

Currently, it is impossible to know why a position was closed or opened without clear logs explaining the reasons.

Also, a trade id to identify all trades is needed.

### Code sample

```python
self.buy(log="The position was opened")

self.sell(log="The position was opened")

self.position.close(log="The position was closed because???")

trade.sl(price=???, log="Take stop loss was reached")

trade.tp(price=???, log="Take profit was reached")
```

### Additional info, images

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the buy, sell, position.close, trade.sl, and trade.tp entry points shown in the issue. Determine how logging and trade identity are currently handled across these operations; done means logs explain why positions or trades opened and closed and a trade ID identifies related activity.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, fintech-quant
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.