Files
quantconnect--lean/Research/BasicCSharpQuantBookTemplate.ipynb
T
Martin-Molinero f3c386663b Feature .net 5 (#5505)
* Update projects to use .NET 5.0, the successor to .NET Core

* Fix ambiguous errors. Add IBAutomator net5

* Remove FXCM

* Upgrade IBAutomater to v1.0.51

ignored, and an empty message aborts the commit.

* Fix rebase

- Fix ambiguous Index
- Remove StrategyCapacity.cs
- Update System.Threading.Tasks.Extensionsy

* Remove unrequired references

* Fixes

- Travis will use dotnet, not nunit nor mono
- Remove mono from foundation image
- Fix python setup in research
- Fix unit tests

* Don't call ReadKey when input is redirected

* Fix ConsoleLeanOptimizer

* Research fixes

* Update comment

* Add vsdbg to Dockerfile

* Fixes

- Revert dockerfile FROM custom changes
- Adjust and fix regression algorithms
   - Option assignment will be deterministic in the order
   - 'Rolling Averaged Population' is calculated using doubles, updating
     expected values.
- Update readme, removing references to mono
- Add missing Py.Gil lock

* Replace ICSharp with .NET Interactive

* Fixes after rebase

* CSharp research fixes

- Adding new Initialize.csx that pre loads all assemblies
- Adjusting template research file
- Moving steps in dockerfilejupyter
- Fix unit tests and regression tests after rebase

Co-authored-by: Gerardo Salazar <gsalaz9800@gmail.com>
Co-authored-by: Stefano Raggi <stefano.raggi67@gmail.com>
Co-authored-by: Jasper van Merle <jaspervmerle@gmail.com>
2021-05-06 17:23:51 -03:00

95 lines
3.4 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![QuantConnect Logo](https://cdn.quantconnect.com/web/i/qc_notebook_logo_rev0.png)\n",
"## Welcome to The QuantConnect Research Page\n",
"#### Refer to this page for documentation https://www.quantconnect.com/docs#Introduction-to-Jupyter\n",
"#### Contribute to this template file https://github.com/QuantConnect/Lean/blob/master/Research/BasicCSharpQuantBookTemplate.ipynb"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## QuantBook Basics\n",
"\n",
"### Start QuantBook\n",
"- Load \"../QuantConnect.csx\" with all the basic imports\n",
"- Create a QuantBook instance"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// We need to load assemblies at the start in their own cell\n",
"#load \"../Initialize.csx\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#load \"../QuantConnect.csx\"\n",
"\n",
"using QuantConnect;\n",
"using QuantConnect.Data;\n",
"using QuantConnect.Research;\n",
"using QuantConnect.Algorithm;\n",
"\n",
"var qb = new QuantBook();\n",
"\n",
"// Selecting asset data\n",
"var spy = qb.AddEquity(\"SPY\");\n",
"var eur = qb.AddForex(\"EURUSD\");\n",
"var btc = qb.AddCrypto(\"BTCUSD\");\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Historical Data Requests\n",
"\n",
"We can use the QuantConnect API to make Historical Data Requests. The data will be presented as multi-index pandas.DataFrame where the first index is the Symbol.\n",
"\n",
"For more information, please follow the [link](https://www.quantconnect.com/docs#Historical-Data-Historical-Data-Requests)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// Gets historical data from the subscribed assets, the last 360 datapoints with daily resolution\n",
"var h1 = qb.History(qb.Securities.Keys, 360, Resolution.Daily);\n",
"Console.WriteLine(string.Join(\",\", h1.SelectMany(slice => slice.Keys).Distinct()))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "C#",
"language": "csharp",
"name": "csharp"
},
"language_info": {
"file_extension": ".cs",
"mimetype": "text/x-csharp",
"name": "C#",
"pygments_lexer": "c#",
"version": "4.0.30319"
}
},
"nbformat": 4,
"nbformat_minor": 2
}