I need some VBA code translated to Python quickly. It's about 1000 lines of code including breaks and comments, probably more like 600 without. The code is fully functional and is attached to this email along with the data that serves as input.
This should more or less be a 1-to-1 translation job except for two caveats:
1) In a couple of places, the code relies on the built in Excel sort function. This function should be replicated in Python using Python native libraries or you may modify the included QuickSort function I provided.
2) The input data is currently stored on an excel spreadsheet. Please replicate this data in JSON format and output as JSON.
I run a financial services company which manages client stock portfolios. This code constitutes 3 programs:
1) A contribution program where a client gives us money to invest and we choose which assets and in which proportions to allocate the money.
2) A withdrawal program where a clients requests to withdraw money and we choose which assets and in which proportions to withdraw money from.
3) A rebalancing program where if the clients portfolio drifts too far from its targeted weightings, the code will bring the assets back into balance.
I will provide a guide to the functions and subroutines upon request.