πŸ€–Example - Trading Bot

This example demonstrates how to create an intelligent trading bot specifically designed for Yoink bonding curve tokens, with features for monitoring market conditions, price movements, and automated trading strategies using the real SDK.

Overview

This bot will:

  • Monitor bonding curve tokens across the Yoink protocol

  • Track market cap, buyer activity, and price movements

  • Execute buy orders based on momentum and market conditions

  • Implement stop-loss and take-profit strategies with slippage protection

  • Log all trading activity with detailed analytics

  • Send notifications for important price movements

Prerequisites

  • Yoink SDK installed: npm install yoink-sdk

  • Funded wallet with SOL for trading

  • Basic understanding of bonding curves and trading concepts

Script Code

Configuration Options

Option
Type
Default
Description

targetTokens

Array

[]

Token mint addresses to monitor

maxMarketCap

Number

50

Maximum market cap in SOL

minBuyers

Number

10

Minimum number of buyers required

onlyIncompleteCarves

Boolean

true

Only trade incomplete bonding curves

buyAmount

Number

0.01

SOL amount per trade

maxSlippage

Number

500

Maximum slippage in basis points

maxPriceImpact

Number

3

Maximum price impact percentage

profitTarget

Number

25

Profit target percentage

stopLoss

Number

-15

Stop loss percentage

maxPositions

Number

5

Maximum concurrent positions

enableMomentumTrading

Boolean

true

Enable momentum analysis

Bot Features

  • Real Market Analysis: Uses actual bonding curve data for decision making

  • Momentum Detection: Analyzes buyer growth and price trends

  • Risk Management: Automatic stop-loss and take-profit execution

  • Position Tracking: Comprehensive position management

  • Slippage Protection: Built-in price impact and slippage controls

  • Market Cap Filtering: Focuses on tokens within specified market cap range

Safety Features

  • Max Position Limits: Prevents over-exposure

  • Price Impact Checks: Avoids high-impact trades

  • Stop Loss Protection: Automatic risk management

  • Curve Completion Detection: Exits positions when curves complete

  • Comprehensive Logging: Detailed trade history and performance

Running the Bot

  1. Set up your keypair and configuration

  2. Add target token mints to monitor

  3. Adjust risk parameters for your strategy

  4. Run with npx ts-node trading-bot.ts

⚠️ Important: Test thoroughly on testnet before using real funds!

Safety Features

  • Slippage Protection: 5% maximum slippage on all trades

  • Error Handling: Continues monitoring even if individual trades fail

  • Position Tracking: Prevents duplicate orders

  • Logging: Comprehensive trade logging for analysis

Running the Script

  1. Install dependencies:

  2. Configure your settings:

    • Replace yourWalletAdapter with your actual wallet adapter

    • Add real token addresses to monitor

    • Adjust thresholds and amounts for your strategy

  3. Run the script:

Next Steps

Last updated