Skip to content

Commit

Permalink
bugfixes for notebooks / instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Steffmann committed Dec 18, 2020
1 parent fa8d666 commit c8cc959
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 70 deletions.
2 changes: 1 addition & 1 deletion 1_Data/Load_Hist_Data_Daily_Public.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"outputs": [],
"source": [
"# get S3 bucket\n",
"s3bucket=!(aws s3 ls | grep algo-data | awk '{print $3}')\n",
"s3bucket=!(aws s3 ls | grep algotrading-data | awk '{print $3}')\n",
"s3bucket=s3bucket[0]\n",
"s3bucket"
]
Expand Down
2 changes: 1 addition & 1 deletion 1_Data/Load_Hist_Data_Intraday.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"outputs": [],
"source": [
"# get S3 bucket\n",
"s3bucket=!(aws s3 ls | grep algo-data | awk '{print $3}')\n",
"s3bucket=!(aws s3 ls | grep algotrading-data | awk '{print $3}')\n",
"s3bucket=s3bucket[0]\n",
"s3bucket"
]
Expand Down
19 changes: 5 additions & 14 deletions 2_Strategies/Strategy_Breakout.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"outputs": [],
"source": [
"# get S3 bucket\n",
"s3bucket=!(aws s3 ls | grep algo-data | awk '{print $3}')\n",
"s3bucket=!(aws s3 ls | grep algotrading-data | awk '{print $3}')\n",
"s3bucket=s3bucket[0]\n",
"s3bucket"
]
Expand Down Expand Up @@ -299,10 +299,10 @@
"image = f'{account}.dkr.ecr.{region}.amazonaws.com/{prefix}:latest'\n",
"\n",
"algo = sage.estimator.Estimator(\n",
" image_name=image,\n",
" image_uri=image,\n",
" role=role,\n",
" train_instance_count=1,\n",
" train_instance_type='ml.m4.xlarge',\n",
" instance_count=1,\n",
" instance_type='ml.m4.xlarge',\n",
" output_path=\"s3://{}/output\".format(sess.default_bucket()),\n",
" sagemaker_session=sess,\n",
" base_job_name=job_name,\n",
Expand Down Expand Up @@ -358,16 +358,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Congratulations! You've completed this strategy. Verify your submission on the leaderboard."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%run leaderboard.py"
"### Congratulations! You've completed this strategy."
]
}
],
Expand Down
15 changes: 3 additions & 12 deletions 2_Strategies/Strategy_ML_Forecast.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@
"algo = sage.estimator.Estimator(\n",
" image_uri=image,\n",
" role=role,\n",
" train_instance_count=1,\n",
" train_instance_type='ml.m4.xlarge',\n",
" instance_count=1,\n",
" instance_type='ml.m4.xlarge',\n",
" output_path=\"s3://{}/output\".format(sess.default_bucket()),\n",
" sagemaker_session=sess,\n",
" base_job_name=job_name,\n",
Expand Down Expand Up @@ -448,16 +448,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Congratulations! You've completed this strategy. Verify your submission on the leaderboard."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%run leaderboard.py"
"### Congratulations! You've completed this strategy."
]
}
],
Expand Down
19 changes: 5 additions & 14 deletions 2_Strategies/Strategy_ML_Forecast_Intraday.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"outputs": [],
"source": [
"# get S3 bucket\n",
"s3bucket=!(aws s3 ls | grep algo-data | awk '{print $3}')\n",
"s3bucket=!(aws s3 ls | grep algotrading-data | awk '{print $3}')\n",
"s3bucket=s3bucket[0]\n",
"s3bucket"
]
Expand Down Expand Up @@ -377,10 +377,10 @@
"image = f'{account}.dkr.ecr.{region}.amazonaws.com/{prefix}:latest'\n",
"\n",
"algo = sage.estimator.Estimator(\n",
" image_name=image,\n",
" image_uri=image,\n",
" role=role,\n",
" train_instance_count=1,\n",
" train_instance_type='ml.m4.xlarge',\n",
" instance_count=1,\n",
" instance_type='ml.m4.xlarge',\n",
" output_path=\"s3://{}/output\".format(sess.default_bucket()),\n",
" sagemaker_session=sess,\n",
" base_job_name=job_name,\n",
Expand Down Expand Up @@ -436,16 +436,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Congratulations! You've completed this strategy. Verify your submission on the leaderboard."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%run leaderboard.py"
"### Congratulations! You've completed this strategy."
]
}
],
Expand Down
26 changes: 5 additions & 21 deletions 2_Strategies/Strategy_SMA.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"outputs": [],
"source": [
"# get S3 bucket\n",
"s3bucket=!(aws s3 ls | grep algo-data | awk '{print $3}')\n",
"s3bucket=!(aws s3 ls | grep algotrading-data | awk '{print $3}')\n",
"s3bucket=s3bucket[0]\n",
"s3bucket"
]
Expand Down Expand Up @@ -296,10 +296,10 @@
"image = f'{account}.dkr.ecr.{region}.amazonaws.com/{prefix}:latest'\n",
"\n",
"algo = sage.estimator.Estimator(\n",
" image_name=image,\n",
" image_uri=image,\n",
" role=role,\n",
" train_instance_count=1,\n",
" train_instance_type='ml.m4.xlarge',\n",
" instance_count=1,\n",
" instance_type='ml.m4.xlarge',\n",
" output_path=\"s3://{}/output\".format(sess.default_bucket()),\n",
" sagemaker_session=sess,\n",
" base_job_name=job_name,\n",
Expand Down Expand Up @@ -354,24 +354,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Congratulations! You've completed this strategy. Verify your submission on the leaderboard."
"### Congratulations! You've completed this strategy."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%run leaderboard.py"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
4 changes: 2 additions & 2 deletions 3_Models/Train_Model_Forecast.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,8 @@
"classifier = sage.estimator.Estimator(\n",
" image_uri=image,\n",
" role=role,\n",
" train_instance_count=1,\n",
" train_instance_type='ml.m4.xlarge',\n",
" instance_count=1,\n",
" instance_type='ml.m4.xlarge',\n",
" output_path=\"s3://{}/output\".format(sess.default_bucket()),\n",
" sagemaker_session=sess,\n",
" base_job_name=job_name)\n",
Expand Down
8 changes: 4 additions & 4 deletions 3_Models/Train_Model_Forecast_Intraday.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"outputs": [],
"source": [
"# get S3 bucket\n",
"s3bucket=!(aws s3 ls | grep algo-data | awk '{print $3}')\n",
"s3bucket=!(aws s3 ls | grep algotrading-data | awk '{print $3}')\n",
"s3bucket=s3bucket[0]\n",
"s3bucket"
]
Expand Down Expand Up @@ -516,10 +516,10 @@
"image = f'{account}.dkr.ecr.{region}.amazonaws.com/{prefix}:latest'\n",
"\n",
"classifier = sage.estimator.Estimator(\n",
" image_name=image,\n",
" image_uri=image,\n",
" role=role,\n",
" train_instance_count=1,\n",
" train_instance_type='ml.m4.xlarge',\n",
" instance_count=1,\n",
" instance_type='ml.m4.xlarge',\n",
" output_path=\"s3://{}/output\".format(sess.default_bucket()),\n",
" sagemaker_session=sess,\n",
" base_job_name=job_name)\n",
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ As the team lead on this lean team of one, you'll need to wear multiple hats. B

At minimum, at the end of this workshop, you will have an understanding how to load historical price data from external market data sources like AWS Data Exchange into S3. You get familiar how to store price data in S3 and expose it via Glue Data Catalog and Athena, how to backtested trading strategies using Amazon SageMaker, and how to train machine learning models that are used in trading strategies. You also get a basic understand how trading strategies using trend following and machine learning are developed with Python and can be optimized for better performance.

## Architecture

![chart](assets/chart.png)

## License

This library is licensed under the MIT-0 License. See the LICENSE file.
Expand All @@ -40,7 +44,7 @@ YOUR USE OF THE EXTERNAL DEPENDENCIES IS AT YOUR SOLE RISK. IN NO EVENT WILL AMA
## Step 0: Set up environment

For the base infrastructure components (SageMaker Notebook, Athena, Glue Tables, S3 Bucket), deploy the following [CloudFormation template](https://github.com/aws-samples/algorithmic-trading/raw/master/0_Setup/ReferenceArchitecture-CF.json).
First go to [CloudFormation](https://console.aws.amazon.com/cloudformation/home?#/stacks/new?stackName=algo) and upload the downloaded CF template. Verify that stackName is **algo** before creating the stack and acknowledge that IAM changes will be made.
First go to [CloudFormation](https://console.aws.amazon.com/cloudformation/home?#/stacks/new?stackName=algo) and upload the downloaded CF template. Verify that stackName is **algotrading** before creating the stack and acknowledge that IAM changes will be made.

This step will take ca. 5 minutes.

Expand Down
Binary file added assets/arch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c8cc959

Please sign in to comment.