You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A General Idea for implementing the functionality. It is pretty simple to go with fastapi for quicker development but flask/django can be a better optimisation option that we can consider. MVT is any day robust.
The approach with fastapi can be described as :
REST API Core Functionality - The main endpoint that handles portfolio optimization:
@app.post("/api/v1/optimize")asyncdefoptimize_portfolio(data: UploadFile=File(...), params: OptimizationRequest=None):
# Read uploaded financial datadf=pd.read_csv(data.file)
# Configure optimization with user parametersconstraints=Constraints(selection=df.columns)
ifparams.constraints["budget"]:
constraints.add_budget()
ifparams.constraints["long_only"]:
constraints.add_box(box_type='LongOnly', upper=params.constraints["upper_bound"])
# Run optimization using PorQuaoptimization=LeastSquares(solver_name='highs', sparse=True)
optimization.constraints=constraintsresult=optimization.solve()
return {
"weights": dict(zip(df.columns, result.x)),
"metrics": {
"objective_value": result.objective_value,
"tracking_error": np.sqrt(result.objective_value)
}
}
# CSV / JSON both can be given as request if needed -> a convertor might be used. CSV makes more sense
FROM python:3.9-slim
RUN pip install --no-cache-dir -r requirements.txt
COPY ..
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
For deployment, the solution can be containerized with all PorQua dependencies and run as a web service, while still maintaining the option to use the interactive Jupyter interface for more detailed analysis.
What IT Does:
RESTful endpoints for data upload and processing
Interactive Jupyter widgets for parameter configuration
Real-time visualization of optimization results
Error handling and validation layers
Integration with PorQua's native optimization engines
I have tried to implement PorQua's core optimization capabilities while making them accessible to a broader audience through modern web interfaces. This is free and open for discussion. Still just an idea
The text was updated successfully, but these errors were encountered:
A General Idea for implementing the functionality. It is pretty simple to go with fastapi for quicker development but flask/django can be a better optimisation option that we can consider. MVT is any day robust.
The approach with fastapi can be described as :
Core components Integration:
LeastSquares
OptimizationData
Constraints
Portfolio
Ultimate Acheivements:
Making PorQua Accessible:
User-Friendly Interface:
Flexible Implementation:
Users can optimize portfolios by either:
Potential usage of these packages:
fastapi
uvicorn
pandas
numpy
python-multipart
pydantic
plotly
ipywidgets
requests
Deployment via a Dockerfile like:
For deployment, the solution can be containerized with all PorQua dependencies and run as a web service, while still maintaining the option to use the interactive Jupyter interface for more detailed analysis.
What IT Does:
I have tried to implement PorQua's core optimization capabilities while making them accessible to a broader audience through modern web interfaces. This is free and open for discussion. Still just an idea
The text was updated successfully, but these errors were encountered: