Case Study: Streamlining Strategy Testing for a public market fund

Client Overview

Client A public investment fund based in Dubai
Industry Finance
Technology Used Python, Gradio, Excel

Objective: Build a web-based interface to accelerate and improve strategy testing

Background

A public investment fund in Dubai was using a legacy Excel and VB Macros-based tool to test financial strategies on historical data. While functional, this tool was plagued by several critical issues:

  • Performance Problems: The tool was slow, making it inefficient for running multiple or complex scenarios.
  • Lack of Flexibility: The code was rigid, limiting the ability to test new or modified strategies quickly.
  • Error-Prone System: The underlying code was poorly structured, increasing the chance of errors during execution.

Given these limitations, the client sought to transition to a modern, web-based solution that could offer faster execution times, greater flexibility for testing strategies, and the potential for expansion.

Key Deliverables and Challenges

  • Speed up strategy execution: Reduce the time taken to test each scenario.
  • Eliminate errors: Provide a more reliable and stable environment.
  • Improve flexibility: Create a system that allows easy adjustment and expansion of testing attributes.
  • Ensure deployment and local machine compatibility: Allow the client to deploy and edit the code locally if necessary.

Results & Impact

  1. Speed and Efficiency: Strategy testing execution time was slashed by 80%, allowing the client to test 4x more scenarios in the same timeframe, significantly accelerating decision-making.
  2. Scalability: The modular design made the tool highly adaptable, enabling the effortless addition of new strategies or updates, ensuring future-proof flexibility.
  3. Error Reduction: Improved architecture and separation of processes eliminated common errors, delivering a system that was more reliable than the legacy tool.
  4. Enhanced Usability: With a user-friendly web interface and automated time-stamped outputs, comparing strategies became seamless, improving workflow efficiency by 40%.

This innovative Python-based solution transformed strategy testing for the client, providing a faster, more flexible, and reliable platform for financial decision-making.

By the Numbers

  • 80% reduction in execution time for strategy testing.
  • 4x increase in scenarios tested within the same timeframe.
  • 40% boost in workflow efficiency through enhanced usability and automated outputs.

Solution

To address these challenges, we built a Python-based tool with a Gradio UI. Python was selected because the client’s team was already familiar with the language, making it easier to manage, while also allowing for faster development compared to other technologies.

Key Components of the Solution

  1. Web-Based Interface via Gradio
  • We created an intuitive web interface using Gradio, which allowed the client to easily trigger and monitor strategy tests from a web browser. This interface was designed with multiple tabs, enabling simultaneous testing of multiple strategies and separation of logic for each.
  1. Excel Integration
  • The tool took the client’s existing Excel data files as input, allowing them to use their familiar data structures without needing extensive modifications. This flexibility allowed for both historical and real-time data testing, a feature critical for their operations.
  1. Modular Computation Layer
  • One of the core improvements was the modularization of the computation layer. Each strategy was divided into separate modules, making the system:
    • Scalable: New strategies could easily be added by creating additional modules.
    • Readable and Maintainable: The clear separation of strategy computations made the code easier to read, troubleshoot, and enhance.
  1. Middleware for Input/Output Handling
  • We introduced a middleware that acted as a bridge between the UI and the backend computations. This layer ensured that inputs were properly parsed and handled, and that outputs were formatted consistently before being displayed on the web interface or exported into Excel.
  1. Enhanced Output Features
  • The tool produced detailed results for each scenario, which were:
    • Displayed in the browser for instant analysis.
    • Saved in a time-stamped Excel file, including all intermediate computations, making it easy to trace and compare results across different scenarios.
  1. One-Click Deployment
  • The entire tool could be launched with a single command, simplifying deployment. Additionally, it was designed to be easily editable on local machines, giving the client complete control over updates or modifications to the tool.

Conclusion

The Python-based tool with a Gradio UI transformed the client’s strategy testing workflow. By delivering faster execution times, reducing errors, and enhancing flexibility, the new system empowered the client’s team to experiment with different strategies and optimize their investment decisions. Furthermore, the tool’s modular architecture and compatibility with local machines ensured that it would remain a flexible and scalable solution for the client in the long term.