Skip to content

hang-justin/robinhood-clone

Repository files navigation

YUANHOOD

Yuanhood is a Robinhood clone built using Postgres, Flask-SQLAlchemy, React, Redux.

Yuanhood is based off of Robinhood, which is a financial services company where users can trade assets such as stocks, ETFs, and cryptocurrencies. Yuanhood presently only supports a number of the most popular cryptocurrencies. Users can buy/sell those assets based on real prices and also add those cryptocurrencies on watchlists.

Follow the link below to check it out! https://yuanhood.herokuapp.com/

NAVIGATING YUANHOOD

Accessing your account

Logging in

Login by clicking on the 'Login' button located on the top right. If you're curious and want to check it out without any obligation, feel free to login as a demo user which can also be accessed on the login page.

login

Signing Up

Sign up by accessing the sign up page through:

  1. Signup button to the top right of the splash page
  2. Signup button towards the bottom of the splash page
  3. 'Create an Account' link on the login page

signup

Manage your portfolio and trade assets

After logging in, you will be at your home page where you can view a breakdown of your portfolio. If you just made an account, your portfolio will only consist of your cash assets totaling to $50,000.00 courtesy of Yuanhood.

image

To buy an asset, first navigate to 'View Available Cryptocurrencies' located to the top right of the sidebar located on the right side. Next, click on the asset that you would like to buy.

Fill out the form located to the right and you will have purchased your first asset!

buy-asset-1

buy-asset-2

buy-asset-3

You can sell an asset by navigating to the same page and fill out the form after clicking on the 'Sell ' located to the top of the form. You may have not seen this initially as it is only displayed if you own that asset.

image

Manage your watchlists

Every new user will have a default watchlist, 'My First List', consisting of all the supported cryptocurrencies.

Users can create a new watchlist by clicking on the '+' located to the right of 'Lists' on the sidebar.

create-list

Users can update their watchlist by:

  1. Editing the name by clicking on the ellipses displayed when hovering over the watchlist on the sidebar
  2. Adding/Removing - Navigate to 'View All Cryptocurrencies' then click on the '+' located to the far right
  3. Adding/Removing - Navigating to an asset page and clicking on 'Add to Lists' underneath the trade order form.
  4. Removing - Navigate to a specific watchlist by clicking on the watchlist name then clicking on the 'x' located to the far right of the asset

edit-list-1

edit-list-2

edit-list-3

edit-list-4

Users can also delete their watchlists by clicking on the ellipses then clicking 'Delete List'.

delete-list

Tech used

Flask Python React Redux Ubuntu JavaScript NodeJS HTML CSS3 Heroku Postgres Docker

To dos

  • Live data
  • Statements
  • Search bar
  • Newsfeed
  • Categories
  • Stocks

How to set up

  1. Clone this repository (only this branch)

    git clone [email protected]:hang-justin/robinhood-clone.git
  2. Install dependencies

    pipenv install -r requirements.txt
  3. Create a .env file based on the example with proper settings for your development environment

  4. Make sure the SQLite3 database connection URL is in the .env file

  5. Get into your pipenv, migrate your database, seed your database, and run your Flask app

    pipenv shell
    flask db upgrade
    flask seed all
    flask run
  6. From the root directory, cd into react-app, install your dependencies, run npm install, and WALA! You got your very own Discord clone.

    cd react-app
    npm install
    npm start

Deploy to Heroku

This repo comes configured with Github Actions. When you push to your main branch, Github will automatically pull your code, package and push it to Heroku, and then release the new image and run db migrations.

  1. Write your Dockerfile. In order for the Github action to work effectively, it must have a configured Dockerfile. Follow the comments found in this Dockerfile to write your own!

  2. Create a new project on Heroku.

  3. Under Resources click "Find more add-ons" and add the add on called "Heroku Postgres".

  4. Configure production environment variables. In your Heroku app settings -> config variables you should have two environment variables set:

    Key Value
    DATABASE_URL Autogenerated when adding postgres to Heroku app
    SECRET_KEY Random string full of entropy
  5. Generate a Heroku OAuth token for your Github Action. To do so, log in to Heroku via your command line with heroku login. Once you are logged in, run heroku authorizations:create. Copy the GUID value for the Token key.

  6. In your Github Actions Secrets you should have two environment variables set. You can set these variables via your Github repository settings -> secrets -> actions. Click "New respository secret" to create each of the following variables:

    Key Value
    HEROKU_API_KEY Heroku Oauth Token (from step 6)
    HEROKU_APP_NAME Heroku app name
  7. Push to your main branch! This will trigger the Github Action to build your Docker image and deploy your application to the Heroku container registry. Please note that the Github Action will automatically upgrade your production database with flask db upgrade. However, it will not automatically seed your database. You must manually seed your production database if/when you so choose (see step 8).

  8. Attention! Please run this command only if you wish to seed your production database: heroku run -a HEROKU_APP_NAME flask seed all

Helpful commands

Command Purpose
pipenv shell Open your terminal in the virtual environment and be able to run flask commands without a prefix
pipenv run Run a command from the context of the virtual environment without actually entering into it. You can use this as a prefix for flask commands
flask db upgrade Check in with the database and run any needed migrations
flask db downgrade Check in with the database and revert any needed migrations
flask seed all Just a helpful syntax to run queries against the db to seed data. See the app/seeds folder for reference and more details
heroku login -i Authenticate your heroku-cli using the command line. Drop the -i to authenticate via the browser
heroku authorizations:create Once authenticated, use this to generate an Oauth token
heroku run -a <app name> Run a command from within the deployed container on Heroku

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published