Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ <h4>Classic Algorithm Example</h4>
if momentum is None:
return

# Hold the market while the momentum factor is positive
# Invest the whole portfolio in SPY while the momentum factor is positive
if momentum &gt; 0:
self.set_holdings(self.spy, 1)

# Step aside while it is negative
# Liquidate SPY while the momentum factor is zero or negative
else:
self.liquidate(self.spy)</pre>
<pre class="csharp">public class FamaFrenchFactorsAlgorithm : QCAlgorithm
Expand Down Expand Up @@ -68,12 +68,12 @@ <h4>Classic Algorithm Example</h4>
return;
}

// Hold the market while the momentum factor is positive
// Invest the whole portfolio in SPY while the momentum factor is positive
if (momentum &gt; 0)
{
SetHoldings(_spy, 1);
}
// Step aside while it is negative
// Liquidate SPY while the momentum factor is zero or negative
else
{
Liquidate(_spy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

<p><code>Sources</code>:
<br>- <a href='https://www.prnewswire.com/news-releases/cboe-options-exchange-to-list-three-long-dated-spx-options-expirations-beginning-november-1-2021-301410178.html'>Cboe Options Exchange to List Three Long-Dated SPX Options Expirations, Beginning November 1, 2021</a>
<br>- <a href='https://www.prnewswire.com/news-releases/cboe-plans-to-list-spx-tuesday-thursday-expiring-weeklys-options-301474986.html'>Cboe Plans to List SPX Tuesday, Thursday-Expiring Weeklys Options</a>
<br>- <a href='https://www.indexologyblog.com/2022/05/12/sp-500-weekly-options-now-expire-five-days-a-week/'>S&P 500 Weekly Options Now Expire Five Days a Week</a>
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

<p><code>Sources</code>:
<br>- <a href='https://www.prnewswire.com/news-releases/cboe-options-exchange-to-list-three-long-dated-spx-options-expirations-beginning-november-1-2021-301410178.html'>Cboe Options Exchange to List Three Long-Dated SPX Options Expirations, Beginning November 1, 2021</a>
<br>- <a href='https://www.prnewswire.com/news-releases/cboe-plans-to-list-spx-tuesday-thursday-expiring-weeklys-options-301474986.html'>Cboe Plans to List SPX Tuesday, Thursday-Expiring Weeklys Options</a>
<br>- <a href='https://www.indexologyblog.com/2022/05/12/sp-500-weekly-options-now-expire-five-days-a-week/'>S&P 500 Weekly Options Now Expire Five Days a Week</a>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p>The following table shows the accessor code you need to add some of the markets to your algorithm. The <code>CFTC.Markets</code> helper covers every market in the reports.</p>
<p>The <code>CFTC.Markets</code> helper covers every market in the reports. The following table shows the accessor code you need to add some of the markets to your algorithm:</p>

<table class="table qc-table">
<thead>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<p>The Commitments of Traders dataset enables you to follow how different types of traders are positioned in the futures markets. Examples include the following strategies:</p>

<ul>
<li>Trading with large speculators when their net position turns from short to long</li>
<li>Trading with non-commercial traders when their net position turns from short to long</li>
<li>Fading a market when speculator positioning reaches a multi-year extreme</li>
<li>Ranking commodities by the weekly change in speculator positions</li>
</ul>
<h4>Classic Algorithm Example</h4>
<p>The following example algorithm buys SPY when the non-commercial traders are net long the E-mini S&amp;P 500 in the Legacy report. When they are net short, it short sells SPY.</p>
<p>The following example algorithm buys SPY when non-commercial traders are net long the E-mini S&amp;P 500. When they are net short, it short sells SPY.</p>

<div class="section-example-container testable">
<pre class="python">from AlgorithmImports import *
Expand All @@ -32,7 +32,7 @@ <h4>Classic Algorithm Example</h4>
if net is None:
return

# Go long when the large speculators are net long the E-mini S&amp;P 500
# Go long when the non-commercial traders are net long the E-mini S&amp;P 500
if net &gt; 0:
self.set_holdings(self._spy, 1)

Expand Down Expand Up @@ -71,7 +71,7 @@ <h4>Classic Algorithm Example</h4>
return;
}

// Go long when the large speculators are net long the E-mini S&amp;P 500
// Go long when the non-commercial traders are net long the E-mini S&amp;P 500
if (net &gt; 0)
{
SetHoldings(_spy, 1);
Expand All @@ -86,7 +86,7 @@ <h4>Classic Algorithm Example</h4>
}</pre>
</div>
<h4>Framework Algorithm Example</h4>
<p>The following example algorithm buys SPY when the large speculators are net long the E-mini S&amp;P 500 futures. When they turn net short, it short sells SPY.</p>
<p>The following example algorithm buys SPY when non-commercial traders are net long the E-mini S&amp;P 500. When they are net short, it short sells SPY.</p>

<div class="section-example-container testable">
<pre class="python">from AlgorithmImports import *
Expand All @@ -100,7 +100,7 @@ <h4>Framework Algorithm Example</h4>
self.set_cash(100000)

self.universe_settings.resolution = Resolution.DAILY
# We trade SPY as the proxy of the E-mini S&amp;P 500 futures the report covers
# Trade SPY as the proxy of the E-mini S&amp;P 500 futures the report covers
symbols = [Symbol.create("SPY", SecurityType.EQUITY, Market.USA)]
self.add_universe_selection(ManualUniverseSelectionModel(symbols))
# A custom alpha model that emits trade insights based on CFTC positioning data
Expand Down Expand Up @@ -135,11 +135,11 @@ <h4>Framework Algorithm Example</h4>
insights = []

for symbol in self.tradable_symbols:
# Buy when the large speculators are net long
# Emit an up insight when the non-commercial traders are net long
if net &gt; 0:
insights += [Insight.price(symbol, timedelta(days=7), InsightDirection.UP)]

# Short sell when they are net short
# Emit a down insight when they are net short
elif net &lt; 0:
insights += [Insight.price(symbol, timedelta(days=7), InsightDirection.DOWN)]

Expand All @@ -157,7 +157,7 @@ <h4>Framework Algorithm Example</h4>
SetCash(100000);

UniverseSettings.Resolution = Resolution.Daily;
// We trade SPY as the proxy of the E-mini S&amp;P 500 futures the report covers
// Trade SPY as the proxy of the E-mini S&amp;P 500 futures the report covers
var symbols = new[] {QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA)};
AddUniverseSelection(new ManualUniverseSelectionModel(symbols));
// A custom alpha model that emits trade insights based on CFTC positioning data
Expand Down Expand Up @@ -203,13 +203,13 @@ <h4>Framework Algorithm Example</h4>

foreach (var symbol in tradableSymbols)
{
// Buy when the large speculators are net long
// Emit an up insight when the non-commercial traders are net long
if (net &gt; 0)
{
insights.Add(Insight.Price(symbol, TimeSpan.FromDays(7), InsightDirection.Up));
}

// Short sell when they are net short
// Emit a down insight when they are net short
if (net &lt; 0)
{
insights.Add(Insight.Price(symbol, TimeSpan.FromDays(7), InsightDirection.Down));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "landing",
"heading": "Energy Information Administration",
"subHeading": "",
"content": "<p>The U.S. Energy Information Administration (EIA) is the statistical agency of the US Department of Energy, created by Congress in 1977. It collects and publishes energy data that is independent of policy. Policymakers, markets and the public use its data to understand energy in the United States.</p>",
"content": "<p>The U.S. Energy Information Administration (EIA) is the statistical agency of the US Department of Energy, created by Congress in 1977. It collects and publishes energy data that is independent of policy. Policymakers, markets, and the public use its data to understand energy in the United States.</p>",
"alsoLinks": [],
"featureShortDescription": {}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<p>The U.S. Energy Information Administration (EIA) is the statistical agency of the US Department of Energy, created by Congress in 1977. It collects and publishes energy data that is independent of policy. Policymakers, markets and the public use its data to understand energy in the United States.</p>
<p>The U.S. Energy Information Administration (EIA) is the statistical agency of the US Department of Energy, created by Congress in 1977. It collects and publishes energy data that is independent of policy. Policymakers, markets, and the public use its data to understand energy in the United States.</p>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<table class="table qc-table"><thead><tr><th>Constant</th>
<th>Balancing Authority</th>
</tr></thead><tbody><tr><td><code>EIA.BalancingAuthorities.PJM</code></td>
<td>PJM Interconnection, the largest grid operator in the country</td>
<td>PJM Interconnection, the largest balancing authority in the country</td>
</tr><tr><td><code>EIA.BalancingAuthorities.ERCOT</code></td>
<td>Electric Reliability Council of Texas</td>
</tr><tr><td><code>EIA.BalancingAuthorities.CAISO</code></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ <h4>Classic Algorithm Example</h4>
}</pre>
</div>
<h4>Framework Algorithm Example</h4>
<p>The following example algorithm emits up insights for SPY when PJM demand runs more than 2% above the day-ahead forecast and down insights when it runs more than 2% below.</p>
<p>The following example algorithm emits up insights for SPY when PJM demand runs more than 2% above the day-ahead forecast. When demand runs more than 2% below the forecast, it emits down insights.</p>

<div class="section-example-container testable testable">
<pre class="python">from AlgorithmImports import *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "landing",
"heading": "European Central Bank",
"subHeading": "",
"content": "<p>The European Central Bank is the central bank of the euro area, established in 1998 and based in Frankfurt. Its main task is to keep prices stable in the countries that use the euro, and it sets the interest rates for the euro area. It also publishes statistics on the euro area economy and its financial markets.</p>",
"content": "<p>The European Central Bank is the central bank of the euro area, established in 1998 and based in Frankfurt. Its main task is to keep prices stable in the countries that use the euro, and it sets the interest rates for the euro area. It also publishes statistics on the euro area economy and its financial markets.</p>\n\n<p>Source: ECB statistics.</p>",
"alsoLinks": [],
"featureShortDescription": {}
}
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<p>The European Central Bank is the central bank of the euro area, established in 1998 and based in Frankfurt. Its main task is to keep prices stable in the countries that use the euro, and it sets the interest rates for the euro area. It also publishes statistics on the euro area economy and its financial markets.</p>
<p>The European Central Bank is the central bank of the euro area, established in 1998 and based in Frankfurt. Its main task is to keep prices stable in the countries that use the euro, and it sets the interest rates for the euro area. It also publishes statistics on the euro area economy and its financial markets.</p>

<p>Source: ECB statistics.</p>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</tr></thead><tbody><tr><td>Start Date</td>
<td>September 2004</td>
</tr><tr><td>Asset Coverage</td>
<td>6 yield curves</td>
<td>6 Yield Curves</td>
</tr><tr><td>Data Density</td>
<td>Sparse</td>
</tr><tr><td>Resolution</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<li>Comparing the euro area and US yield curves for cross-market positioning</li>
</ul>
<h4>Classic Algorithm Example</h4>
<p>The following example algorithm buys SPY when the 10-year rate of the all issuers spot curve is at most 60 basis points above the 10-year rate of the triple A spot curve. Otherwise, it holds cash.</p>
<p>The following example algorithm buys SPY when the all issuers 10-year spot rate is at most 60 basis points above the AAA rate. Otherwise, it holds cash.</p>

<div class="section-example-container testable">
<pre class="python">from AlgorithmImports import *
Expand Down Expand Up @@ -114,7 +114,7 @@ <h4>Classic Algorithm Example</h4>
}</pre>
</div>
<h4>Framework Algorithm Example</h4>
<p>The following example algorithm emits up insights for SPY when the 10-year rate of the triple A spot curve is above its 2-year rate. Otherwise, it emits flat insights.</p>
<p>The following example algorithm emits up insights for SPY when the 10-year rate of the AAA spot curve is above its 2-year rate. Otherwise, it emits flat insights.</p>

<div class="section-example-container testable">
<pre class="python">from AlgorithmImports import *
Expand Down Expand Up @@ -159,7 +159,7 @@ <h4>Framework Algorithm Example</h4>
if self._slope is None:
return []

# Go long while the curve slopes upward, and step aside once it inverts.
# Emit up insights while the curve slopes upward and flat insights otherwise.
direction = InsightDirection.UP if self._slope &gt; 0 else InsightDirection.FLAT

# Emit insights only for the securities that have a bar in this slice.
Expand Down Expand Up @@ -225,7 +225,7 @@ <h4>Framework Algorithm Example</h4>
return new List&lt;Insight&gt;();
}

// Go long while the curve slopes upward, and step aside once it inverts.
// Emit up insights while the curve slopes upward and flat insights otherwise.
var direction = _slope &gt; 0m ? InsightDirection.Up : InsightDirection.Flat;

// Emit insights only for the securities that have a bar in this slice.
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<p>The European Central Bank is the central bank of the euro area, established in 1998 and based in Frankfurt. Its main task is to keep prices stable in the countries that use the euro, and it sets the interest rates for the euro area. It also publishes statistics on the euro area economy and its financial markets.</p>
<p>The European Central Bank is the central bank of the euro area, established in 1998 and based in Frankfurt. Its main task is to keep prices stable in the countries that use the euro, and it sets the interest rates for the euro area. It also publishes statistics on the euro area economy and its financial markets.</p>

<p>Source: ECB statistics.</p>
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<th>Property</th>
<th>Coverage</th>
</tr></thead><tbody><tr><td>Main refinancing operations</td>
<td><code>MainRefinancingRate</code></td>
<td><code class="csharp">MainRefinancingRate</code><code class="python">main_refinancing_rate</code></td>
<td>January 1999 onward</td>
</tr><tr><td>Deposit facility</td>
<td><code>DepositFacilityRate</code></td>
<td><code class="csharp">DepositFacilityRate</code><code class="python">deposit_facility_rate</code></td>
<td>January 1999 onward</td>
</tr><tr><td>Marginal lending facility</td>
<td><code>MarginalLendingRate</code></td>
<td><code class="csharp">MarginalLendingRate</code><code class="python">marginal_lending_rate</code></td>
<td>January 1999 onward</td>
</tr><tr><td>Euro short-term rate</td>
<td><code>EuroShortTermRate</code></td>
<td><code class="csharp">EuroShortTermRate</code><code class="python">euro_short_term_rate</code></td>
<td>October 2019 onward</td>
</tr></tbody></table>
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ <h4>Framework Algorithm Example</h4>
if self._spread is None:
return []

# Go long while the gap is wide, and step aside once it closes.
# Emit up insights while the gap is wide and flat insights once it closes.
direction = InsightDirection.UP if self._spread &lt;= -0.05 else InsightDirection.FLAT

# Emit insights only for the securities that have a bar in this slice.
Expand Down Expand Up @@ -223,7 +223,7 @@ <h4>Framework Algorithm Example</h4>
return Enumerable.Empty&lt;Insight&gt;();
}

// Go long while the gap is wide, and step aside once it closes.
// Emit up insights while the gap is wide and flat insights once it closes.
var direction = _spread &lt;= -0.05m ? InsightDirection.Up : InsightDirection.Flat;

// Emit insights only for the securities that have a bar in this slice.
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<p>The European Central Bank is the central bank of the euro area, established in 1998 and based in Frankfurt. Its main task is to keep prices stable in the countries that use the euro, and it sets the interest rates for the euro area. It also publishes statistics on the euro area economy and its financial markets.</p>
<p>The European Central Bank is the central bank of the euro area, established in 1998 and based in Frankfurt. Its main task is to keep prices stable in the countries that use the euro, and it sets the interest rates for the euro area. It also publishes statistics on the euro area economy and its financial markets.</p>

<p>Source: ECB statistics.</p>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
</tr><tr><td>Data Density</td>
<td>Sparse</td>
</tr><tr><td>Resolution</td>
<td>Daily</td>
<td>Daily*</td>
</tr><tr><td>Timezone</td>
<td>Berlin</td>
</tr></tbody></table>
</tr></tbody></table>

<p>* Weekly data we fetch daily.</p>
Loading