Skip to content

YieldYatra is an advanced autonomous AI-driven trading agent designed specifically for the decentralized finance (DeFi) ecosystem, seamlessly integrated with the Aptos blockchain. It autonomously manages crypto portfolios by leveraging innovative, Japanese-inspired trading frameworks, advanced mathematical models, and sophisticated risk management

License

Notifications You must be signed in to change notification settings

Ronit26Mehta/YieldYatra-An-Autonomous-AI-Agent-for-DeFi-Trading-with-Aptos-Integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


πŸ“ˆ YieldYatra: Autonomous AI Agent for DeFi Trading with Aptos Integration

πŸš€ Project Overview

YieldYatra (DefAIAgent) is an autonomous Artificial Intelligence agent tailored for Decentralized Finance (DeFi) trading. This innovative platform optimizes yield, manages risk dynamically, and automates portfolio rebalancing actions through seamless integration with the Aptos blockchain. It harnesses advanced Japanese-inspired crypto trading strategies, making it particularly suited for volatile cryptocurrency markets.


🌟 Key Features

  • Autonomous Trading: Automated portfolio management and strategy execution.
  • Blockchain Integration: Secure transactions on Aptos blockchain via the official Aptos SDK.
  • Advanced Algorithms: Combines Yield Score, Risk Index, and dynamic allocation models.
  • Interactive Visualization: Real-time insights and visual analytics using Plotly and Streamlit.

πŸ›  Project Architecture

YieldYatra consists of several integrated modules:

  • Data Acquisition (CCXT, CSV sources)
  • Metrics Computation: Yield Score, Risk Index calculation.
  • Trading Strategies: Japanese-inspired mathematical frameworks (KAGE, KITSUNE, RYU, SAKURA, HIKARI, TENSHI, ZEN).
  • Rebalancing Signals: Automated triggers for portfolio adjustments.
  • Frontend Interface: Streamlit application for easy user interaction.
  • Logging & Monitoring: Detailed trade logs and interactive visualizations.

System Design:

  1. Activity Diagram alt text

  2. System Design: alt text

  3. User Flow Diagram: alt text


πŸ“‚ Project Structure

YieldYatra/
β”œβ”€β”€ backend/
β”‚   └── aptos_backend.py
β”œβ”€β”€ frontend/
β”‚   └── aptos_frontend.py
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ Aptos AI Agent.pdf
β”‚   β”œβ”€β”€ aptos trader.pdf
β”‚   └── japanses-inspired-trading-strategy.pdf
β”œβ”€β”€ design
β”‚   β”œβ”€β”€ Activity Diagram.png
β”‚   β”œβ”€β”€ system-design.png
β”‚   └── user flow diagram.png
└── output
    └── trades.log

🧠 Algorithmic Strategies and Frameworks

πŸ“Œ defAI Algorithm (Core Strategy)

The defAI strategy autonomously optimizes yields, manages risks, and triggers rebalancing transactions using:

  • Yield Score: $$ \text{Yield Score}(t) = \frac{\mu_r(t)}{\sigma_r(t) + \epsilon} $$ where ( \mu_r(t) ) is the rolling mean return, and ( \sigma_r(t) ) is volatility.

  • Risk Index: $$ \text{Risk Index}(t) = \sigma_r(t) \times 100 $$

  • Rebalancing Signal:

    if |allocation - target| > 0.1, execute blockchain rebalance transaction.
    

🎌 Japanese-Inspired Trading Frameworks

1. Kage no Suiri (Shadow Logic Strategy)

  • Uses GARCH volatility modeling and Hidden Markov Models (HMM) for market state detection.

2. Kitsune no Kōsen (Fox’s Beam Framework)

  • Employs Dynamic Time Warping (DTW) and Neural Networks for price forecasting.

3. Ryu no Riron (Dragon’s Theory Algorithm)

  • Applies fractal dimensions and Lyapunov exponent calculations to identify chaotic market conditions.

4. Sakura no Kagami (Cherry Blossom Mirror Model)

  • Implements regression with mirror constraints for trend prediction and trading signals.

4. Hikari no Suishin (Advance of Light Momentum)

  • Leverages Principal Component Analysis (PCA) for momentum-based trade signals.

5. Tenshi no Shikaku (Angel’s Geometry Framework)

  • Uses topological data analysis (persistent homology) for identifying significant market features.

6. Zen no Ritsu (Zen Rhythm Trading Model)

  • Incorporates wavelet analysis for trend and cycle detection, signaling trades based on market rhythms.

🌐 Frontend Interface (Streamlit)

Interactive Web Dashboard:

  • User-friendly GUI for configuring strategies, exchanges, symbols, RSI/MA parameters, and backtesting.
  • Real-time visualization of trade results and performance metrics.
  • Easy downloading of historical trade logs and CSV data.

βš™οΈ Backend API (Flask-based)

The backend API provides endpoints for:

  • Market data acquisition (using CCXT or local CSV files)
  • Execution of trading strategies (RSI, MA, RSI_MA, advanced Japanese-inspired frameworks)
  • Blockchain Transactions (via Aptos SDK integration)
  • Plot generation (matplotlib and Plotly-based visuals for market analysis)

πŸ“Š How to Run

πŸ› οΈ Installation & Setup

git clone https://github.com/yourusername/YieldYatra.git
cd YieldYatra
pip install -r requirements.txt

Ensure the backend Flask server is running:

python backend/aptos_backend.py

Start the frontend Streamlit application:

streamlit run frontend/aptos_frontend.py

πŸ–₯️ Usage Instructions

  • Launch the frontend UI at: http://localhost:8501
  • Configure parameters in the sidebar.
  • Execute backtesting by clicking "Run Backtest".

πŸ“Š Visualization & Metrics

  • Interactive Plotly charts displaying:

    • Yield Scores
    • Risk Indices
    • Trade entry and exit points.
  • Performance Metrics:

    • Total Trades
    • Win Rate (%)
    • Total Return (%)
    • Average Return per Trade (%)

πŸ”— Aptos Blockchain Integration

The system leverages the Aptos SDK to securely execute on-chain transactions:

  • Portfolio rebalancing
  • Yield harvesting
  • Secure and transparent execution of automated trading strategies.

πŸ“ Documentation & Theory

Detailed technical and theoretical documentation are provided:


🀝 Contributing

We welcome contributions! Fork this repository, create your feature branch, and submit a pull request.


πŸ“„ License

Distributed under the MIT License.


✨ Conclusion

YieldYatra is a comprehensive, sophisticated DeFi solution integrating mathematical rigor with practical blockchain execution. It is designed for researchers, crypto enthusiasts, and professional traders seeking automated, AI-driven trading solutions.


πŸ“Œ Note: Ensure the backend Flask service and Aptos blockchain access are correctly configured for optimal performance.


About

YieldYatra is an advanced autonomous AI-driven trading agent designed specifically for the decentralized finance (DeFi) ecosystem, seamlessly integrated with the Aptos blockchain. It autonomously manages crypto portfolios by leveraging innovative, Japanese-inspired trading frameworks, advanced mathematical models, and sophisticated risk management

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages