Skip to content

mgi25/Trading-Journal-Performance-Tracker_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trading Journal & Performance Tracker

A simple Flask application that allows users to:

  • Manage Users (CRUD)
  • Manage Trades (CRUD)
  • Analyze Trade Performance (win/loss, most profitable, average profit, etc.)
  • Track Strategies & Notes (CRUD)
  • Add Comments on trades (CRUD)

1. Data File (data.json)

This file contains sample data structures for:

  • users (dictionary)
  • trades (list)
  • strategies (dictionary)
  • comments (list)

A minimal example:

{
  "users": {
    "1": { "name": "Alice", "email": "alice@example.com" },
    "2": { "name": "Bob", "email": "bob@example.com" }
  },
  "trades": [
    {
      "id": 1,
      "user_id": 1,
      "asset": "AAPL",
      "quantity": 10,
      "profit": 200
    }
  ],
  "strategies": {
    "1": [
      {
        "id": 1,
        "user_id": 1,
        "description": "My initial strategy"
      }
    ],
    "2": []
  },
  "comments": []
}

2. Endpoints (25)

A. User Management (5 Endpoints)

  1. GET /users

    • Retrieve all users.

    alt text

  2. GET /users/<user_id>

    • Retrieve a single user by ID (integer).

    alt text

  3. POST /users

    • Create a new user (body with JSON fields, e.g., name, email).

    alt text

  4. PUT /users/<user_id>

    • Update existing user data (body with JSON to update fields).

    alt text

  5. DELETE /users/<user_id>

    • Delete a user by ID.

    alt text


B. Trade Management (5 Endpoints)

  1. GET /trades

    • Retrieve all trades.

    alt text

  2. GET /trades/<trade_id>

    • Retrieve a specific trade by ID.

    alt text

  3. POST /trades

    • Add a new trade (body with JSON fields like user_id, asset, profit, etc.).

    alt text

  4. PUT /trades/<trade_id>

    • Update a trade.

    alt text

  5. DELETE /trades/<trade_id>

  • Delete a trade by ID.

alt text


C. Trade Performance (5 Endpoints)

  1. GET /trades/user/<user_id>
  • Retrieve all trades belonging to a single user.

alt text

  1. GET /trades/win-loss/<user_id>
  • Return the count of winning (profit > 0) vs losing (profit < 0) trades.

alt text

  1. GET /trades/most-profitable
  • Return the top 5 trades by highest profit.

alt text

  1. GET /trades/average-profit/<user_id>
  • Calculate the average profit for trades belonging to a user.

alt text

  1. GET /trades/most-traded-assets/<user_id>
  • List distinct assets a user has traded.

alt text


D. Strategy & Notes (5 Endpoints)

  1. GET /strategy
  • Get all strategies across all users.

alt text

  1. GET /strategy/<user_id>
  • Get strategies belonging to one user.

alt text

  1. POST /strategy
  • Add a new strategy (body includes user_id and description).

alt text

  1. PUT /strategy/<strategy_id>
  • Update a strategy’s details.

alt text

  1. DELETE /strategy/<strategy_id>
  • Delete a strategy by ID.

alt text


E. Trade Comments (5 Endpoints)

  1. GET /comments
  • Retrieve all comments.

alt text

  1. GET /comments/<comment_id>
  • Retrieve a specific comment by ID.

alt text

  1. POST /comments
  • Add a new comment (body includes trade_id, user_id, and text).

alt text

  1. PUT /comments/<comment_id>
  • Update an existing comment.

alt text

  1. DELETE /comments/<comment_id>
  • Delete a comment by ID.

alt text


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages