Skip to content

Commit

Permalink
Adds Zero Transaction Fee Section
Browse files Browse the repository at this point in the history
To make it explicit how to disable fess following other models with a "disable" section.
  • Loading branch information
AlexCatarino committed Sep 18, 2024
1 parent 2d83c4e commit cfc2caa
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@


<div class="section-example-container">
<pre class="csharp">// In Initialize
var security = AddEquity("SPY");
security.SetFeeModel(new ConstantFeeModel(0));</pre>
<pre class="python"># In Initialize
security = self.add_equity("SPY")
security.set_fee_model(ConstantFeeModel(0))</pre>
<pre class="csharp">public override Initialize()
{
var security = AddEquity("SPY");
security.SetFeeModel(new ConstantFeeModel(0));
}</pre>
<pre class="python">def initialize(self):
security = self.add_equity("SPY")
security.set_fee_model(ConstantFeeModel(0))</pre>
</div>

<p>You can also set the fee model in a <a href='/docs/v2/writing-algorithms/initialization#07-Set-Security-Initializer'>security initializer</a>. If your algorithm has a dynamic universe, use the security initializer technique. In order to initialize single security subscriptions with the security initializer, call <code class="csharp">SetSecurityInitializer</code><code class="python">set_security_initializer</code> before you create the subscriptions.</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<p>To model zero transaction fees, use the <a href='/docs/v2/writing-algorithms/reality-modeling/transaction-fees/supported-models'>ConstantFeeModel</a> with zero as <code>fee</code>.</p>

<div class="section-example-container">
<pre class="csharp">public override Initialize()
{
var security = AddEquity("SPY");
security.SetFeeModel(new ConstantFeeModel(fee: 0m));
}</pre>
<pre class="python">def initialize(self):
security = self.add_equity("SPY")
security.set_fee_model(ConstantFeeModel(fee=0))</pre>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p>The <code>ConstantFeeModel</code> applies the absolute value of a constant fee to each order. It's the default fee model of the <a href='/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/quantconnect-paper-trading'>DefaultBrokerageModel</a> if you trade Forex, CFD, or Crypto assets.</p>
<p>The <code>ConstantFeeModel</code> applies the absolute value of a constant fee to each order. It's the default fee model of the <a href='/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/quantconnect-paper-trading'>DefaultBrokerageModel</a> if you trade Forex, CFD, or Crypto assets. Use this model to set <a href='/docs/v2/writing-algorithms/reality-modeling/transaction-fees/key-concepts#05-Zero-Transaction-Fees'>zero transaction fees</a>.</p>

<div class="section-example-container">
<pre class="csharp">security.SetFeeModel(new ConstantFeeModel(0.05m));</pre>
Expand All @@ -20,13 +20,13 @@
<tr>
<td><code>fee</code></td>
<td><code class="csharp">decimal</code><code class="python">float</code></td>
<td>The order fee quantity<br></td>
<td>The order fee quantity</td>
<td></td>
</tr>
<tr>
<td><code>currency</code></td>
<td><code class="csharp">string</code><code class="python">str</code></td>
<td>The order fee currency<br></td>
<td>The order fee currency</td>
<td>"USD"</td>
</tr>
</tbody>
Expand Down

0 comments on commit cfc2caa

Please sign in to comment.