-
-
Monte Carlo Stochastic Engine: 5,000 vectorized simulation paths projecting P10, P50, and P90 wealth percentiles against the target goal.
-
PayPal AI Copilot: Autonomous agent evaluating goal gaps and preparing human-in-the-loop funding via PayPal Sandbox.
-
Holdings & Liquidity Guard: Real-time multi-asset ETF valuation with clear separation of available cash and ring-fenced emergency reserves
-
Natural-Language Goal Compiler: Gemini 1.5 compiles plain-English goals into structured targets with a protected cash reserve floor.
-
Holdings & Liquidity Guard: Real-time multi-asset ETF valuation with clear separation of available cash and ring-fenced emergency reserves.
-
Immutable Audit Ledger: Verifiable transaction history tracking deposits, broker trades, and PayPal payment records.
-
PayPal Agent Tool Call: Live structured tool schema (create_paypal_funding_order) generated by Gemini alongside settlement history
-
Public Open-Source Repo: Clean public GitHub repository licensed under MIT with full installation documentation.
-
Architecture & Test Coverage: In-depth README detailing PayPal REST v2 endpoints and 10/10 passing integration tests
💡 Inspiration Most Wealth Managers offer a very inflexible approach to managing risk questionnaires and portfolio allocation, often using standalone spreadsheets. We wanted to create an end-to-end, agentic Wealth Copilot which allows investors to provide a natural language goal. This is then converted to a mathematical portfolio, simulated using stochastic processes and funded using PayPal. An emergency reserve has been built in which can’t be violated.
🚀 What it does The GD-IPCA™ Mark 2 (Goal Driven Intent-to-Portfolio Compilation & Agentic Execution Engine) allows financial planning in natural language and provides integration with the PayPal Developer Platform. Natural Language Goal Compilation
This will convert natural language prompts into a structured format using the Google Gemini 1.5 Flash. For example "Accumulate $300,000 for early retirement in 8 years with $40,000 in safe cash". Stochastic Monte Carlo Risk Analysis This runs 5000 market scenarios using 4 different economic regimes and Student-t distribution shocks. We then analyse the 10th, 50th and 90th percentiles and plot these in a fan chart (SVG). PayPal AI Copilot & Agentic Provide integration with the PayPal Agent Tools. These include; paypal_create_order, paypal_capture_order, paypal_create_payout. The agent will analyse the health of the portfolio relative to the Monte Carlo results. It will then provide a plan with actions for the user. Real PayPal Sandbox API’s PayPal Orders V2 (CAPTURE) Automatically generate deposits during checkout. PayPal Payouts V1 Automatically payout milestone amounts.
Fiduciary Reserve Limit The code has been designed with a hard coded reserve limit to ensure no funds are paid out via PayPal if the reserve amount is violated. Portfolio Execution & Logging This will track how much of each of the 16 ETF’s you have. It will also track drift and automatically trade to rebalance you. It will also keep a log of all transactions in SQL. 🛠 How we built it FastAPI was used along with Python 3.9+. We used SQLAlchemy with MySQL 8.0 support with an optional SQLite database. PayPal
We created a custom PayPal Client to integrate with the PayPal REST API V2. This includes; Token Cache (OAuth2), Order V2 Creation & Capture and Payouts V1. We support using real PayPal Sandbox details however have a hermetic fallback. AI & Agentic Integrate with Google Gemini 1.5 Flash for intent understanding and planning. We have used the standard PayPal Agent Tools. Quantitative Used NumPy and SciPy to provide Geometric Brownian Motion, Cholesky decomposition and simulate trajectories. Front End Responsive Glass Dashboard showing real time data. SVG charts and PayPal checkout approval.
🏆 Challenges Two Step Checkout (Agentic) We had to design a clean UI/UX to allow the user to authorise the purchase after the agent has created the order. The user is prompted to approve the order in the PayPal Sandbox Checkout. The order is then captured. Fiduciary Reserve Ensure that the AI can never pay out any funds that have been allocated to the fiduciary reserve. Python 3.9 Compatibility & Hermetic Ensuring that our tests ran without issues when run in a hermetic environment.
🏅 Accomplishments 10/10 End to End tests passed. This included creating a user, compiling the intent, running Monte Carlo, trading the portfolio, rebalancing, PayPal orders and PayPal payouts. End to End integration between Generative AI reasoning and real financial transactions using PayPal. No drift in fiduciary reserve.
📚 Learning Become familiar with the PayPal REST API V2. OAuth2 tokens and Batch Payouts.
🔮 Future Improvements Support multi currency using PayPal Global Payouts. Integrate with PayPal Subscriptions API for Dollar Cost Averaging (DCA). Auto capture using webhooks and notify when milestones have been reached.
Built With
- agentic-commerce
- ai-agent
- fastapi
- gemini-api
- javascript
- numpy
- paypal
- pytest
- python
- scipy
- sqlalchemy
- sqlite
- tailwind