Giter Club home page Giter Club logo

wbwren-bitcoin-technical-indicators_aprresub's Introduction

Bitcoin Technical Indicators

Project purpose:

The purpose of the project is provide the user with a number of technical indcators for bitcoins price action and encourage them to pay to access the premium metric. The premium metric is a risk indicator, combining the other metrics into one and indicating optimal buying and selling oportinities.

The project contains the following apps:

  • Dashboard

    • Explains the purpose of the site and encourages the user to register.
  • Login / registration

    • Allows user to create an account and login.
  • Metrics

    • Displays all of the currently available metrics.
  • Metric Details

    • Renders a Plotly chart with Bitcoins price and selected indicator.
  • Admin CRUD

    • Administrators can add price data as required (currently this is not automated)
    • Administrators can edit the details of existing metrics
  • Checkout

    • Users can purchase lifetime access to the premium indicator

UX

User stories

  • As a user, I want to be able to register to the site, so that I can securely login.

  • As a user, I want to be able to sign into my account, so that I have access to the metrics available.

  • As a user, I would like the user experience on the website to be intuitive, so that I can quickly navigate to the metric I wish.

  • As a user, I want to be able to view bitcoin price data, so that I can spot trends in the price action.

  • As a user, I want to be able to view my chosen metric overlayed onto the chart, so that I can easily comprehend the metric.

  • As an administrator, I want full CRUD functionality of the price data, so that the metrics are kept up to date.

  • As the site owner, I want the checkout functionality to be secure, so that a user cannot access the premium metric without paying.

Strategy

Goal: Show the user how valuable technical indicators can be when predicating Bitcoin price movements and encourage them to purchase the premium metric.

Scope

  • A dynmic web app that implements the Plotly API to display Bitcoin price data in conjunction with relvent technical indicators.

Design and colors:

Colors:

  • background: #1F2833;
  • font: #C5C6C7;
  • header: #66FCF1;
  • navbar: #C5C6C7;

Wireframes

Features:

Plotly graphing

To display the price charts, the Plotly API for Python was used.

Technology Used:

Languages:

  • HTML5
  • CSS3
  • JavaScript
  • Python
  • SQL

Libraries, Frameworks and Tools

Databases

Testing

Code Validation

  • HTML was validated using W3C Markup Validation Service.

  • CSS was validated using W3C CSS Validation Service - Jigsaw

  • JavaScript was passed through the linter jshint with no warnings

Functionality test

Num Test Action Outcome image Result
1 As a user, I want to be able to register to the site, so that I can securely login. Navigate to registration page and attempt to register with a valid email and password Image Pass
2 As a user, I want to be able to sign into my account, so that I have access to the metrics available. Navigate to the login page and attempt to login with the previously registered user Image Pass
3 As a user, I would like the user experience on the website to be intuitive, so that I can quickly navigate to the metric I wish. Once logged in, click on the metrics icon in the navbar Image Pass
4 As a user, I want to be able to view bitcoin price data, so that I can spot trends in the price action. Select an indicator from the metrics page and view the chart displayed Image Pass
5 As a user, I want to be able to view my chosen metric overlayed onto the chart, so that I can easily comprehend the metric. Navigate to a given metric and assess whether the moving average lines are visible Image Pass
6 As an administrator, I want full CRUD functionality of the price data, so that the metrics are kept up to date. Login as super user, navigate to the edit price data page and attmept to add, edit and delete a given price Image Pass
7 As the site owner, I want the checkout functionality to be secure, so that a user cannot access the premium metric without paying. Login as non-super user and attempt to access endpoints which are restricted to super users Image Pass

Browser Compatibility

Num Browser Test result
1 Chrome Passed
2 Opera Passed
3 Mozzilla Passed

Responsiveness Testing

  • Chrome developer tools was used to test a wide variety of device sizes and resolutions.

  • The website has been tested on a Samsung Galaxy s10, Lenovo Legion and a desktop PC with a 1080p and 4k monitor, respectfully.

Deployment

Running Code Locally

  1. Follow this link to my Repository on Github and open it.

  2. Click Clone or Download.

  3. In the Clone with HTTPs section, click the copy icon.

  4. In your local IDE open Git Bash.

  5. Change the current working directory to where you want the cloned directory to be made.

  6. Type git clone, and then paste the URL you copied earlier.

  7. Press enter and your local clone will be ready.

  8. Create and start a new environment:
    python -m .venv venv
    source env/bin/activate

  9. Install the project dependencies:
    pip install -r requirements.txt

  10. Create a new file, called env.py and add your environment variables:

import os

os.environ.setdefault("DJANGO_SECRET_KEY", "secret key here")

os.environ.setdefault("DATABASE_URL", "secret key here")

os.environ.setdefault("SQLITE_URL", "secret key here")

os.environ.setdefault("CACHE_URL", "secret key here")

os.environ.setdefault("REDIS_URL", "secret key here")

os.environ.setdefault("STRIPE_PUBLIC_KEY", "secret key here")

os.environ.setdefault("STRIPE_SECRET_KEY", "secret key here")

os.environ.setdefault("STRIPE_WH_SECRET", "secret key here")

os.environ.setdefault("DATABASE_URL", "secret key here")

os.environ.setdefault("EMAIL_HOST_USER", "secret key here")

os.environ.setdefault("EMAIL_HOST_PASS", "secret key here")

os.environ.setdefault("DEFAULT_FROM_EMAIL", "secret key here")

  1. Go to settings.py file and add your environment variables.

  2. Add env.py to .gitignore file

  3. Go to terminal and run the following: python3 manage.py makemigrations, then python3 manage.py migrate to migrate all existing migrations to postgres database.

  4. Create a superuser: python3 manage.py createsuperuser

  5. Run it with the following command:
    python manage.py runserver

  6. Open localhost:8000 on your browser

  7. Add /admin to the end of the url address and login with your superuser account to edit the models.

Deployment to Heroku

The following steps were taken in order to deploy this site to Heroku:

  1. Created a new app in Heroku with a unique name, chose my region

  2. Went to Resources, within Add-ons searched Heroku Postgres, chose Hobby Dev - Free version, then clicked Provision button.

  3. In Settings clicked on Reveal Config Vars button, and copied the value of DATABASE_URL

  4. Returned to terminal window and run sudo pip3 install dj_database_url

  5. Also run sudo pip3 install psycopg2. Created a requirements.txt file using the terminal command pip3 freeze > requirements.txt

  6. Went to settings.py and added import dj_database_url and updated DATABASES = {'default': dj_database_url.parse(os.environ.get('DATABASE_URL'))} also updated env.py with os.environ.setdefault("DATABASE_URL", "postgres://postgres key - copied earlier from Heroku")

  7. I run python3 manage.py makemigrations, then python3 manage.py migrate to migrate all existing migrations to postgres database.

  8. I created a superuser: python3 manage.py createsuperuser

  9. Logged in to Amazon AWS, went to S3 and created a new S3 bucket.

  10. Returned to terminal window and run sudo pip3 install django-storages and sudo pip3 install boto3. Went to settings.py and added storages to INSTALLED_APPS.

  11. Also in settings.py the following lines are added:

AWS_S3_OBJECT_PARAMETERS = { "Expires": "Thu, 31 Dec 2099 20:00:00 GMT", "CacheControl": "max-age=94608000", }

AWS_STORAGE_BUCKET_NAME = "bitcoin-technical-indicators" AWS_S3_REGION_NAME = "eu-west-1" AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID") AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY") AWS_S3_CUSTOM_DOMAIN = f"{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com"

STATICFILES_STORAGE = "custom_storages.StaticStorage" STATICFILES_LOCATION = "static" DEFAULT_FILE_STORAGE = "custom_storages.MediaStorage" MEDIAFILES_LOCATION = "media"

STATIC_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{STATICFILES_LOCATION}/" MEDIA_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{MEDIAFILES_LOCATION}/"

  1. Updated env.py with AWS keys (these keys are from S3).

  2. Created custom_storages.py at the top level containing the following code:

from django.conf import settings from storages.backends.s3boto3 import S3Boto3Storage

class StaticStorage(S3Boto3Storage): location = settings.STATICFILES_LOCATION

class MediaStorage(S3Boto3Storage): location = settings.MEDIAFILES_LOCATION

  1. Went to settings.py and added:

STATICFILES_STORAGE = 'custom_storages.StaticStorage' STATICFILES_LOCATION = 'static'

DEFAULT_FILE_STORAGE = 'custom_storages.MediaStorage' MEDIAFILES_LOCATION = 'media'

  1. Returned to terminal window and run python3 manage.py collectstatic

  2. Returned to Heroku. In Settings clicked on Reveal Config Vars button, and added all the following config vars from env.py:

Key Value
AWS_ACCESS_KEY_ID secret key here
AWS_SECRET_ACCESS_KEY secret key here
DATABASE_URL secret key here
DISABLE_COLLECTSTATIC 1
SECRET_KEY secret key here
STRIPE_PUBLISHABLE secret key here
STRIPE_SECRET secret key here
  1. Clicked to Deploy, then GitHub, searched for my repository and clicked to Connect button.

  2. Returned to terminal window and run sudo pip3 install gunicorn and added to requirements.txt

  3. Created a Procfile using the following command: echo web: gunicorn ms4.wsgi:application

  4. Ran git add ., git commit -m "my commit message" and git push commands to push all changes to my GitHub repository.

  5. Return to Heroku and click Deploy Branch

  6. Once the build is complete, click on Open app

  7. Went to settings.py and added bitcoin-technical-indicators.herokuapp.com to ALLOWED_HOSTS

  8. Ran git add ., git commit -m "my commit message" and git push commands to push all changes to my GitHub repository.

  9. Returned to Heroku and hit Deploy Branch again.

Clone

  1. Follow this link to my Github Repository.

  2. Click 'Clone or Download'.

  3. In the Clone with HTTPs section, click the 'copy' icon.

  4. In your local Integrated Development Environment open Git Bash.

  5. Change the current working directory to where you want the cloned directory to be located.

  6. Type 'git clone', and paste the URL you copied before.

  7. Press enter and your local clone will be available.

Loading Bitcoin Price Data

  • download bitcoin historical data csv from prefered source (e.g. investing.com)

  • edit csv to include the following cols: date, price

  • delete header row (just include the data rows)

  • set the date col to the format Y-m-d

  • set all other cols to a type of number (otherwise prices may have ',' symbol which can cause errors)

  • install sqlite extension for visual studio code

  • load the csv to the project root directory

  • use the following commands to load the data into the postgres database: .\sqlite3.exe metrics_bitcoin_price .mode csv .import <path/to/csv> metrics_bitcoin_price;

    Note if using postgres, the copy command is: \copy metrics_bitcoinprice from '<path/to/csv>' csv header;

Accessing administration CRUD functionality

  • Login to the site with the username and and password of '[email protected]' and 'Atlantic99' respectfully.
  • Click 'Edit Price Data' in the navbar.

Acknowledgments

A huge thanks to my mentor Brian Macharia for his invaluable guidance throughout this project and the entire program.

wbwren-bitcoin-technical-indicators_aprresub's People

Contributors

wbwren 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.