An automated cryptocurrency trading plugin for Solana tokens with integrated trust scoring, market analysis, and Twitter notifications.
- Automated trading on Solana blockchain
- Real-time market data analysis using DexScreener
- Trust score evaluation for tokens
- Twitter integration for trade notifications
- Safety limits and risk management
- Simulation capabilities before executing trades
- Performance tracking and trade history
- Rate limiting and cache management
npm install @elizaos/plugin-rabbi-trader
The following environment variables need to be configured:
WALLET_PRIVATE_KEY
: Your Solana wallet private keyWALLET_PUBLIC_KEY
: Your Solana wallet public addressSOLANA_RPC_URL
: Solana RPC endpoint (defaults to mainnet)BIRDEYE_API_KEY
: API key for Birdeye data providerTWITTER_ENABLED
: Enable/disable Twitter notificationsTWITTER_USERNAME
: Twitter username for notificationsDEXSCREENER_WATCHLIST_ID
: DexScreener watchlist identifierCOINGECKO_API_KEY
: CoinGecko API key for additional market data
import createRabbiTraderPlugin from '@elizaos/plugin-rabbi-trader';
import { IAgentRuntime } from '@elizaos/core';
const plugin = await createRabbiTraderPlugin(
(key: string) => process.env[key],
runtime
);
// Plugin will automatically start monitoring and trading if enabled
The plugin includes built-in safety limits that can be configured:
export const SAFETY_LIMITS = {
MINIMUM_TRADE: 0.01, // Minimum SOL per trade
MAX_POSITION_SIZE: 0.1, // Maximum 10% of token liquidity
MAX_SLIPPAGE: 0.05, // Maximum 5% slippage allowed
MIN_LIQUIDITY: 1000, // Minimum $1000 liquidity required
MIN_VOLUME: 2000, // Minimum $2000 24h volume required
MIN_TRUST_SCORE: 0.4, // Minimum trust score to trade
STOP_LOSS: 0.2, // 20% stop loss trigger
TAKE_PROFIT: 0.12, // Take profit at 12% gain
TRAILING_STOP: 0.2 // 20% trailing stop from highest
};
Default trading parameters can be adjusted in the configuration:
{
CHECK_INTERVAL: 5 * 60 * 1000, // Check every 5 minutes
REENTRY_DELAY: 60 * 60 * 1000, // Wait 1 hour before re-entering
MAX_ACTIVE_POSITIONS: 5, // Maximum concurrent positions
MIN_WALLET_BALANCE: 0.05 // Keep minimum 0.05 SOL in wallet
}
The plugin integrates with multiple APIs:
- Birdeye API: Market data and token security information
- DexScreener: Real-time trading data and market analysis
- Twitter: Trade notifications and updates
- Jupiter: Token swaps and liquidity aggregation
The plugin includes comprehensive error handling for common scenarios:
export const ERROR_SIGNATURES = [
{
sig: "0x13be252b",
name: "InsufficientAllowance",
description: "Token allowance too low"
},
{
sig: "0xf4d678b8",
name: "InsufficientBalance",
description: "Insufficient token balance"
},
// ... additional error signatures
];
The plugin performs detailed analysis before executing trades:
- Token security evaluation
- Market data analysis
- Trust score calculation
- Liquidity assessment
- Volume verification
- Price movement analysis
- Holder distribution review
When enabled, the plugin can post trade notifications with:
- Token information
- Trade details (buy/sell price, amount)
- Trust score and risk level
- Market metrics
- Transaction signature
- Profit/loss for sells
The plugin implements multiple caching mechanisms:
- Token analysis cache (20 minutes)
- Twitter rate limiting cache (hourly limits)
- Skip/wait cache (2 hours)
- Analysis history (24 hours)
npm run build
npm run dev
Key dependencies include:
@solana/web3.js
: Solana blockchain interaction@elizaos/core
: Core agent runtime@elizaos/plugin-solana
: Solana integration@elizaos/plugin-trustdb
: Trust score databasenode-cache
: Caching functionalitybignumber.js
: Precise number handling
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.