@elizaos/plugin-social-alpha 2.0.0-alpha.8 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +176 -0
- package/dist/assets/index-BFamh0Wi.js +124 -0
- package/dist/assets/index-C4gOAEPc.js +124 -0
- package/dist/assets/index-ChK0A7dY.js +124 -0
- package/dist/assets/index-ClOaVew8.css +1 -0
- package/dist/assets/index-DKFCULo2.css +1 -0
- package/dist/assets/index-DsruU1f2.js +124 -0
- package/dist/assets/index-DvARYTre.js +124 -0
- package/dist/index.html +2 -2
- package/package.json +25 -24
- package/dist/__tests__/e2e/benchmarks/benchmark.utils.d.ts +0 -38
- package/dist/__tests__/e2e/benchmarks/trust_algorithm.benchmark.d.ts +0 -18
- package/dist/__tests__/e2e/events.d.ts +0 -2
- package/dist/__tests__/e2e/index.d.ts +0 -3
- package/dist/__tests__/e2e/scenarios.d.ts +0 -3
- package/dist/__tests__/e2e/service.d.ts +0 -1
- package/dist/__tests__/e2e/socialAlpha.d.ts +0 -2
- package/dist/__tests__/e2e/test-utils.d.ts +0 -12
- package/dist/__tests__/e2e/test.setup.d.ts +0 -2
- package/dist/__tests__/e2e/trustOptimizationE2E.d.ts +0 -4
- package/dist/__tests__/e2e/trustScenariosE2E.d.ts +0 -4
- package/dist/__tests__/e2e/trustScore.d.ts +0 -2
- package/dist/__tests__/mocks/mockPriceService.d.ts +0 -36
- package/dist/assets/index-CNEn_XZo.js +0 -109
- package/dist/assets/index-D088W50X.css +0 -1
- package/dist/assets/index-D32we_nf.js +0 -17204
- package/dist/assets/index-DU6B6kWr.js +0 -17202
- package/dist/clients.d.ts +0 -382
- package/dist/config.d.ts +0 -143
- package/dist/events.d.ts +0 -4
- package/dist/frontend/LeaderboardTable.d.ts +0 -7
- package/dist/frontend/index.d.ts +0 -3
- package/dist/frontend/loader.d.ts +0 -1
- package/dist/frontend/ui/badge.d.ts +0 -11
- package/dist/frontend/ui/button.d.ts +0 -11
- package/dist/frontend/ui/card.d.ts +0 -8
- package/dist/frontend/ui/input.d.ts +0 -3
- package/dist/frontend/ui/table.d.ts +0 -10
- package/dist/frontend/ui/tabs.d.ts +0 -7
- package/dist/frontend/utils.d.ts +0 -2
- package/dist/index.d.ts +0 -28
- package/dist/mockPriceService.d.ts +0 -1
- package/dist/providers/socialAlphaProvider.d.ts +0 -14
- package/dist/reports.d.ts +0 -56
- package/dist/routes.d.ts +0 -2
- package/dist/schemas.d.ts +0 -150
- package/dist/scripts/analyze-trust-scores.d.ts +0 -15
- package/dist/scripts/enrich-price-data.d.ts +0 -15
- package/dist/scripts/optimize-algorithm.d.ts +0 -14
- package/dist/scripts/process-discord-data.d.ts +0 -14
- package/dist/service.d.ts +0 -286
- package/dist/services/PriceDataService.d.ts +0 -36
- package/dist/services/SimulationService.d.ts +0 -31
- package/dist/services/TrustScoreService.d.ts +0 -37
- package/dist/services/balancedTrustScoreCalculator.d.ts +0 -60
- package/dist/services/historicalPriceService.d.ts +0 -60
- package/dist/services/index.d.ts +0 -22
- package/dist/services/priceEnrichmentService.d.ts +0 -114
- package/dist/services/simulationActorsV2.d.ts +0 -53
- package/dist/services/simulationRunner.d.ts +0 -114
- package/dist/services/tokenSimulationService.d.ts +0 -33
- package/dist/services/trustScoreOptimizer.d.ts +0 -109
- package/dist/simulationActors.d.ts +0 -23
- package/dist/tests/index.d.ts +0 -3
- package/dist/types.d.ts +0 -959
- package/dist/utils.d.ts +0 -51
package/README.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Marketplace of Trust Plugin
|
|
2
|
+
|
|
3
|
+
A sophisticated trust scoring system for ElizaOS that analyzes trading calls and calculates user trust scores based on performance metrics.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Marketplace of Trust plugin provides:
|
|
8
|
+
- **Trust Score Calculation**: Advanced algorithm that evaluates users based on profit, win rate, Sharpe ratio, and call quality
|
|
9
|
+
- **Trading Call Analysis**: Process Discord messages to extract and analyze trading calls
|
|
10
|
+
- **Price Data Enrichment**: Integrate with Birdeye and DexScreener APIs for historical price data
|
|
11
|
+
- **Algorithm Optimization**: Machine learning-based parameter tuning for optimal trust score accuracy
|
|
12
|
+
- **Leaderboard System**: Real-time trust score rankings with beautiful UI
|
|
13
|
+
|
|
14
|
+
## Architecture
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
src/
|
|
18
|
+
├── services/ # Core business logic
|
|
19
|
+
│ ├── SimulationService.ts # Consolidated simulation functionality
|
|
20
|
+
│ ├── PriceDataService.ts # Price data fetching and enrichment
|
|
21
|
+
│ ├── TrustScoreService.ts # Trust score calculation and optimization
|
|
22
|
+
│ └── balancedTrustScoreCalculator.ts # Core scoring algorithm
|
|
23
|
+
├── frontend/ # React UI components
|
|
24
|
+
│ └── LeaderboardTable.tsx # Trust score leaderboard
|
|
25
|
+
└── __tests__/ # Comprehensive test suite
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install @elizaos/plugin-marketplace-of-trust
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Configuration
|
|
35
|
+
|
|
36
|
+
Add to your `.env` file:
|
|
37
|
+
|
|
38
|
+
```env
|
|
39
|
+
# API Keys (at least one required)
|
|
40
|
+
BIRDEYE_API_KEY=your_birdeye_api_key
|
|
41
|
+
DEXSCREENER_API_KEY=your_dexscreener_api_key
|
|
42
|
+
|
|
43
|
+
# Optional: Helius for token metadata
|
|
44
|
+
HELIUS_API_KEY=your_helius_api_key
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Trust Score Algorithm
|
|
48
|
+
|
|
49
|
+
The balanced trust score algorithm considers multiple factors:
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
score = profitComponent * profitWeight +
|
|
53
|
+
winRateComponent * winRateWeight +
|
|
54
|
+
sharpeComponent * sharpeWeight +
|
|
55
|
+
alphaComponent * alphaWeight +
|
|
56
|
+
consistencyComponent * consistencyWeight +
|
|
57
|
+
qualityComponent * qualityWeight
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Components:
|
|
61
|
+
- **Profit**: Average profit percentage across all calls
|
|
62
|
+
- **Win Rate**: Percentage of profitable calls
|
|
63
|
+
- **Sharpe Ratio**: Risk-adjusted returns
|
|
64
|
+
- **Alpha**: Excess returns vs market
|
|
65
|
+
- **Consistency**: Stability of returns
|
|
66
|
+
- **Quality**: Penalty for rug pull promotions
|
|
67
|
+
|
|
68
|
+
### Default Weights:
|
|
69
|
+
- Profit: 25%
|
|
70
|
+
- Win Rate: 25%
|
|
71
|
+
- Sharpe: 15%
|
|
72
|
+
- Alpha: 10%
|
|
73
|
+
- Consistency: 10%
|
|
74
|
+
- Quality: 15%
|
|
75
|
+
|
|
76
|
+
## API Integration
|
|
77
|
+
|
|
78
|
+
### Using in Your Plugin
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import { MarketplaceOfTrustService } from '@elizaos/plugin-marketplace-of-trust';
|
|
82
|
+
|
|
83
|
+
// In your plugin definition
|
|
84
|
+
export const myPlugin: Plugin = {
|
|
85
|
+
name: 'my-plugin',
|
|
86
|
+
services: [MarketplaceOfTrustService],
|
|
87
|
+
// ... other plugin config
|
|
88
|
+
};
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Accessing Trust Scores
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
// Get user trust score
|
|
95
|
+
const trustProfile = await runtime.getComponent(
|
|
96
|
+
userId,
|
|
97
|
+
'trust_profile',
|
|
98
|
+
worldId
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
console.log(`Trust Score: ${trustProfile.data.trustScore}`);
|
|
102
|
+
console.log(`Total Calls: ${trustProfile.data.totalCalls}`);
|
|
103
|
+
console.log(`Win Rate: ${trustProfile.data.winRate}%`);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Testing
|
|
107
|
+
|
|
108
|
+
Run the comprehensive test suite:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Unit tests
|
|
112
|
+
npm test
|
|
113
|
+
|
|
114
|
+
# E2E tests
|
|
115
|
+
npm run test:e2e
|
|
116
|
+
|
|
117
|
+
# Test coverage
|
|
118
|
+
npm run test:coverage
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Development
|
|
122
|
+
|
|
123
|
+
### Building
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm run build
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Development Server
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
npm run dev
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Code Quality
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
npm run lint
|
|
139
|
+
npm run format
|
|
140
|
+
npm run typecheck
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Performance Considerations
|
|
144
|
+
|
|
145
|
+
- **Caching**: The system caches simulation results and API responses to minimize redundant calls
|
|
146
|
+
- **Rate Limiting**: Built-in rate limiting for API calls (100ms delay between requests)
|
|
147
|
+
- **Batch Processing**: Processes data in configurable batches to manage memory usage
|
|
148
|
+
- **Resume Support**: Price enrichment can be resumed if interrupted
|
|
149
|
+
|
|
150
|
+
## Troubleshooting
|
|
151
|
+
|
|
152
|
+
### Common Issues
|
|
153
|
+
|
|
154
|
+
1. **No API Keys**: Ensure at least one price data API key is configured
|
|
155
|
+
2. **Rate Limits**: If hitting API rate limits, reduce batch size or add delays
|
|
156
|
+
3. **Memory Issues**: For large datasets, reduce batch size or process in chunks
|
|
157
|
+
4. **TypeScript Errors**: Run `npm run typecheck` to identify type issues
|
|
158
|
+
|
|
159
|
+
## Contributing
|
|
160
|
+
|
|
161
|
+
1. Fork the repository
|
|
162
|
+
2. Create a feature branch
|
|
163
|
+
3. Make your changes
|
|
164
|
+
4. Add tests for new functionality
|
|
165
|
+
5. Ensure all tests pass
|
|
166
|
+
6. Submit a pull request
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
MIT
|
|
171
|
+
|
|
172
|
+
## Support
|
|
173
|
+
|
|
174
|
+
For issues and questions:
|
|
175
|
+
- GitHub Issues: [elizaos/elizaos](https://github.com/elizaos/elizaos/issues)
|
|
176
|
+
- Discord: [ElizaOS Community](https://discord.gg/elizaos)
|