Algo Invest & Trade

Project information

  • GitHub URL: https://github.com/DoriDoro/algoInvest_trade
  • create date: June 16, 2023
  • evaluation date: Sept. 9, 2023
  • Skills:

    Python

    CLI (Command Line Interface) application

    Git

    GitHub

    CSV (Comma-separated values)

    Menu-navigation


Introduction

In this project, I developed a Python application focused on solving optimization problems using various algorithms, including brute-force, greedy, and branch-and-bound techniques. The project applies these algorithms to a dataset of financial data with 1,000 entries, with the goal of finding optimal solutions while considering performance trade-offs.

Workflow:

      • Brute-Force Algorithm: Exhaustively searches for the optimal solution, demonstrating both its accuracy and its inefficiency for large datasets.
      • Greedy Algorithm: Implements a faster but potentially suboptimal solution by making locally optimal choices.
      • Branch-and-Bound Algorithm: Reduces the search space while still ensuring an optimal solution, offering a more balanced approach compared to brute-force.
      • Data Cleaning: Uses pandas to clean, filter, and process financial data.
      • System Monitoring: Uses psutil to display real-time CPU and memory usage, providing insights into the system's performance during execution.

This project highlights the application of advanced algorithms and efficient data handling techniques while providing insights into system resource usage during computation. It also emphasizes the balance between algorithmic accuracy and performance in real-world scenarios.

 


Competences

    • find a "brute-force" solution
    • Big O notation, algorithm
      • branch_bound algorithm solution
      • greedy algorithm solution
    • CLI application
    • navigation
    • numpy
    • pandas (cleaning the data, duplicates, remove negative or zero values etc)
    • psutil (process and system utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network, sensors) in Python.
    • writing data in CSV file
    • reading data out of CSV file
    • OS
    • itertools (Functions creating iterators for efficient looping)


Learning Experience

1. Brute-Force Solution

The project starts with implementing a brute-force algorithm that systematically checks all possible combinations to find the optimal solution. Although brute-force guarantees finding the best solution, its computational complexity is high, making it inefficient for large datasets. To analyze this, I applied Big O notation to quantify the time complexity of the brute-force approach and demonstrate its scalability challenges.

2. Big O Notation and Algorithm Analysis

For each algorithm, I provided an analysis of its time complexity using Big O notation. This includes:

      • Brute-Force: Exhaustive search with exponential complexity.
      • Branch-and-Bound Algorithm: A more efficient approach that systematically eliminates unviable solutions based on bounds, reducing the search space while still guaranteeing optimal results.
      • Greedy Algorithm: A heuristic-based approach that makes locally optimal choices at each step, with the goal of finding a good, though not necessarily optimal, global solution.

Each algorithm’s performance and efficiency are compared using Big O notation, highlighting their strengths and weaknesses for this specific dataset.

3. Command-Line Interface (CLI) Application

The entire application is a CLI-based tool, where users can select which algorithm to run and view the results directly from the console. The navigation system allows users to choose between different modes (brute-force, branch-and-bound, or greedy algorithm) and observe how each method processes the data and arrives at a solution.

4. Data Handling with NumPy and Pandas

The financial dataset was handled using pandas and NumPy for efficient data manipulation. I used Pandas for tasks such as:

      • Cleaning the data: Removing duplicate entries and ensuring the dataset was free of anomalies like negative or zero values.
      • Reading from and writing to CSV files: The cleaned data is written back to a CSV file, ensuring it is formatted and ready for analysis.

NumPy provided high-performance data processing for mathematical computations involved in the algorithmic steps.

5. itertools for Efficient Iteration

To optimize the iteration process, I utilized itertools, a Python library that generates efficient iterators. Functions like combinations, permutations, and product were key in generating candidate solutions in the brute-force and branch-and-bound algorithms, ensuring that the looping process remained memory-efficient even for large datasets.

6. psutil for System Monitoring

The project integrates psutil to monitor system resources such as CPU, memory usage, and disk utilization during algorithm execution. This was crucial for understanding how each algorithm impacts system performance, especially when handling large datasets. Users can view real-time statistics on resource consumption, making the application not only functional but also informative about the system's state.

7. Operating System Integration

The project uses Python’s os module for system-level operations, such as handling file paths for reading and writing CSV files and interacting with the local file system for data storage and retrieval.

Designed by BootstrapMade and modified by DoriDoro