@tranzora/agents
v0.1.0
Published
Professional SDK for creating and deploying AI-driven finance agents on Web3 platforms
Maintainers
Readme
@tranzora/agents
Professional SDK for creating and deploying AI-driven finance agents on Web3 platforms
@tranzora/agents is a comprehensive toolkit that enables developers to build, deploy, and manage sophisticated AI-powered financial agents across multiple blockchain networks and social platforms. Built with TypeScript and designed for enterprise-grade applications, it provides everything you need to create autonomous trading bots, portfolio managers, and DeFi yield optimizers.
✨ Features
- 🚀 Multi-Platform Support: Deploy agents on Ethereum, Polygon, Arbitrum, Optimism, Base, Discord, and Telegram
- 🤖 AI-Powered Strategies: Built-in support for arbitrage, momentum, mean-reversion, and trend-following strategies
- 📊 Real-time Analytics: Comprehensive financial forecasting, risk assessment, and performance metrics
- 🔒 Enterprise Security: Type-safe interfaces, comprehensive error handling, and production-ready architecture
- 📈 Advanced Risk Management: VaR calculations, drawdown analysis, and correlation metrics
- 🎯 Flexible Configuration: Customizable risk tolerance, capital allocation, and strategy parameters
🚀 Quick Start
Installation
npm install @tranzora/agentsBasic Usage
import { TranzoraAgent } from '@tranzora/agents';
// Create a new agent
const agent = new TranzoraAgent({
name: 'MyTradingBot',
platform: 'ethereum',
treasury: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
initialCapital: 50000,
riskTolerance: 'moderate',
strategy: 'momentum'
});
// Deploy the agent
const deployment = agent.deploy();
console.log(`Agent deployed: ${deployment.message}`);
// Generate financial forecast
const forecast = agent.forecast(30); // 30-day forecast
console.log(`Projected inflows: $${forecast.inflows}`);
console.log(`Projected outflows: $${forecast.outflows}`);
console.log(`Net cash flow: $${forecast.netFlow}`);
// Get comprehensive report
const report = agent.report();
console.log(`Total ROI: ${report.metrics.roi}%`);
console.log(`Sharpe Ratio: ${report.metrics.sharpeRatio}`);
console.log(`Max Drawdown: ${report.metrics.maxDrawdown}%`);Advanced Configuration
import { TranzoraAgent, type AgentConfig } from '@tranzora/agents';
const config: AgentConfig = {
name: 'ArbitrageBot',
platform: 'polygon', // Lower gas fees
treasury: '0x1234567890123456789012345678901234567890',
initialCapital: 100000,
riskTolerance: 'aggressive',
strategy: 'arbitrage'
};
const agent = new TranzoraAgent(config);
// Deploy and get risk metrics
agent.deploy();
const riskMetrics = agent.getRiskMetrics();
console.log(`VaR (95%): $${riskMetrics.var95}`);
console.log(`Max Expected Loss: $${riskMetrics.maxLoss}`);
// Get current trading positions
const positions = agent.getPositions();
positions.forEach(position => {
console.log(`${position.symbol} ${position.type}: $${position.unrealizedPnl}`);
});📚 API Reference
TranzoraAgent
The main class for creating and managing AI finance agents.
Constructor
new TranzoraAgent(config: AgentConfig)Parameters:
config- Configuration object for the agent
Methods
deploy(): DeploymentStatus
Deploys the agent to the specified platform.
Returns: Deployment status with transaction details, gas usage, and deployment ID.
forecast(periodDays?: number): ForecastReport
Generates financial forecasts for the specified period.
Parameters:
periodDays- Forecast period in days (default: 30)
Returns: Detailed forecast with inflows, outflows, runway, and confidence metrics.
report(): CashflowSummary
Generates comprehensive financial performance report.
Returns: Complete financial summary with ROI, Sharpe ratio, drawdown, and volatility metrics.
getPositions(): TradingPosition[]
Retrieves current trading positions.
Returns: Array of active positions with P&L and entry details.
getRiskMetrics(): RiskMetrics
Calculates risk assessment metrics.
Returns: VaR, maximum loss, risk-adjusted returns, and correlation data.
getConfig(): AgentConfig
Returns current agent configuration.
Returns: Complete configuration object.
Types
AgentConfig
interface AgentConfig {
name: string;
platform: 'ethereum' | 'polygon' | 'arbitrum' | 'optimism' | 'base' | 'discord' | 'telegram';
treasury: string;
initialCapital?: number;
riskTolerance?: 'conservative' | 'moderate' | 'aggressive';
strategy?: 'arbitrage' | 'momentum' | 'mean-reversion' | 'trend-following';
}DeploymentStatus
interface DeploymentStatus {
status: 'success' | 'pending' | 'failed';
message: string;
treasury: string;
createdAt: string;
txHash?: string;
gasUsed?: number;
deploymentId?: string;
}ForecastReport
interface ForecastReport {
inflows: number;
outflows: number;
netFlow: number;
runwayDays: number;
confidence: number;
periodDays: number;
generatedAt: string;
assumptions: string[];
}CashflowSummary
interface CashflowSummary {
totalInflows: number;
totalOutflows: number;
netPosition: number;
treasuryBalance: number;
last30Days: {
inflows: number;
outflows: number;
netFlow: number;
};
metrics: {
roi: number;
sharpeRatio: number;
maxDrawdown: number;
volatility: number;
};
generatedAt: string;
}🏗️ Development
Prerequisites
- Node.js 16+
- npm or yarn
Setup
# Clone the repository
git clone https://github.com/tranzora/agents.git
cd agents
# Install dependencies
npm install
# Build the package
npm run build
# Run tests
npm test
# Run linting
npm run lint
# Format code
npm run formatScripts
npm run build- Build the TypeScript sourcenpm test- Run Jest test suitenpm run lint- Run ESLintnpm run lint:fix- Fix ESLint issues automaticallynpm run format- Format code with Prettier
🤝 Contributing
We welcome contributions from the community! Please see our Contributing Guide for details on how to submit pull requests, report issues, and contribute to the project.
Development Workflow
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new functionality
- Ensure all tests pass (
npm test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🆘 Support
🔗 Links
Built with ❤️ by the Tranzora Labs team
Empowering the future of decentralized finance through intelligent automation.
