Freemex is an online trading game which allows you to buy and sell stocks at your convenience and at the current market price. The player at the end with highest total stocks and cash wins the game.
-
Create a virtual environment with virtualenv (install virtualenv, if its not installed).
virtualenv freemex
-
Clone the project in the virtual environment directory.
cd freemex git clone https://github.com/lugnitdgp/freemex.git
-
Activate the virtual environemnt.
source bin/activate
.\Scripts\activate
-
Install the requirements.
cd freemex pip install -r requirements.txt
-
Copy the .env.example file to .env file.
cp .env.example .env
-
Open the .env file and add an arbitary secret key.
-
Generate Google+ OAuth credentials with the following steps:
-
Go to Google developer console
-
Create a new project if you do not have any (see the drop-down at the top left of your screen).
-
After the project is created you will be redirected to a dashboard. Click on ENABLE API button.
-
Select Google+ API from the Social APIs section.
-
On the next page, click the Enable button to enable Google+ API for your project.
-
To generate credentials, select the Credentials tab from the left navigation menu and hit the ‘Create Credentials’ button.
-
From the drop-down, select OAuth client ID.
-
On the next screen, select the application type (web application in this case) and enter your authorized javascript origins and redirect uri. For now, just set the origin as http://localhost:8000 and the redirect URI as http://localhost:8000/complete/google-oauth2/
-
Now, open the
.env
file and add your Google OAuth credentials.
-
-
Generate Facebook login credentials with the following steps:
-
Click on My Apps and then Add a New App.
-
Enter Display Name and Contact Email and click on Create App Id.
-
Select Facebook login and choose set up. Pick Web on the next page.
-
Enter
http://localhost:8000
as the Site Url and hit Save. -
Now go to Settings/Basic and then in the App Domains just put
localhost
and hit Save Changes. -
Grab the App ID and App Secret and add them to the
.env
file.
-
Migrate your database and run the Django Development Server.
./manage.py makemigrations ./manage.py migrate ./manage.py runserver
-
Open
http://localhost:8000
in your browser. (Openinghttp://127.0.0.1:8000
will cause problems with Social Login)
-
Add the cronjob
./manage.py crontab add
-
Load the fixtures
./manage.py loaddata fixtures.json
-
Run the server and the prices should get updated every minute. Now, buy and sell stocks to make profit. Enjoy!
Freemex uses the following technologies:
- HTML/CSS/JavaScript
- Pyhton(Django)
If you want to contribute to this project, then have a look here