Files
quantconnect--lean/Jupyter/BasicCSharpQuantBookTemplate.ipynb
2019-01-04 17:20:16 -08:00

86 lines
2.3 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![QuantConnect Logo](https://cdn.quantconnect.com/web/i/logo-small.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/Jupyter/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",
"using QuantConnect.Data.Custom;\n",
"using QuantConnect.Data.Market;\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);"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "C#",
"language": "csharp",
"name": "csharp"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}