Trading Features
This document provides a detailed explanation of the trading capabilities in the Nyla AI platform.
Buy Feature
The buy feature allows users to purchase tokens on the Solana blockchain.
How it works
Command Parsing: The system parses the buy command from social media mentions
User Verification: The system verifies the user has a wallet configured
Size Determination: The trade amount is determined based on the specified size (small, medium, ape)
Token Purchase: The system executes the purchase through the Pump Portal API
Transaction Verification: The transaction is verified on the blockchain
Record Creation: A record of the trade is created in the database
Response Generation: The user receives a confirmation with transaction details
Buy Parameters
Contract Address: The address of the token to purchase
Size: The trading size (small, medium, ape)
Slippage: Fixed at 10% to account for price movements
Sell Feature
The sell feature allows users to sell tokens they own.
How it works
Command Parsing: The system parses the sell command from social media mentions
User Verification: The system verifies the user has a wallet configured
Size Determination: The percentage to sell is determined based on the specified size:
Small: 25% of tokens
Medium: 50% of tokens
Ape: 100% of tokens (full dump)
Token Sale: The system executes the sale through the Pump Portal API
Transaction Verification: The transaction is verified on the blockchain
Record Creation: A record of the trade is created in the database
Response Generation: The user receives a confirmation with transaction details
Sell Parameters
Contract Address: The address of the token to sell
Size: The trading size (small, medium, ape) which determines sell percentage
Slippage: Fixed at 10% to account for price movements
Trade History
Users can access their trade history through the platform:
View all past trades
Filter by buy/sell operations
See transaction details including:
Transaction hash
Contract address
Token symbol
Trade type (buy/sell)
Size (small, medium, ape)
Amount in SOL
Status (completed, pending, failed)
Timestamp
Solscan URL for blockchain verification
Trading Statistics
The platform provides trading statistics:
Total SOL traded
Number of trades executed
Success rate of transactions
Distribution of trade sizes
Error Handling
The trading system includes robust error handling:
Insufficient Funds: Detection and notification of insufficient funds
Rate Limiting: Protection against excessive trading operations
API Failures: Graceful handling of external API failures
Transaction Failures: Detection and reporting of failed transactions
Retry Mechanisms: Exponential backoff for retrying failed operations
Transaction Monitoring
All transactions are monitored for:
Confirmation status
Execution time
Success/failure
Error conditions
Fee consumption
Last updated