Git Product home page Git Product logo

aws_ml_crypto's Introduction

AWS_ML_Crypto

AWS_ML_Crypto is a Spring-based JSON API written in Java that gets & stores historical cryptocurrency pricing and makes predictions predictions based on that data. This app utilizes a number of third-party tools, including CrytoCompare API, AWS SDK for Java, AWS Redshift & AWS Machine Learning Real Time Predictions. Using cron & the provided shell scripts, the user may continuously store new data, predict future values, and evaluate predictions.

Please note: This API is in active development.

Getting Started

Requirements

The following must be installed on your local machine to use this program as is.

Clone the project to your desired location

$ git clone https://github.com/meejahnsnutshell/AWS_ML_Crypto
$ cd AWS_ML_Crypto
$ mvn clean install

AWS Setup

You will need an AWS account. Please note that some services may incur fees. Avoid unnecessary charges by disabling services after use.

  • Set up your AWS Credentials.

  • Launch a Redshift Cluster. In the application.properties file of the application, update the datasource url, username, and password.

  • Follow these instructions to connect Workbench/J to your Redshift cluster. Build your tables.

Loading Historical Data

  • Cryptocompare API is the source for historical data of current cryptocurrency pricing. All API calls for aggregating and loading data are within the HistoController. Calls that can be made include "data",
    "backload", "backloadYear", and "coin". "coin" should be run first to populate data tables for coin list before "backloadYear" is used to backload the data for cryptocurrency wanted.

  • Parameters for API call include type (type of historical call being made; default = histohour), fsym (from Symbol; default = BTC), tysm (to Symbol; default = USD), e (exchange; default = CCCAGG), extraParams (name of application), sign (If set to true, the server will sign the requests; default = false), tryConversion (If set to false, it will try to get values without using any conversion at all; default = true), aggregate (default = 1), limit (default = 50), toTs (unix Timestamp).

Required Parameters: Type, fsym, tsym, and e are the minimum parameters that should be included for all API calls.

  • Ex of a URI call
.../histo/data?type=histohour&fsym=BTC&tsym=USD&limit=10&aggregate=1&e=CCCAGG
  • Data API calls mirror API calls from Cryptocompare. Data received will be checked against database for new data entries between timestamps. Any new data will be inserted into the database.

  • Backload API calls will check database for most current timestamp for requested cryptocurrency and will aggregate new data up to current time stamp and insert into database.

  • BackloadYear API call will aggregate all data since the requested year change based on current timestamp and cryptocurrency selected. Parameters are the same as other API calls with the addition of year (default value = -1). This parameter is the change to the current year date for data requested. Any new data that does not exist in the database will be entered. Ex. URI for backloading data for previous year:

/histo/backloadYear?type=histohour&fsym=BTC&tsym=USD&e=CCCAGG&limit=500&year=-1
  • Coin API calls will get all current cryptocurrency listed on Cryptocompare and will insert any new currency into the database.

Making Predictions

An AWS Machine Learning model is required to make a prediction. Models can be created in the AWS console (high customization) qor programmatically (limited customization), but both require an existing datasource. Query parameters are createmodel, modelId and modelName.

  • To programmatically create a model, createmodel=true. Optional: modelId=xxxx&modelName=xxxx. Id and name are generated if not provided. Ex URIs:
.../predict/realtime?createmodel=true&modelId=1234&modelName=MyModel

or

.../predict/realtime?createmodel=true

Model parameters that can be configured in the code:

ModelParamsScreenShot

  • To use an existing model, provide id and name.
.../predict/realtime?createmodel=false&modelid=1234&modelname=MyModel
  • Results

Hourly highvalue prediction & evaluation

PredictionsTableScreenShot

Automation

Shell scripts can be set with crontab -e to continuously get new data and make and analyze predictions.

  • Ex hourly:
1 * * * * sh /path/to/bot.sh 
2 * * * * sh /path/to/predict.sh <modelId> <modelName>
3 * * * * sh /path/to/analyze.sh 

Note that timing is important. The scripts should be staggered and bot should not be run on the hour. Analyze must wait for the known value of the prediction to be received (analysis for a prediction made for 4PM can't be run until after 4PM.

Contributors

Acknowledgments

aws_ml_crypto's People

Contributors

meejahnsnutshell avatar popopenguin avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.