GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Added tags to some C# algorithms · nuswgg/Lean@4ebc44d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Algorithm.CSharp
    • AddRemoveSecurityRegressionAlgorithm.cs
    • BasicTemplateAlgorithm.cs
    • BasicTemplateDailyAlgorithm.cs
    • BasicTemplateFillForwardAlgorithm.cs
    • BasicTemplateForexAlgorithm.cs
    • BasicTemplateFuturesAlgorithm.cs
    • BasicTemplateFuturesConsolidationAlgorithm.cs
    • BasicTemplateFuturesHistoryAlgorithm.cs
    • BasicTemplateFxcmVolumeAlgorithm.cs
    • BasicTemplateMultiAssetAlgorithm.cs
    • BasicTemplateOptionsAlgorithm.cs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Algorithm.CSharp/AddRemoveSecurityRegressionAlgorithm.cs‎

Copy file name to clipboardExpand all lines: Algorithm.CSharp/AddRemoveSecurityRegressionAlgorithm.cs
+14-10Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
22
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
33
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
77
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8-
*
8+
*
99
* Unless required by applicable law or agreed to in writing, software
1010
* distributed under the License is distributed on an "AS IS" BASIS,
1111
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -14,16 +14,18 @@
1414
*/
1515

1616
using System;
17-
using QuantConnect.Data;
1817
using QuantConnect.Data.Market;
19-
using QuantConnect.Data.UniverseSelection;
2018
using QuantConnect.Orders;
2119

2220
namespace QuantConnect.Algorithm.CSharp
2321
{
2422
/// <summary>
25-
/// Basic template algorithm simply initializes the date range and cash
23+
/// This algorithm demonstrates the runtime addition and removal of securities from your algorithm.
24+
/// With LEAN it is possible to add and remove securities after the initialization.
2625
/// </summary>
26+
/// <meta name="tag" content="using data" />
27+
/// <meta name="tag" content="assets" />
28+
/// <meta name="tag" content="regression test" />
2729
public class AddRemoveSecurityRegressionAlgorithm : QCAlgorithm
2830
{
2931
private DateTime lastAction;
@@ -40,8 +42,6 @@ public override void Initialize()
4042
SetStartDate(2013, 10, 07); //Set Start Date
4143
SetEndDate(2013, 10, 11); //Set End Date
4244
SetCash(100000); //Set Strategy Cash
43-
// Find more symbols here: http://quantconnect.com/data
44-
4545
AddSecurity(SecurityType.Equity, "SPY");
4646
}
4747

@@ -78,15 +78,19 @@ public void OnData(TradeBars data)
7878
}
7979
}
8080

81+
/// <summary>
82+
/// Order events are triggered on order status changes. There are many order events including non-fill messages.
83+
/// </summary>
84+
/// <param name="orderEvent">OrderEvent object with details about the order status</param>
8185
public override void OnOrderEvent(OrderEvent orderEvent)
8286
{
8387
if (orderEvent.Status == OrderStatus.Submitted)
8488
{
85-
Console.WriteLine(Time + ": Submitted: " + Transactions.GetOrderById(orderEvent.OrderId));
89+
Debug(Time + ": Submitted: " + Transactions.GetOrderById(orderEvent.OrderId));
8690
}
8791
if (orderEvent.Status.IsFill())
8892
{
89-
Console.WriteLine(Time + ": Filled: " + Transactions.GetOrderById(orderEvent.OrderId));
93+
Debug(Time + ": Filled: " + Transactions.GetOrderById(orderEvent.OrderId));
9094
}
9195
}
9296
}
Collapse file

‎Algorithm.CSharp/BasicTemplateAlgorithm.cs‎

Copy file name to clipboardExpand all lines: Algorithm.CSharp/BasicTemplateAlgorithm.cs
+18-8Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
22
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
33
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
77
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8-
*
8+
*
99
* Unless required by applicable law or agreed to in writing, software
1010
* distributed under the License is distributed on an "AS IS" BASIS,
1111
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,12 +18,15 @@
1818
namespace QuantConnect.Algorithm.CSharp
1919
{
2020
/// <summary>
21-
/// Basic template algorithm simply initializes the date range and cash
21+
/// Basic template algorithm simply initializes the date range and cash. This is a skeleton
22+
/// framework you can use for designing an algorithm.
2223
/// </summary>
24+
/// <meta name="tag" content="using data" />
25+
/// <meta name="tag" content="using quantconnect" />
26+
/// <meta name="tag" content="trading and orders" />
27+
/// <meta name="tag" content="regression test" />
2328
public class BasicTemplateAlgorithm : QCAlgorithm
2429
{
25-
private Symbol _spy = QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA);
26-
2730
/// <summary>
2831
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
2932
/// </summary>
@@ -32,8 +35,15 @@ public override void Initialize()
3235
SetStartDate(2013, 10, 07); //Set Start Date
3336
SetEndDate(2013, 10, 11); //Set End Date
3437
SetCash(100000); //Set Strategy Cash
38+
3539
// Find more symbols here: http://quantconnect.com/data
36-
AddEquity("SPY", Resolution.Second);
40+
// Forex, CFD, Equities Resolutions: Tick, Second, Minute, Hour, Daily.
41+
// Futures Resolution: Tick, Second, Minute
42+
// Options Resolution: Minute Only.
43+
AddEquity("SPY", Resolution.Minute);
44+
45+
// There are other assets with similar methods. See "Selecting Options" etc for more details.
46+
// AddFuture, AddForex, AddCfd, AddOption
3747
}
3848

3949
/// <summary>
@@ -44,7 +54,7 @@ public override void OnData(Slice data)
4454
{
4555
if (!Portfolio.Invested)
4656
{
47-
SetHoldings(_spy, 1);
57+
SetHoldings("SPY", 1);
4858
Debug("Purchased Stock");
4959
}
5060
}
Collapse file

‎Algorithm.CSharp/BasicTemplateDailyAlgorithm.cs‎

Copy file name to clipboardExpand all lines: Algorithm.CSharp/BasicTemplateDailyAlgorithm.cs
+8-7Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
22
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
33
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
77
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8-
*
8+
*
99
* Unless required by applicable law or agreed to in writing, software
1010
* distributed under the License is distributed on an "AS IS" BASIS,
1111
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,12 +18,13 @@
1818
namespace QuantConnect.Algorithm.CSharp
1919
{
2020
/// <summary>
21-
/// Basic template algorithm simply initializes the date range and cash
21+
/// Demonstration of requesting daily resolution data for US Equities.
22+
/// This is a simple regression test algorithm using a skeleton algorithm and requesting daily data.
2223
/// </summary>
24+
/// <meta name="tag" content="using data" />
25+
/// <meta name="tag" content="regression test" />
2326
public class BasicTemplateDailyAlgorithm : QCAlgorithm
2427
{
25-
private Symbol _spy = QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA);
26-
2728
/// <summary>
2829
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
2930
/// </summary>
@@ -44,7 +45,7 @@ public override void OnData(Slice data)
4445
{
4546
if (!Portfolio.Invested)
4647
{
47-
SetHoldings(_spy, 1);
48+
SetHoldings("SPY", 1);
4849
Debug("Purchased Stock");
4950
}
5051
}
Collapse file

‎Algorithm.CSharp/BasicTemplateFillForwardAlgorithm.cs‎

Copy file name to clipboardExpand all lines: Algorithm.CSharp/BasicTemplateFillForwardAlgorithm.cs
+8-7Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
22
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
33
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
77
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8-
*
8+
*
99
* Unless required by applicable law or agreed to in writing, software
1010
* distributed under the License is distributed on an "AS IS" BASIS,
1111
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,12 +18,13 @@
1818
namespace QuantConnect.Algorithm.Examples
1919
{
2020
/// <summary>
21-
/// Basic template algorithm simply initializes the date range and cash
21+
/// Skeleton algorithm demonstrating filling forward data through gaps and inconsistent data. By default LEAN fills the previous bar forward
22+
/// so you get regular bars.
2223
/// </summary>
24+
/// <meta name="tag" content="using data" />
25+
/// <meta name="tag" content="regression test" />
2326
public class BasicTemplateFillForwardAlgorithm : QCAlgorithm
2427
{
25-
private Symbol _asur = QuantConnect.Symbol.Create("ASUR", SecurityType.Equity, Market.USA);
26-
2728
/// <summary>
2829
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
2930
/// </summary>
@@ -44,7 +45,7 @@ public void OnData(TradeBars data)
4445
{
4546
if (!Portfolio.Invested)
4647
{
47-
SetHoldings(_asur, 1);
48+
SetHoldings("ASUR", 1);
4849
Debug("Purchased Stock");
4950
}
5051
}
Collapse file

‎Algorithm.CSharp/BasicTemplateForexAlgorithm.cs‎

Copy file name to clipboardExpand all lines: Algorithm.CSharp/BasicTemplateForexAlgorithm.cs
+12-7Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
22
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
33
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
77
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8-
*
8+
*
99
* Unless required by applicable law or agreed to in writing, software
1010
* distributed under the License is distributed on an "AS IS" BASIS,
1111
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,8 +19,13 @@
1919
namespace QuantConnect.Algorithm.CSharp
2020
{
2121
/// <summary>
22-
/// Basic template algorithm simply initializes the date range and cash
22+
/// Algorithm demonstrating FOREX asset types and requesting history on them in bulk. As FOREX uses
23+
/// QuoteBars you should request slices or
2324
/// </summary>
25+
/// <meta name="tag" content="using data" />
26+
/// <meta name="tag" content="history and warm up" />
27+
/// <meta name="tag" content="history" />
28+
/// <meta name="tag" content="forex" />
2429
public class BasicTemplateForexAlgorithm : QCAlgorithm
2530
{
2631
/// <summary>
@@ -32,9 +37,9 @@ public override void Initialize()
3237
SetEndDate(2013, 10, 11); //Set End Date
3338
SetCash(100000); //Set Strategy Cash
3439
// Find more symbols here: http://quantconnect.com/data
35-
AddForex("EURUSD", Resolution.Minute);
36-
AddForex("GBPUSD", Resolution.Minute);
37-
AddForex("EURGBP", Resolution.Minute);
40+
AddForex("EURUSD");
41+
AddForex("GBPUSD");
42+
AddForex("EURGBP");
3843

3944
History(5, Resolution.Daily);
4045
History(5, Resolution.Hour);
Collapse file

‎Algorithm.CSharp/BasicTemplateFuturesAlgorithm.cs‎

Copy file name to clipboardExpand all lines: Algorithm.CSharp/BasicTemplateFuturesAlgorithm.cs
+12-7Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
22
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
33
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
77
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8-
*
8+
*
99
* Unless required by applicable law or agreed to in writing, software
1010
* distributed under the License is distributed on an "AS IS" BASIS,
1111
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,17 +17,19 @@
1717
using System;
1818
using System.Linq;
1919
using QuantConnect.Data;
20-
using QuantConnect.Data.Market;
2120
using QuantConnect.Orders;
2221
using QuantConnect.Securities;
2322

2423
namespace QuantConnect.Algorithm.CSharp
2524
{
2625
/// <summary>
27-
/// This example demonstrates how to add futures for a given underlying.
28-
/// It also shows how you can prefilter contracts easily based on expirations.
29-
/// It also shows how you can inspect the futures chain to pick a specific contract to trade.
26+
/// This example demonstrates how to add futures for a given underlying asset.
27+
/// It also shows how you can prefilter contracts easily based on expirations, and how you
28+
/// can inspect the futures chain to pick a specific contract to trade.
3029
/// </summary>
30+
/// <meta name="tag" content="using data" />
31+
/// <meta name="tag" content="benchmarks" />
32+
/// <meta name="tag" content="futures" />
3133
public class BasicTemplateFuturesAlgorithm : QCAlgorithm
3234
{
3335
// S&P 500 EMini futures
@@ -38,6 +40,9 @@ public class BasicTemplateFuturesAlgorithm : QCAlgorithm
3840
private const string RootGold = Futures.Metals.Gold;
3941
public Symbol Gold = QuantConnect.Symbol.Create(RootGold, SecurityType.Future, Market.USA);
4042

43+
/// <summary>
44+
/// Initialize your algorithm and add desired assets.
45+
/// </summary>
4146
public override void Initialize()
4247
{
4348
SetStartDate(2013, 10, 07);
Collapse file

‎Algorithm.CSharp/BasicTemplateFuturesConsolidationAlgorithm.cs‎

Copy file name to clipboardExpand all lines: Algorithm.CSharp/BasicTemplateFuturesConsolidationAlgorithm.cs
+10-3Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
22
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
33
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
77
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8-
*
8+
*
99
* Unless required by applicable law or agreed to in writing, software
1010
* distributed under the License is distributed on an "AS IS" BASIS,
1111
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,6 +23,13 @@
2323

2424
namespace QuantConnect.Algorithm.CSharp
2525
{
26+
/// <summary>
27+
/// A demonstration of consolidating futures data into larger bars for your algorithm.
28+
/// </summary>
29+
/// <meta name="tag" content="using data" />
30+
/// <meta name="tag" content="benchmarks" />
31+
/// <meta name="tag" content="consolidating data" />
32+
/// <meta name="tag" content="futures" />
2633
public class BasicTemplateFuturesConsolidationAlgorithm : QCAlgorithm
2734
{
2835
private const string RootSP500 = Futures.Indices.SP500EMini;
Collapse file

‎Algorithm.CSharp/BasicTemplateFuturesHistoryAlgorithm.cs‎

Copy file name to clipboardExpand all lines: Algorithm.CSharp/BasicTemplateFuturesHistoryAlgorithm.cs
+9-6Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
22
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
33
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4-
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
77
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8-
*
8+
*
99
* Unless required by applicable law or agreed to in writing, software
1010
* distributed under the License is distributed on an "AS IS" BASIS,
1111
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
1717
using System;
1818
using System.Linq;
1919
using QuantConnect.Data;
20-
using QuantConnect.Data.Market;
2120
using QuantConnect.Orders;
2221
using QuantConnect.Securities;
2322
using QuantConnect.Data.UniverseSelection;
@@ -26,9 +25,13 @@ namespace QuantConnect.Algorithm.CSharp
2625
{
2726
/// <summary>
2827
/// This example demonstrates how to get access to futures history for a given root symbol.
29-
/// It also shows how you can prefilter contracts easily based on expirations.
30-
/// It also shows how you can inspect the futures chain to pick a specific contract to trade.
28+
/// It also shows how you can prefilter contracts easily based on expirations, and inspect the futures
29+
/// chain to pick a specific contract to trade.
3130
/// </summary>
31+
/// <meta name="tag" content="using data" />
32+
/// <meta name="tag" content="history and warm up" />
33+
/// <meta name="tag" content="history" />
34+
/// <meta name="tag" content="futures" />
3235
public class BasicTemplateFuturesHistoryAlgorithm : QCAlgorithm
3336
{
3437
// S&P 500 EMini futures

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.