Video thumbnail

Marp Trade

An innovative DeFi project, built using Starknet. It is an auto trading system on starknet.

Marp Trade

Created At

Agentic Ethereum

Winner of

Nethermind - Create an AI-Powered DeFi Assistant on Starknet

Project Description

Here’s an expanded version of your project description, incorporating more details about trading strategies, risk management, and potential optimizations:

Project Description: Trading Strategies for STRK Native Coin

In this project, I have implemented and evaluated automated trading strategies for the STRK/USDT trading pair, using historical 15-minute interval price data. The objective is to develop a robust data-driven trading model that can identify profitable trade opportunities, optimize execution, and minimize risk in a volatile crypto market.

The dataset consists of key market parameters such as open, high, low, close prices, and trading volume. These features were analyzed using technical indicators, trend analysis, and predictive modeling techniques to build a strategy that can generate effective buy/sell signals.

Trading Strategies and Techniques To construct an efficient trading system, I employed multiple trading strategies, each designed to capture different aspects of market behavior:

  1. Technical Indicator-Based Trading This approach relies on widely used price and volume-based indicators to identify trade opportunities: Moving Averages (SMA & EMA): Detect short-term and long-term trend reversals. Relative Strength Index (RSI): Identifies overbought (>70) and oversold (<30) conditions. Bollinger Bands: Measures price volatility and helps identify breakout opportunities. MACD (Moving Average Convergence Divergence): Tracks momentum shifts for trend-following trades. Volume Weighted Average Price (VWAP): Ensures trades align with market liquidity trends.

  2. Momentum and Trend-Following Strategies To capitalize on market trends, I utilized: Moving Average Crossover Strategy: A short-term EMA (e.g., 9-period) crossing above a long-term EMA (e.g., 21-period) generates a buy signal, while a downward crossover triggers a sell.

  • Ichimoku Cloud Strategy: Determines strong bullish/bearish trends by analyzing price action within the Ichimoku cloud.
  1. Mean Reversion Strategy Markets often revert to their mean value after extreme fluctuations. This approach identifies such points:
  • RSI-Based Mean Reversion: Buy when RSI is below 30 and sell when RSI is above 70.
  • Bollinger Bands Reversion: Buy when the price touches the lower Bollinger Band** and sell when it reaches the upper band.
  1. Breakout Trading Breakout trading takes advantage of sharp price movements after key levels are broken: Support & Resistance Breakout: Trades are executed when price breaks above resistance (buy) or below support (sell). -Volume-Confirmed Breakouts: If breakouts occur with high volume, they indicate stronger price movements.

  2. Machine Learning-Based Strategy For a more sophisticated approach, I integrated predictive models: -Regression Models (Random Forest, XGBoost): Forecast short-term price movements.

  • LSTM (Long Short-Term Memory): A deep-learning model trained on past price sequences to predict the next price.
  • Reinforcement Learning (RL): An AI-driven agent trained to maximize returns by dynamically adjusting trade execution based on rewards.

Backtesting and Strategy Evaluation Before deploying strategies in real markets, backtesting was performed using historical STRK/USDT data:

  • Simulated Trading: Strategies were tested against past price action.
  • Performance Metrics: Returns, Sharpe ratio, max drawdown, and win rate were evaluated.
  • Risk Analysis: Strategies were optimized to limit losses and maximize gains.

Live Trading and Automation To integrate these strategies into a real-world automated trading bot, I implemented: Exchange API Integration: Fetching real-time STRK/USDT data using Binance API / OKX API.

  • WebSocket Streams: Enabling real-time execution based on live market updates.
  • Risk Management Rules: Stop-loss, take-profit, and position sizing techniques were incorporated.
  • Strategy Optimization: Dynamic parameter tuning using historical performance data. Conclusion This research presents a multi-faceted approach to trading the STRK/USDT pair, combining technical analysis, algorithmic execution, and machine learning. The final strategy is designed to adapt to changing market conditions, improving accuracy in trade decision-making.

Further enhancements could include portfolio diversification, hedging techniques, and alternative data sources (e.g., social media sentiment analysis) to refine predictions and trading performance.

This version gives a detailed and structured overview of your work. Let me know if you need further refinements or additions! šŸš€

How it's Made

How It's Made: The Technology Behind the Project

This project is built using a combination of AI agents, blockchain smart contracts (Cairo on Starknet), and a Next.js-based frontend, creating a seamless integration between automated trading intelligence, decentralized execution, and user-friendly interfaces.

  1. AI Agents for Trading Decision-Making

At the core of the trading strategy lies an AI-powered agent designed to analyze historical market data, predict trends, and execute trades autonomously. The AI model is trained using:

  • Supervised Learning for predicting future price movements based on past trends.
  • Reinforcement Learning (RL) to optimize trade execution by dynamically adapting to market changes.
  • Natural Language Processing (NLP) to incorporate Twitter/X and news sentiment into trading decisions.

The AI agent continuously ingests live STRK/USDT market data, processes it through predictive models, and generates buy/sell signals based on learned patterns.

Tech Stack for AI Models:

  • Python for data processing & machine learning model development.
  • Pandas & NumPy for feature engineering and dataset handling.
  • Scikit-learn & XGBoost for predictive analytics and decision trees.
  • TensorFlow/PyTorch for deep learning models (LSTMs for sequence prediction).
  • Stable-Baselines3 for RL-based trade execution optimization.
  1. Smart Contracts on Starknet (Cairo) for Decentralized Execution

To ensure secure and transparent trade execution, I deployed smart contracts on Starknet, written in Cairo. These contracts handle:

  • Automated trade execution when AI signals are triggered.
  • On-chain order validation to prevent manipulative trading activities.
  • Decentralized risk management, allowing users to set stop-loss and take-profit parameters on-chain.
  • Funds custody in smart contracts, ensuring non-custodial security.

By leveraging Starknet’s high-speed, low-cost transactions, the system provides scalable and efficient execution without relying on centralized exchanges.

Tech Stack for Smart Contracts:

  • Cairo (Starknet’s smart contract language) for building on-chain trading logic.
  • Starknet.js for interacting with contracts via the Next.js frontend.
  • Argent X / Braavos Wallets for signing transactions on the dApp.
  1. Next.js for Frontend & Real-Time Trading Interface

The Next.js frontend provides an intuitive dashboard where users can:

  • Monitor AI-generated trading signals in real-time.
  • Connect their Starknet wallets to deposit/withdraw funds.
  • Customize trading parameters (e.g., risk levels, investment amounts).
  • Visualize trade analytics, performance graphs, and market trends.

Tech Stack for Frontend:

  • Next.js for SSR & optimized performance.
  • WebSockets for live price updates and AI signal streaming.
  • Recharts/D3.js for interactive trading charts and analytics.
  • Tailwind CSS for responsive UI/UX design.
  1. Hacky & Innovative Implementations

A few notable and hacky aspects of the project include:

  • AI-Trained Risk Management on L2: The AI model dynamically adjusts stop-loss and take-profit levels based on historical volatility and current market sentiment, ensuring optimized trade execution.
  • Zero-Knowledge Proofs (ZKPs) for Strategy Privacy: Instead of revealing exact trading strategies, ZKPs allow users to verify AI signals' validity without exposing proprietary models.
  • Gas-Optimized Batch Trading: Instead of executing multiple small trades, the system bundles trades into a single Starknet transaction, significantly reducing costs.
  1. How Partner Technologies Helped
  • Starknet’s L2 scaling drastically reduced gas fees, making automated trading affordable.
  • AI models enabled high-frequency, data-driven decision-making, improving trade accuracy.
  • Next.js ensured a fast and responsive UI, making the platform accessible to both novice and expert traders.

Final Thoughts

By combining AI agents, decentralized smart contracts, and a real-time trading interface, this project successfully integrates machine learning-driven trading strategies with on-chain execution, offering a scalable, transparent, and efficient solution for automated trading.

Let me know if you need any further refinements.

background image mobile

Join the mailing list

Get the latest news and updates