This Git repository is a comprehensive stock market simulation application. It provides a set of RESTful API endpoints for managing users, stock data, and transactions, with the goal of simulating stock market activities.
- Clone the repository: git clone https://github.com/malikali3419/Stock-Market-Simulation.git
- Change to the project directory:
$ cd Stock Market Simulation/- Install dependencies:
$ go get -d -v $(cat dependencies.txt)- Set up the environment variables:
DATABASE_URL: Connection string to your PostgreSQL databasePORT: Add your desire PORT
- Migrate the models
go run migrate/migrate.go - Get the build of project:
$ go build -o Stock_Market_Simulation- Run the project:
$ go run main.go- Sign up: Send a POST request to
/signupwith the following JSON body:{ "username": "your-username", "password": "your-password" } - Log in: Send a POST request to
/loginwith the same JSON body. You'll receive a JWT token in the response.
-
Authenticate: Include the JWT token in the
Authorizationheader for subsequent requests. -
Add Stocks: Send a POST request to
/stockswith the following JSON body:{ "ticker":"GOOGL", "openprice":10, "closeprice":20, "high":50, "low":20, "volume":900 }Get all stocks: Send a GET request to/stocksto retrieve a list of all Stocks. -
To get all users send Get request on
/allUsers. -
To get a Specific user send get request or this url
/user/name. -
To get the Stock of specific ticker send Get request on this url
/stock/ticker name -
Do Transaction by sending POST request on this url
/transactionsthis will be run on background -
To get all transactions send Get request on this url
/transactions/:user_idthis will return all the transaction of the specific user -
To get the transaction of the user between specific time send get request on this url
/transactions/:user_id/:start_time/:end_time
-
Fork the repository.
-
Create a new branch:
git checkout -b feature-new-feature -
Make your changes and commit:
git commit -m "Add new feature -
Push to the branch:
git push origin feature-new-feature -
Submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.