8a63a1ac32
- Rename Jupyter to Research and add it's nuget package
80 lines
2.3 KiB
Plaintext
80 lines
2.3 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"\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": [
|
|
"#load \"QuantConnect.csx\"\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",
|
|
"var fxv = qb.AddData<FxcmVolume>(\"EURUSD_Vol\", Resolution.Hour);"
|
|
]
|
|
},
|
|
{
|
|
"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
|
|
}
|