Coder Social home page Coder Social logo

cclngit / investmentsimulator_web Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 7.23 MB

This code provides a Flask API for simulating and plotting investment scenarios over time.

Home Page: https://www.ciciliano.fr

HTML 0.10% JavaScript 0.10% Python 99.50% CSS 0.01% PowerShell 0.28% Batchfile 0.01%

investmentsimulator_web's Introduction

Investment Simulator

This code provides a Flask API for simulating and plotting investment scenarios over time.

Usage

  1. Simulation Endpoint: /simulate (POST)

    • Use this endpoint to simulate investments.
    • Input JSON format:
      {
        "duration": 10,
        "initial_salary": 50000,
        "savings_rate": 20,
        "investments": [
          {
            "name": "Investment 1",
            "rate": 5,
            "initial_amount": 10000,
            "allocation_percentage": 50
          },
          {
            "name": "Investment 2",
            "rate": 8,
            "initial_amount": 20000,
            "allocation_percentage": 50,
            "fees": 1.5
          }
        ],
        "salary_changes": [
          {
            "year": 5,
            "new_salary": 60000
          }
        ]
      }
    • Output JSON format:
      [
        ["Investment 1", 123456.78],
        ["Investment 2", 98765.43]
      ]
  2. Plotting Endpoint: /plot (POST)

    • Use this endpoint to plot investment data.
    • Input and output formats are similar to the simulation endpoint.

Installation

  1. Clone the repository:

    git clone https://github.com/ucclngit/InvestmentSimulator_web.git
  2. Install dependencies (no requirement.txt yet):

    pip install -r requirements.txt
  3. Run the Flask server:

    python app.py

Class InvestmentSimulator

Methods

  • __init__(duration, initial_salary, savings_rate, currency="โ‚ฌ"): Initializes the simulator.
  • change_salary(year, new_salary): Changes the salary at a given year.
  • add_investment(name, rate, initial_amount, allocation_percentage, fees=0): Adds an investment.
  • simulate(): Simulates the evolution of all investments over time.
  • data_investments(): Saves the evolution of all investments over time.

Contributing

Contributions are welcome! Please feel free to submit pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.