Skip to content

Commit ed2a3ef

Browse files
committed
Guidelines for Reality Modelling
1 parent 01ce235 commit ed2a3ef

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed
Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
<p>
2-
To keep community strategies reliable, readable, and easy to maintain, respect the following guidelines when submitting or updating strategies:
3-
</p>
1+
<p>To keep community strategies reliable, readable, and easy to maintain, respect the following guidelines when submitting or updating strategies:</p>
42

53
<ul>
64
<li>The backtest must run without throwing buying power or runtime errors.</li>
@@ -9,22 +7,16 @@
97
<li>Use current QuantConnect LEAN APIs and patterns; avoid deprecated methods.</li>
108
<li>Match scheduling cadence to data resolution (daily vs intraday vs monthly).</li>
119
<li>The backtest period must be the last 5 years <code>self.set_start_date(self.end_date - timedelta(5*365))</code> backtest period.</li>
12-
<li>
13-
Follow
14-
<a href="https://peps.python.org/pep-0008/" target="_blank" rel="nofollow">PEP8-style</a>
15-
readability with a maximum line length of 120 characters.
16-
</li>
10+
<li>Follow <a href="https://peps.python.org/pep-0008/" target="_blank" rel="nofollow">PEP8-style</a> readability with a maximum line length of 120 characters.</li>
1711
<li>Add a leading underscore to private class members.</li>
1812
<li>Keep total backtest runtime under 1 hour.</li>
1913
<li>
20-
Use the <a href="/docs/v2/writing-algorithms/reality-modeling/transaction-fees/key-concepts">default transaction fee model</a>.
21-
Do not override fee models.
14+
Use the <a href="/docs/v2/writing-algorithms/reality-modeling/key-concepts">default models</a>.
15+
Do not override models to artificially improve performance. For example, do not override the <a href="/docs/v2/writing-algorithms/reality-modeling/transaction-fees/key-concepts">transaction fees model</a> to reduce/eliminate fees or the <a href="/docs/v2/writing-algorithms/reality-modeling/buying-power">buying power model</a> to increase leverage.
2216
</li>
2317
<li>
2418
Strategies must not add or modify <a href="/docs/v2/writing-algorithms/portfolio/cashbook">CashBook cash balances</a> during a backtest (no cash deposits or withdrawals).
25-
Initial capital must be set only via <code>self.set_cash()</code>.
19+
Initial capital must be set only via <code>self.set_cash()</code> or <code>self.set_account_currency()</code>.
2620
</li>
2721
<li>If the algorithm has regular rebalances (weekly, monthly, quarterly, etc), call your rebalance logic in <a href='/docs/v2/writing-algorithms/key-concepts/event-handlers#07-Warmup-Finished-Event'>on_warmup_finished</a> so the start of the equity curve isn't flat.</li>
28-
</ul>
29-
30-
22+
</ul>

0 commit comments

Comments
 (0)