├── .qrignore ├── README.md ├── .quantrocket └── quickstart │ ├── editor_demo.py │ ├── Code-Editor.ipynb │ ├── Clone-Intro.ipynb │ ├── Activate.ipynb │ ├── CLI-Intro.ipynb │ ├── Logging-Intro.ipynb │ ├── Python-Intro.ipynb │ └── QuickStart.ipynb └── LICENSE.txt /.qrignore: -------------------------------------------------------------------------------- 1 | README.md 2 | LICENSE.txt 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # quickstart 2 | 3 | Quickstart notebooks for QuantRocket. 4 | 5 | ## Clone in QuantRocket 6 | 7 | CLI: 8 | 9 | ```shell 10 | quantrocket codeload clone 'quickstart' 11 | ``` 12 | 13 | Python: 14 | 15 | ```python 16 | from quantrocket.codeload import clone 17 | clone("quickstart") 18 | ``` 19 | 20 | ## Browse in GitHub 21 | 22 | Start here: [QuickStart.ipynb](.quantrocket/quickstart/QuickStart.ipynb) 23 | 24 | *** 25 | 26 | Find more code in QuantRocket's [Code Library](https://www.quantrocket.com/code/) 27 | -------------------------------------------------------------------------------- /.quantrocket/quickstart/editor_demo.py: -------------------------------------------------------------------------------- 1 | # JupyterLab Code Editor Demonstration 2 | 3 | ######################### 4 | # 1. Inline Documentation 5 | ######################### 6 | 7 | # Click on factors and press Control to see a list of 8 | # available pipeline factors 9 | from zipline.pipeline.factors import AverageDollarVolume 10 | 11 | # click on AverageDollarVolume and press Control to see 12 | # its docstring 13 | avg_dollar_volume = AverageDollarVolume(window_length=30) 14 | 15 | ################## 16 | # 2. Auto-complete 17 | ################## 18 | 19 | # The following line uses the top() method to select the 20 | # top 10 stocks by dollar volume 21 | most_actives = avg_dollar_volume.top(10) 22 | 23 | # to demonstrate auto-complete, finish the following line 24 | # as shown below: 25 | 26 | # least_actives = avg_dollar_volume.bottom(10) 27 | least_actives = 28 | 29 | ###################### 30 | # 3. Diagnostics Panel 31 | ###################### 32 | 33 | # The following line contains an error; right-click 34 | # on any text in the editor and click Show Diagnostics Panel 35 | # to see a list of all detected errors (Note: the Diagnostics 36 | # Panel is also available in notebooks) 37 | pct_change = opens.pct_change() 38 | -------------------------------------------------------------------------------- /.quantrocket/quickstart/Code-Editor.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\"QuantRocket" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "# Code Editor\n", 15 | "*Intelligent code editing with JupyterLab*" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "Generally, the recommended workflow in QuantRocket is to spend most of your time in Jupyter notebooks, where you can develop your code interactively. Later, you can transfer the code as needed to `.py` files for running Zipline or Moonshot backtests or custom scripts. You can edit `.py` files in JupyterLab's code editor. Although you can't execute code interactively in the code editor the way you can in a notebook, the editor is equipped with the same auto-complete and inline documentation features that are available in notebooks. There is also a diagnostics panel that can highlight basic problems such as mistyped variable names, allowing you to detect and fix issues before running your code. \n", 23 | "\n", 24 | "To see a basic demo of the code editor using the Pipeline API, click on [editor_demo.py](editor_demo.py)." 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "***\n", 32 | "\n", 33 | "[Back to QuickStart](QuickStart.ipynb)" 34 | ] 35 | } 36 | ], 37 | "metadata": { 38 | "kernelspec": { 39 | "display_name": "Python 3.9", 40 | "language": "python", 41 | "name": "python3" 42 | }, 43 | "language_info": { 44 | "codemirror_mode": { 45 | "name": "ipython", 46 | "version": 3 47 | }, 48 | "file_extension": ".py", 49 | "mimetype": "text/x-python", 50 | "name": "python", 51 | "nbconvert_exporter": "python", 52 | "pygments_lexer": "ipython3", 53 | "version": "3.9.12" 54 | } 55 | }, 56 | "nbformat": 4, 57 | "nbformat_minor": 4 58 | } 59 | -------------------------------------------------------------------------------- /.quantrocket/quickstart/Clone-Intro.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\"QuantRocket" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "# Clone Sample Code\n", 15 | "\n", 16 | "*Get some code into your deployment*" 17 | ] 18 | }, 19 | { 20 | "cell_type": "markdown", 21 | "metadata": {}, 22 | "source": [ 23 | "QuantRocket provides access to a library of sample code, notebooks, and tutorials hosted on GitHub that you can clone into your deployment. As a basic demonstration, we'll clone the hello-jupyter package, which provides a single, simple demo notebook." 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 1, 29 | "metadata": {}, 30 | "outputs": [ 31 | { 32 | "data": { 33 | "text/plain": [ 34 | "{'status': 'successfully cloned hello-jupyter',\n", 35 | " 'files': {'added': ['Hello-Jupyter.ipynb']}}" 36 | ] 37 | }, 38 | "execution_count": 1, 39 | "metadata": {}, 40 | "output_type": "execute_result" 41 | } 42 | ], 43 | "source": [ 44 | "from quantrocket.codeload import clone\n", 45 | "clone('hello-jupyter')" 46 | ] 47 | }, 48 | { 49 | "cell_type": "markdown", 50 | "metadata": {}, 51 | "source": [ 52 | "The function output shows what files were downloaded. Feel free to open the downloaded notebook and have a look." 53 | ] 54 | }, 55 | { 56 | "cell_type": "markdown", 57 | "metadata": {}, 58 | "source": [ 59 | "You can also clone your own repositories or other non-QuantRocket repositories. Click on the `clone` function above and press Control to see examples." 60 | ] 61 | }, 62 | { 63 | "cell_type": "markdown", 64 | "metadata": {}, 65 | "source": [ 66 | "***\n", 67 | "\n", 68 | "## *Next Up*\n", 69 | "\n", 70 | "[Code Editor](Code-Editor.ipynb) - Intro to the JupyterLab Code Editor" 71 | ] 72 | } 73 | ], 74 | "metadata": { 75 | "kernelspec": { 76 | "display_name": "Python 3.9", 77 | "language": "python", 78 | "name": "python3" 79 | }, 80 | "language_info": { 81 | "codemirror_mode": { 82 | "name": "ipython", 83 | "version": 3 84 | }, 85 | "file_extension": ".py", 86 | "mimetype": "text/x-python", 87 | "name": "python", 88 | "nbconvert_exporter": "python", 89 | "pygments_lexer": "ipython3", 90 | "version": "3.9.12" 91 | } 92 | }, 93 | "nbformat": 4, 94 | "nbformat_minor": 4 95 | } 96 | -------------------------------------------------------------------------------- /.quantrocket/quickstart/Activate.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\"QuantRocket" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "# License Key Activation\n", 15 | "\n", 16 | "To activate QuantRocket, visit your account page to obtain your license key. Then, enter it using the Python function below:" 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": 1, 22 | "metadata": {}, 23 | "outputs": [], 24 | "source": [ 25 | "from quantrocket.license import set_license" 26 | ] 27 | }, 28 | { 29 | "cell_type": "code", 30 | "execution_count": null, 31 | "metadata": {}, 32 | "outputs": [], 33 | "source": [ 34 | "set_license(\"XXXXXXXXXXXXXXXXX\")" 35 | ] 36 | }, 37 | { 38 | "cell_type": "markdown", 39 | "metadata": {}, 40 | "source": [ 41 | "## Refreshing your license after subscription changes\n", 42 | "\n", 43 | "Your deployment will re-query your subscriptions and permissions every 10 minutes. If you make a change to your billing plan and want your deployment to see the change immediately, you can force a refresh using this:" 44 | ] 45 | }, 46 | { 47 | "cell_type": "code", 48 | "execution_count": null, 49 | "metadata": {}, 50 | "outputs": [], 51 | "source": [ 52 | "from quantrocket.license import get_license_profile\n", 53 | "get_license_profile(force_refresh=True)" 54 | ] 55 | }, 56 | { 57 | "cell_type": "markdown", 58 | "metadata": {}, 59 | "source": [ 60 | "Or in the terminal:" 61 | ] 62 | }, 63 | { 64 | "cell_type": "code", 65 | "execution_count": null, 66 | "metadata": {}, 67 | "outputs": [], 68 | "source": [ 69 | "!quantrocket license get --force-refresh" 70 | ] 71 | }, 72 | { 73 | "cell_type": "markdown", 74 | "metadata": {}, 75 | "source": [ 76 | "***\n", 77 | "\n", 78 | "[Back to QuickStart](QuickStart.ipynb)" 79 | ] 80 | } 81 | ], 82 | "metadata": { 83 | "kernelspec": { 84 | "display_name": "Python 3.9", 85 | "language": "python", 86 | "name": "python3" 87 | }, 88 | "language_info": { 89 | "codemirror_mode": { 90 | "name": "ipython", 91 | "version": 3 92 | }, 93 | "file_extension": ".py", 94 | "mimetype": "text/x-python", 95 | "name": "python", 96 | "nbconvert_exporter": "python", 97 | "pygments_lexer": "ipython3", 98 | "version": "3.9.12" 99 | } 100 | }, 101 | "nbformat": 4, 102 | "nbformat_minor": 4 103 | } 104 | -------------------------------------------------------------------------------- /.quantrocket/quickstart/CLI-Intro.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\"QuantRocket" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "# CLI First Steps\n", 15 | "\n", 16 | "*Get to know the command line interface*" 17 | ] 18 | }, 19 | { 20 | "cell_type": "markdown", 21 | "metadata": {}, 22 | "source": [ 23 | "To access the command line interface, open a Terminal from the JupyterLab Launcher (or from File > New > Terminal).\n", 24 | "\n", 25 | "\n", 26 | "\n", 27 | "> Tip: You can drag the terminal window to dock it beside or below this notebook so that you can view both. \n", 28 | "\n", 29 | "You can find your way through the command line interface (CLI) by making use of the `-h/--help` option with any command or subcommand. Try typing the following commands:\n", 30 | "\n", 31 | "```\n", 32 | "quantrocket -h\n", 33 | "quantrocket master -h\n", 34 | "quantrocket master calendar -h\n", 35 | "```\n", 36 | "\n", 37 | "Now run a command. You can run the command which corresponds to the Python function you ran a moment ago:\n", 38 | "\n", 39 | "```shell\n", 40 | "quantrocket master calendar 'XNYS'\n", 41 | "```\n", 42 | "\n", 43 | "Try it again with some options:\n", 44 | "\n", 45 | "```shell\n", 46 | "quantrocket master calendar 'XNYS' --ago '4h'\n", 47 | "```\n", 48 | "\n", 49 | "*(Placing quotes around options as shown above ('XNYS') is only required if the values contain spaces or special characters. However, quotes are used in the documentation to improve readability even when they aren't required.)*\n" 50 | ] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "## Using the Terminal directly from Notebooks\n", 57 | "\n", 58 | "The best way to use the CLI is to open a Terminal, but you can also execute terminal commands directly from within notebooks by prefixing the line with an exclamation point (`!`). You'll see this syntax used sometimes in QuantRocket demo notebooks where the CLI seems more natural than the Python API.\n", 59 | "\n", 60 | "Execute the following cell to see this in action:" 61 | ] 62 | }, 63 | { 64 | "cell_type": "code", 65 | "execution_count": 1, 66 | "metadata": {}, 67 | "outputs": [ 68 | { 69 | "name": "stdout", 70 | "output_type": "stream", 71 | "text": [ 72 | "XNYS:\n", 73 | " since: '2020-04-24T16:00:00'\n", 74 | " status: closed\n", 75 | " timezone: America/New_York\n", 76 | " until: '2020-04-27T09:30:00'\n" 77 | ] 78 | } 79 | ], 80 | "source": [ 81 | "!quantrocket master calendar 'XNYS' --in '1d'" 82 | ] 83 | }, 84 | { 85 | "cell_type": "markdown", 86 | "metadata": {}, 87 | "source": [ 88 | "***\n", 89 | "\n", 90 | "## *Next Up*\n", 91 | "\n", 92 | "[Logging first steps](Logging-Intro.ipynb) - Learn how logging works in QuantRocket" 93 | ] 94 | } 95 | ], 96 | "metadata": { 97 | "kernelspec": { 98 | "display_name": "Python 3.9", 99 | "language": "python", 100 | "name": "python3" 101 | }, 102 | "language_info": { 103 | "codemirror_mode": { 104 | "name": "ipython", 105 | "version": 3 106 | }, 107 | "file_extension": ".py", 108 | "mimetype": "text/x-python", 109 | "name": "python", 110 | "nbconvert_exporter": "python", 111 | "pygments_lexer": "ipython3", 112 | "version": "3.9.12" 113 | } 114 | }, 115 | "nbformat": 4, 116 | "nbformat_minor": 4 117 | } 118 | -------------------------------------------------------------------------------- /.quantrocket/quickstart/Logging-Intro.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\"QuantRocket" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "# Logging First Steps\n", 15 | "\n", 16 | "*Learn how logging works in QuantRocket*" 17 | ] 18 | }, 19 | { 20 | "cell_type": "markdown", 21 | "metadata": {}, 22 | "source": [ 23 | "Many QuantRocket tasks run in the background and emit log messages to keep you informed about what they're doing. Log messages are handled by the `flightlog` service. The `flightlog` service provides two levels of logging: higher-level summary log messages and lower-level, detailed logs.\n", 24 | "\n", 25 | "You can use JupyterLab terminals to monitor the log messages. Because the logs are an important source of feedback, it's a good idea to open two terminals each time you use QuantRocket, one for the standard logs and one for the detailed logs. There is a Flightlog button on the Launcher menu to make this easier. The button simply opens two terminals and automatically types the command to stream the logs (`quantrocket flightlog stream` and `quantrocket flightlog stream --detail`, respectively). You can then drag the terminals to a convenient place in your JupyterLab work area.\n", 26 | "\n", 27 | "\n" 28 | ] 29 | }, 30 | { 31 | "cell_type": "markdown", 32 | "metadata": {}, 33 | "source": [ 34 | "The terminal will wait for log messages and display them as they arrive. Since nothing much is happening yet, you can emit your own log message for testing. Back in Terminal 1, type:\n", 35 | "\n", 36 | "```shell\n", 37 | "quantrocket flightlog log 'this is a test'\n", 38 | "```\n", 39 | "\n", 40 | "In Terminal 2, you'll see the test message appear:\n", 41 | "\n", 42 | "```\n", 43 | "quantrocket.cli: INFO this is a test\n", 44 | "```\n", 45 | "\n", 46 | "Log messages have different severity levels. This time, in Terminal 1, log a warning:\n", 47 | "\n", 48 | "```shell\n", 49 | "quantrocket flightlog log 'this is a warning' --level 'WARNING'\n", 50 | "```\n", 51 | "\n", 52 | "In Terminal 2, you'll see the warning message:\n", 53 | "\n", 54 | "```\n", 55 | "quantrocket.cli: WARNING this is a warning\n", 56 | "```\n", 57 | "\n", 58 | "Meanwhile, detailed messages may have already begun to appear in Terminal 3. For demonstration purposes, we can trigger a detailed message by pinging `houston`, QuantRocket's API gateway. In Terminal 1, type:\n", 59 | "\n", 60 | "```shell\n", 61 | "quantrocket houston ping\n", 62 | "```\n", 63 | "\n", 64 | "No new log messages will appear in Terminal 2 (high-level logs) because the `ping` command doesn't emit any log messages, but in Terminal 3 (detailed logs) you'll see a line of output logging the `ping` HTTP request (possibly mixed in with lots of other log output):\n", 65 | "\n", 66 | "```\n", 67 | "quantrocket_houston_1|172.22.0.17 - - [23/Apr/2020:20:16:08 +0000] \"GET /ping HTTP/1.1\" 200 30 \"-\" \"-\"\n", 68 | "```\n", 69 | "\n", 70 | "Monitoring both the standard logs and detailed logs is a great way to learn more about how QuantRocket works and what it's doing." 71 | ] 72 | }, 73 | { 74 | "cell_type": "markdown", 75 | "metadata": {}, 76 | "source": [ 77 | "***\n", 78 | "\n", 79 | "## *Next Up*\n", 80 | "\n", 81 | "[Clone sample code](Clone-Intro.ipynb) - Get some code into your deployment" 82 | ] 83 | } 84 | ], 85 | "metadata": { 86 | "kernelspec": { 87 | "display_name": "Python 3.9", 88 | "language": "python", 89 | "name": "python3" 90 | }, 91 | "language_info": { 92 | "codemirror_mode": { 93 | "name": "ipython", 94 | "version": 3 95 | }, 96 | "file_extension": ".py", 97 | "mimetype": "text/x-python", 98 | "name": "python", 99 | "nbconvert_exporter": "python", 100 | "pygments_lexer": "ipython3", 101 | "version": "3.9.12" 102 | } 103 | }, 104 | "nbformat": 4, 105 | "nbformat_minor": 4 106 | } 107 | -------------------------------------------------------------------------------- /.quantrocket/quickstart/Python-Intro.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\"QuantRocket" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "# Python API First Steps\n", 15 | "\n", 16 | "*Introduction to QuantRocket's Python API*\n", 17 | "\n", 18 | "QuantRocket provides both a Python API and a command line interface (CLI) for controlling your deployment. The CLI calls the Python interface, so the two provide similar functionality, but using one or the other may feel more intuitive depending on the particular task.\n", 19 | "\n", 20 | "***" 21 | ] 22 | }, 23 | { 24 | "cell_type": "markdown", 25 | "metadata": {}, 26 | "source": [ 27 | "To demonstrate the use of QuantRocket's Python API, we'll look at a function that checks if exchanges are open. In addition to QuantRocket's online documentation, you can view documentation for any QuantRocket-maintained package within JupyterLab by clicking on the module or function name and pressing the Control key. Try it with each name in the import statement that follows:" 28 | ] 29 | }, 30 | { 31 | "cell_type": "code", 32 | "execution_count": 1, 33 | "metadata": {}, 34 | "outputs": [], 35 | "source": [ 36 | "from quantrocket.master import list_calendar_statuses" 37 | ] 38 | }, 39 | { 40 | "cell_type": "markdown", 41 | "metadata": {}, 42 | "source": [ 43 | "* If you click on `quantrocket` and press Control, you see the list of available modules within the `quantrocket` package.\n", 44 | "* If you click on `master` and press Control, you see the list of available functions within the `quantrocket.master` module.\n", 45 | "* If you click on `list_calendar_statuses` and press Control, you see the docstring for this particular function.\n", 46 | "\n", 47 | "Next, execute the above cell by clicking SHIFT+ENTER (or clicking the Run icon on the menu above) to import the function." 48 | ] 49 | }, 50 | { 51 | "cell_type": "markdown", 52 | "metadata": {}, 53 | "source": [ 54 | "Now actually run the function to check if the New York Stock Exchange is open (the MIC, or market identifier code, for this exchange is `XNYS`):" 55 | ] 56 | }, 57 | { 58 | "cell_type": "code", 59 | "execution_count": 2, 60 | "metadata": {}, 61 | "outputs": [ 62 | { 63 | "data": { 64 | "text/plain": [ 65 | "{'XNYS': {'status': 'closed',\n", 66 | " 'since': '2023-03-10T16:00:00',\n", 67 | " 'until': '2023-03-13T09:30:00',\n", 68 | " 'timezone': 'America/New_York'}}" 69 | ] 70 | }, 71 | "execution_count": 2, 72 | "metadata": {}, 73 | "output_type": "execute_result" 74 | } 75 | ], 76 | "source": [ 77 | "list_calendar_statuses(exchanges=\"XNYS\")" 78 | ] 79 | }, 80 | { 81 | "cell_type": "markdown", 82 | "metadata": {}, 83 | "source": [ 84 | "Jupyter notebooks provide autocomplete, which you can use to help you find functions whose names you don't remember. Try typing\n", 85 | "\n", 86 | "```python\n", 87 | "from quantrocket.master import list_calendar_statuses\n", 88 | "```\n", 89 | "in the following cell to see autocomplete in action." 90 | ] 91 | }, 92 | { 93 | "cell_type": "code", 94 | "execution_count": null, 95 | "metadata": {}, 96 | "outputs": [], 97 | "source": [] 98 | }, 99 | { 100 | "cell_type": "markdown", 101 | "metadata": {}, 102 | "source": [ 103 | "> Tip: After putting your laptop to sleep or leaving JupyterLab open in your browser for several days, reload the page to refresh autocomplete and hover documentation if they aren't working. " 104 | ] 105 | }, 106 | { 107 | "cell_type": "markdown", 108 | "metadata": {}, 109 | "source": [ 110 | "***\n", 111 | "\n", 112 | "## *Next Up*\n", 113 | "\n", 114 | "[CLI first steps](CLI-Intro.ipynb) - Get to know the command line interface" 115 | ] 116 | } 117 | ], 118 | "metadata": { 119 | "kernelspec": { 120 | "display_name": "Python 3.9", 121 | "language": "python", 122 | "name": "python3" 123 | }, 124 | "language_info": { 125 | "codemirror_mode": { 126 | "name": "ipython", 127 | "version": 3 128 | }, 129 | "file_extension": ".py", 130 | "mimetype": "text/x-python", 131 | "name": "python", 132 | "nbconvert_exporter": "python", 133 | "pygments_lexer": "ipython3", 134 | "version": "3.9.12" 135 | } 136 | }, 137 | "nbformat": 4, 138 | "nbformat_minor": 4 139 | } 140 | -------------------------------------------------------------------------------- /.quantrocket/quickstart/QuickStart.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "\"QuantRocket" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "# Welcome to QuantRocket! \n", 15 | "\n", 16 | "### Start with this 5-minute interactive tour for new users:\n", 17 | "\n", 18 | "1. [Python API first steps](Python-Intro.ipynb) - Intro to QuantRocket's Python API\n", 19 | "2. [CLI first steps](CLI-Intro.ipynb) - Get to know the command line interface\n", 20 | "3. [Logging first steps](Logging-Intro.ipynb) - Learn how logging works\n", 21 | "4. [Clone sample code](Clone-Intro.ipynb) - Get some code into your deployment\n", 22 | "5. [Code Editor](Code-Editor.ipynb) - Intro to the JupyterLab Code Editor" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "### Activate the software:\n", 30 | "\n", 31 | "* [Enter your license key](Activate.ipynb) - Use the Python API to enter your license key" 32 | ] 33 | }, 34 | { 35 | "cell_type": "markdown", 36 | "metadata": {}, 37 | "source": [ 38 | "### Go deeper with a full tutorial:\n", 39 | "\n", 40 | "Visit the [Code library](https://www.quantrocket.com/code/) to find step-by-step interactive tutorials that you can clone into your deployment. The tutorials below do not require a QuantRocket subscription." 41 | ] 42 | }, 43 | { 44 | "cell_type": "markdown", 45 | "metadata": {}, 46 | "source": [ 47 | "#### Equities\n", 48 | "\n", 49 | "##### Moonshot Intro\n", 50 | "\n", 51 | "Introductory tutorial for Moonshot demonstrating data collection, universe selection, and backtesting of an end-of-day momentum strategy. Uses free sample data." 52 | ] 53 | }, 54 | { 55 | "cell_type": "code", 56 | "execution_count": null, 57 | "metadata": {}, 58 | "outputs": [], 59 | "source": [ 60 | "from quantrocket.codeload import clone\n", 61 | "clone(\"moonshot-intro\")" 62 | ] 63 | }, 64 | { 65 | "cell_type": "markdown", 66 | "metadata": {}, 67 | "source": [ 68 | "##### Zipline Intro\n", 69 | "\n", 70 | "Introductory tutorial for Zipline demonstrating data collection, interactive research, and backtesting of a momentum strategy for equities. Uses free sample data." 71 | ] 72 | }, 73 | { 74 | "cell_type": "code", 75 | "execution_count": null, 76 | "metadata": {}, 77 | "outputs": [], 78 | "source": [ 79 | "from quantrocket.codeload import clone\n", 80 | "clone(\"zipline-intro\")" 81 | ] 82 | }, 83 | { 84 | "cell_type": "markdown", 85 | "metadata": {}, 86 | "source": [ 87 | "#### FX \n", 88 | "\n", 89 | "##### FX Business Day\n", 90 | "\n", 91 | "Intraday FX strategy that exploits the tendency of currencies to depreciate during local business hours and appreciate during foreign business hours. Uses EUR.USD with hourly data from Interactive Brokers. Requires an Interactive Brokers account." 92 | ] 93 | }, 94 | { 95 | "cell_type": "code", 96 | "execution_count": null, 97 | "metadata": {}, 98 | "outputs": [], 99 | "source": [ 100 | "from quantrocket.codeload import clone\n", 101 | "clone(\"fx-bizday\")" 102 | ] 103 | }, 104 | { 105 | "cell_type": "markdown", 106 | "metadata": {}, 107 | "source": [ 108 | "#### Futures\n", 109 | "\n", 110 | "##### Intraday Futures Calendar Spreads\n", 111 | "\n", 112 | "Intraday trading strategy for futures calendar spreads. Uses crude oil futures and 1-minute bid/ask bars from Interactive Brokers with a Bollinger Band mean reversion strategy. Runs in Moonshot. Demonstrates using exchange native spreads for live/paper trading, and non-native spreads for backtesting. Requires an Interactive Brokers account." 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": null, 118 | "metadata": {}, 119 | "outputs": [], 120 | "source": [ 121 | "from quantrocket.codeload import clone\n", 122 | "clone(\"calspread\")" 123 | ] 124 | } 125 | ], 126 | "metadata": { 127 | "kernelspec": { 128 | "display_name": "Python 3.9", 129 | "language": "python", 130 | "name": "python3" 131 | }, 132 | "language_info": { 133 | "codemirror_mode": { 134 | "name": "ipython", 135 | "version": 3 136 | }, 137 | "file_extension": ".py", 138 | "mimetype": "text/x-python", 139 | "name": "python", 140 | "nbconvert_exporter": "python", 141 | "pygments_lexer": "ipython3", 142 | "version": "3.9.12" 143 | } 144 | }, 145 | "nbformat": 4, 146 | "nbformat_minor": 4 147 | } 148 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. 10 | 11 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. 12 | 13 | "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. 14 | 15 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. 16 | 17 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. 18 | 19 | "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. 20 | 21 | "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). 22 | 23 | "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. 24 | 25 | "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." 26 | 27 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 28 | 29 | 2. Grant of Copyright License. 30 | 31 | Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 32 | 33 | 3. Grant of Patent License. 34 | 35 | Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 36 | 37 | 4. Redistribution. 38 | 39 | You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: 40 | 41 | You must give any other recipients of the Work or Derivative Works a copy of this License; and 42 | You must cause any modified files to carry prominent notices stating that You changed the files; and 43 | You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and 44 | If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. 45 | You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 46 | 47 | 5. Submission of Contributions. 48 | 49 | Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 50 | 51 | 6. Trademarks. 52 | 53 | This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 54 | 55 | 7. Disclaimer of Warranty. 56 | 57 | Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 58 | 59 | 8. Limitation of Liability. 60 | 61 | In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 62 | 63 | 9. Accepting Warranty or Additional Liability. 64 | 65 | While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. 66 | 67 | END OF TERMS AND CONDITIONS 68 | --------------------------------------------------------------------------------