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/
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.
Sign up by accessing the sign up page through:
- Signup button to the top right of the splash page
- Signup button towards the bottom of the splash page
- 'Create an Account' link on the login page
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.
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!
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.
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.
Users can update their watchlist by:
- Editing the name by clicking on the ellipses displayed when hovering over the watchlist on the sidebar
- Adding/Removing - Navigate to 'View All Cryptocurrencies' then click on the '+' located to the far right
- Adding/Removing - Navigating to an asset page and clicking on 'Add to Lists' underneath the trade order form.
- 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
Users can also delete their watchlists by clicking on the ellipses then clicking 'Delete List'.
- Live data
- Statements
- Search bar
- Newsfeed
- Categories
- Stocks
-
Clone this repository (only this branch)
git clone [email protected]:hang-justin/robinhood-clone.git
-
Install dependencies
pipenv install -r requirements.txt
-
Create a .env file based on the example with proper settings for your development environment
-
Make sure the SQLite3 database connection URL is in the .env file
-
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
-
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
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.
-
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!
-
Create a new project on Heroku.
-
Under Resources click "Find more add-ons" and add the add on called "Heroku Postgres".
-
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 -
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, runheroku authorizations:create
. Copy the GUID value for the Token key. -
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 -
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 withflask 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). -
Attention! Please run this command only if you wish to seed your production database:
heroku run -a HEROKU_APP_NAME flask seed all
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 |