Skip to content

Commit

Permalink
prepared for version 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Dekkers committed Apr 1, 2023
1 parent 6d19609 commit 61441cb
Show file tree
Hide file tree
Showing 23 changed files with 56 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dockerx.yml
Expand Up @@ -26,4 +26,4 @@ jobs:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: roboquant/jupyter:1.2.1,roboquant/jupyter:latest
tags: roboquant/jupyter:1.3.0,roboquant/jupyter:latest
8 changes: 4 additions & 4 deletions Dockerfile
@@ -1,5 +1,5 @@
# we use the smaller base-notebook image as a starting point
FROM jupyter/base-notebook:2023-03-13
FROM jupyter/base-notebook:2023-03-27

# Install OpenJDK as root
USER root
Expand All @@ -15,9 +15,9 @@ USER 1000

# Install the Kotlin kernel in the Jupyter environment
# RUN pip install kotlin-jupyter-kernel==0.11.0.255
RUN pip install -i https://test.pypi.org/simple/ kotlin-jupyter-kernel==0.11.0.335
RUN pip install -i https://test.pypi.org/simple/ kotlin-jupyter-kernel==0.11.0.346

# Make additional Kotlin kernels available with different fixed memory profiles
# Make additional Kotlin kernels available with different memory profiles
RUN python -m kotlin_kernel add-kernel --name "Small_0.5GB" --jvm-arg=-Xmx512M
RUN python -m kotlin_kernel add-kernel --name "Medium_2G" --jvm-arg=-Xmx2G
RUN python -m kotlin_kernel add-kernel --name "Large_8GB" --jvm-arg=-Xmx8G
Expand All @@ -26,7 +26,7 @@ RUN python -m kotlin_kernel add-kernel --name "Large_8GB" --jvm-arg=-Xmx8G
RUN mkdir -p /home/jovyan/notebooks
COPY --chown=1000:100 notebooks /home/jovyan/notebooks

# Run the preload notebook to load some libraries and historic data on the image
# Run the preload notebook to load libraries and historic data onto the image
RUN jupyter nbconvert --to notebook --execute notebooks/preload.ipynb && rm -f notebooks/preload*.ipynb


Expand Down
8 changes: 5 additions & 3 deletions bin/README.adoc
Expand Up @@ -11,11 +11,13 @@ You can start using _roboquant_ with Jupyter notebooks straight out-of-the-box b

[source,shell]
----
docker run --rm -p 8888:8888 roboquant/jupyter
docker run -p 8888:8888 roboquant/jupyter
----

Then open the url that appears in your terminal in your browser to try it out. The `./notebooks` directory contains several notebooks that provide an introduction into roboquant.

For more details, see https://roboquant.org/tutorial/install.html


== Interactive Brokers only
If you also want test the Interactive Brokers Notebook that is included, it is important to realize that the notebook requires access to a (local) running instance of Trader Workstation or IB Gateway (recommended).
Expand All @@ -24,7 +26,7 @@ For the docker container to have this network accessible, you can use the `--net

[source,shell]
----
docker run --rm -p 8888:8888 --network=host -roboquant/jupyter
docker run -p 8888:8888 --network=host roboquant/jupyter
----

You will also have to manually copy the required client jar file after starting a notebook (due to license constraints). See the `ibkr` notebook for more instructions.
Expand Down Expand Up @@ -52,4 +54,4 @@ Please note the `dockerbuild.sh` script will also push the image to the Docker H
NOTE: currently, only shell scripts are provided to build and start notebooks. So if you're on Windows you either have to use WSL or run the commands in the shell script from the command line manually.

== MyBinder.org
In order to start _roboquant_ notebooks quickly on MyBinder.org, there is a `binder directory included with a `Dockerfile` that retrieves the latest image from Docker Hub. This avoids that MyBinder.org has to build the image from scratch and has prolonged startup times as a consequence.
In order to start _roboquant_ notebooks quickly on MyBinder.org, there is a `binder directory included with a `Dockerfile` that retrieves the latest image from Docker Hub. This avoids that MyBinder.org has to build the image from scratch that leads to prolonged startup times.
2 changes: 1 addition & 1 deletion bin/dockerbuild.sh
Expand Up @@ -11,4 +11,4 @@ rm -f notebooks/*.nbconvert.ipynb
jupyter nbconvert --clear-output --inplace notebooks/*.ipynb

# Build for AMD64 and ARM64 platforms
docker buildx build --platform linux/amd64,linux/arm64/v8 -t roboquant/jupyter:1.2.1 -t roboquant/jupyter:latest --push .
docker buildx build --platform linux/amd64,linux/arm64/v8 -t roboquant/jupyter:1.3.0 -t roboquant/jupyter:latest --push .
2 changes: 1 addition & 1 deletion bin/dockerbuild_singleplatform.sh
Expand Up @@ -5,4 +5,4 @@ rm -f notebooks/*.nbconvert.ipynb
jupyter nbconvert --clear-output --inplace notebooks/*.ipynb

# Build for local platform only
docker build -t roboquant/jupyter:1.2.1 -t roboquant/jupyter:latest .
docker build -t roboquant/jupyter:1.3.0 -t roboquant/jupyter:latest .
2 changes: 1 addition & 1 deletion binder/Dockerfile
@@ -1 +1 @@
FROM roboquant/jupyter:1.2.1
FROM roboquant/jupyter:1.3.0
2 changes: 1 addition & 1 deletion notebooks/alpaca.ipynb
Expand Up @@ -28,7 +28,7 @@
"metadata": {},
"outputs": [],
"source": [
"%use roboquant(version=1.3.0-SNAPSHOT, modules=extra)\n",
"%use roboquant(version=1.3.0, modules=extra)\n",
"\n",
"import org.roboquant.alpaca.*\n",
"Welcome()"
Expand Down
2 changes: 1 addition & 1 deletion notebooks/backtest.ipynb
Expand Up @@ -19,7 +19,7 @@
"metadata": {},
"outputs": [],
"source": [
"%use roboquant(1.3.0-SNAPSHOT)\n",
"%use roboquant(1.3.0)\n",
"Welcome()"
]
},
Expand Down
2 changes: 1 addition & 1 deletion notebooks/basic.ipynb
Expand Up @@ -16,7 +16,7 @@
"metadata": {},
"outputs": [],
"source": [
"%use roboquant(1.3.0-SNAPSHOT)\n",
"%use roboquant(1.3.0)\n",
"Welcome()"
]
},
Expand Down
2 changes: 1 addition & 1 deletion notebooks/binance.ipynb
Expand Up @@ -28,7 +28,7 @@
"metadata": {},
"outputs": [],
"source": [
"%use roboquant(version=1.3.0-SNAPSHOT, modules=crypto)\n",
"%use roboquant(version=1.3.0, modules=crypto)\n",
"\n",
"// import binance package\n",
"import org.roboquant.binance.*\n",
Expand Down
40 changes: 27 additions & 13 deletions notebooks/charts.ipynb
Expand Up @@ -31,7 +31,7 @@
},
"outputs": [],
"source": [
"%use roboquant(1.3.0-SNAPSHOT)\n",
"%use roboquant(1.3.0)\n",
"Welcome()"
]
},
Expand Down Expand Up @@ -79,7 +79,7 @@
"metadata": {},
"outputs": [],
"source": [
"val timeframe = Timeframe.past(1.years)\n",
"val timeframe = Timeframe.fromYears(2022, 2023)\n",
"AssetPerformanceChart(feed, timeframe = timeframe)"
]
},
Expand All @@ -99,18 +99,32 @@
},
"outputs": [],
"source": [
"val apple = feed.assets.getBySymbol(\"AAPL\")\n",
"PriceChart(feed, apple, timeframe = timeframe)"
"PriceChart(feed, \"AAPL\", timeframe = timeframe)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Price-bar Chart\n",
"Roboquant charts aren't designed to be a tool where you manually draw support lines on candlestick charts to make trading decisions. But that doesn't mean candlesticks cannot come in handy. For example to validate if the data in a feed is not corrupted or has some other strange anomalies. This time we don't supply a timeframe, so all prices in the feed will be displayed. \n",
"## Price Chart\n",
"Roboquant charts aren't designed to be a tool where you manually draw support lines on price charts to make trading decisions. But that doesn't mean price charts cannot come in handy. For example to validate if the data in a feed is not corrupted or has some other strange anomalies. \n",
"\n",
"There are two type of price charts:\n",
"\n",
"1. PriceChart, this one support any type of pricing info\n",
"2. PriecBarChart, that only support price-bars (candlestick) data\n",
"\n",
"In the top right part of the plotted graph there is a toolbox that you can use to zoom into a particular area of interest."
"\n",
"If we don't supply a timeframe, so all prices in the feed will be displayed. In the top right part of the plotted graph there is a toolbox that you can use to zoom into a particular area of interest."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"PriceChart(feed, \"TSLA\", priceType = \"OPEN\")"
]
},
{
Expand All @@ -121,7 +135,7 @@
},
"outputs": [],
"source": [
"PriceBarChart(feed, apple)"
"PriceBarChart(feed, \"AAPL\")"
]
},
{
Expand Down Expand Up @@ -225,8 +239,8 @@
},
"outputs": [],
"source": [
"val chart = TradeAssetChart(account.trades.takeLast(100))\n",
"chart.height = 1000\n",
"val chart = TradeAssetChart(account.trades.takeLast(40))\n",
"chart.height = 600\n",
"chart"
]
},
Expand All @@ -247,7 +261,7 @@
"metadata": {},
"outputs": [],
"source": [
"PriceBarChart(feed, apple, account.trades)"
"PriceBarChart(feed, \"AAPL\", account.trades)"
]
},
{
Expand Down Expand Up @@ -380,7 +394,7 @@
},
"outputs": [],
"source": [
"val timeframe = Timeframe.past(2.years)\n",
"val timeframe = Timeframe.fromYears(2021,2023)\n",
"val data2 = data.filter { timeframe.contains(it.info.time) }\n",
"MetricCalendarChart(data2.diff())"
]
Expand Down Expand Up @@ -434,7 +448,7 @@
"source": [
"roboquant.reset()\n",
"\n",
"feed.timeframe.sample(6.months, 25).forEach {\n",
"feed.timeframe.sample(6.months, 50).forEach {\n",
" roboquant.run(feed, it) \n",
"}"
]
Expand Down
2 changes: 1 addition & 1 deletion notebooks/crypto.ipynb
Expand Up @@ -16,7 +16,7 @@
"metadata": {},
"outputs": [],
"source": [
"%use roboquant(version=1.3.0-SNAPSHOT, modules=crypto)\n",
"%use roboquant(version=1.3.0, modules=crypto)\n",
"\n",
"import org.roboquant.xchange.*\n",
"Welcome()"
Expand Down
2 changes: 1 addition & 1 deletion notebooks/discord.ipynb
Expand Up @@ -25,7 +25,7 @@
},
"outputs": [],
"source": [
"%use roboquant(version=1.3.0-SNAPSHOT, modules=crypto)\n",
"%use roboquant(version=1.3.0, modules=crypto)\n",
"\n",
"// Load the JDA library and import the required classes\n",
"@file:DependsOn(\"net.dv8tion:JDA:5.0.0-beta.4\")\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/empty.ipynb
Expand Up @@ -16,7 +16,7 @@
"metadata": {},
"outputs": [],
"source": [
"%use roboquant(1.3.0-SNAPSHOT)\n",
"%use roboquant(1.3.0)\n",
"Welcome()"
]
},
Expand Down
2 changes: 1 addition & 1 deletion notebooks/forex.ipynb
Expand Up @@ -16,7 +16,7 @@
},
"outputs": [],
"source": [
"%use roboquant(1.3.0-SNAPSHOT)\n",
"%use roboquant(1.3.0)\n",
"Welcome()"
]
},
Expand Down
2 changes: 1 addition & 1 deletion notebooks/ibkr.ipynb
Expand Up @@ -58,7 +58,7 @@
"metadata": {},
"outputs": [],
"source": [
"%use roboquant(version=1.3.0-SNAPSHOT, modules=ibkr)\n",
"%use roboquant(version=1.3.0, modules=ibkr)\n",
"import org.roboquant.ibkr.*\n",
"Welcome()"
]
Expand Down
2 changes: 1 addition & 1 deletion notebooks/oanda.ipynb
Expand Up @@ -22,7 +22,7 @@
"metadata": {},
"outputs": [],
"source": [
"%use roboquant(version=1.3.0-SNAPSHOT, modules=extra)\n",
"%use roboquant(version=1.3.0, modules=extra)\n",
"\n",
"// By default the required OANDA classes are not imported, so we need to do that first. \n",
"// This import will load the various Feed and Broker classes for integrating with OANDA.\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/policies.ipynb
Expand Up @@ -17,7 +17,7 @@
"metadata": {},
"outputs": [],
"source": [
"%use roboquant(1.3.0-SNAPSHOT)\n",
"%use roboquant(1.3.0)\n",
"Welcome()"
]
},
Expand Down
2 changes: 1 addition & 1 deletion notebooks/preload.ipynb
Expand Up @@ -15,7 +15,7 @@
"metadata": {},
"outputs": [],
"source": [
"%use roboquant(version=1.3.0-SNAPSHOT, modules=extra:crypto:ibkr)"
"%use roboquant(version=1.3.0, modules=extra:crypto:ibkr)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/strategies.ipynb
Expand Up @@ -25,7 +25,7 @@
"metadata": {},
"outputs": [],
"source": [
"%use roboquant(1.3.0-SNAPSHOT)\n",
"%use roboquant(1.3.0)\n",
"Welcome()"
]
},
Expand Down
2 changes: 1 addition & 1 deletion notebooks/tech-analysis.ipynb
Expand Up @@ -18,7 +18,7 @@
"metadata": {},
"outputs": [],
"source": [
"%use roboquant(1.3.0-SNAPSHOT)\n",
"%use roboquant(1.3.0)\n",
"Welcome()"
]
},
Expand Down
2 changes: 1 addition & 1 deletion notebooks/xgboost.ipynb
Expand Up @@ -19,7 +19,7 @@
"metadata": {},
"outputs": [],
"source": [
"%use roboquant(1.3.0-SNAPSHOT)\n",
"%use roboquant(1.3.0)\n",
"Welcome()"
]
},
Expand Down
2 changes: 1 addition & 1 deletion notebooks/yahoo.ipynb
Expand Up @@ -15,7 +15,7 @@
"outputs": [],
"source": [
"// YahooHistoricFeed is part of the roboquant-extra module, so we include that also\n",
"%use roboquant(version=1.3.0-SNAPSHOT, modules=extra)\n",
"%use roboquant(version=1.3.0, modules=extra)\n",
"\n",
"\n",
"// and we import the yahoo package\n",
Expand Down

0 comments on commit 61441cb

Please sign in to comment.