Welcome to the Stock Simulator API documentation. This API provides endpoints to simulate stock trading and manage user transactions. It's designed to help you create, retrieve, and manage user accounts, stock data, and transactions for a simple stock trading simulation.
- Through Bash script
./start.sh
- Through docker compose
docker compose up --build
# to generate random stock data
docker exec -it fastapi python /app/generate_stock_script.py
Visit the API Doc here to try out the APIs
The Stock Simulator API is a RESTful service built using OpenAPI 3.1.0. It provides functionality to create user accounts, retrieve user details, fetch stock data, manage stock data ingestion, create transactions, and retrieve transaction history. The API is designed to be simple to use and integrate into your stock trading simulation application.
- Method: GET
- Path:
/
- Summary: Home
- Description: Home page
- Response:
- Status Code: 200
- Content Type: application/json
- Schema: Empty
- Method: POST
- Path:
/users/register
- Summary: Create User Account
- Description: Create a new user account
- Request Body:
- Content Type: application/json
- Schema: UserCreate
- Response:
- Status Code: 200
- Content Type: application/json
- Schema: Empty
- Method: GET
- Path:
/transactions/{user_id}/{start_timestamp}/{end_timestamp}
- Summary: Get Transactions By Filter
- Parameters:
user_id
(path parameter): User's IDstart_timestamp
(path parameter): Start timestamp for filtering transactionsend_timestamp
(path parameter): End timestamp for filtering transactions
- Response:
- Status Code: 200
- Content Type: application/json
- Schema: Empty
- Type: object
- Properties:
detail
(array of ValidationError): Validation error details
- Type: object
- Properties:
message
(string): Message content
- Type: object
- Properties:
ticker
(string): Ticker symbolopen_price
(number): Opening priceclose_price
(number): Closing pricecurrent_price
(number): Current pricehigh
(number): High pricelow
(number): Low pricevolume
(integer): Volumetimestamp
(string): Timestamp of stock data
- Type: object
- Properties:
user_id
(integer): User's IDticker
(string): Ticker symboltransaction_type
(string): Transaction typetransaction_volume
(integer): Transaction volume
- Type: object
- Properties:
username
(string): Usernameinitial_balance
(number): Initial balance
- Type: object
- Properties:
loc
(array of anyOf[string, integer]): Location of the errormsg
(string): Error messagetype
(string): Error type
Feel free to explore the endpoints and schemas to understand how to interact with the Stock Simulator API.