Skip to content

Miny-Labs/fenyr-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fenyr TypeScript

Fenyr TypeScript GPT-5.2 WEEX License: MIT

Multi-Agent AI Trading System powered by GPT-5.2

Built for AI Wars: WEEX Alpha Awakens Hackathon

FeaturesArchitectureQuick StartAgentsSDK


🎯 Overview

Fenyr is a production-grade multi-agent AI trading system that leverages 5 specialized AI agents working as a team to analyze markets and execute trades on WEEX Exchange. Built with TypeScript for type safety and performance.

✨ Features

Feature Description
🧠 5 AI Agents Specialized team: Analyst, Sentiment, Risk, Executor, Coordinator
🔧 11 Trading Tools Zod-validated function calling for GPT
📊 Full WEEX SDK All Market, Account, Trade, AI Log endpoints
🚀 HFT Mode High-frequency rapid analysis cycles
📝 AI Log Compliance Every decision uploaded to WEEX
🛡️ Risk Veto Risk Manager can override trades
Type-Safe Full TypeScript with strict mode

🏗️ Architecture

flowchart TB
    subgraph Agents["🤖 Multi-Agent Team"]
        MA[Market Analyst]
        SA[Sentiment Agent]
        RM[Risk Manager]
        EX[Executor]
        CO[Coordinator]
    end

    subgraph SDK["📦 WEEX SDK"]
        MKT[Market API]
        ACC[Account API]
        TRD[Trade API]
        AIL[AI Log API]
    end

    MA --> CO
    SA --> CO
    RM --> CO
    CO --> EX
    
    EX --> TRD
    MA --> MKT
    SA --> MKT
    RM --> ACC
    EX --> AIL
Loading

🚀 Quick Start

Prerequisites

  • Node.js 20+
  • npm or pnpm
  • OpenAI API key
  • WEEX API credentials

Installation

# Clone
git clone https://github.com/Miny-Labs/fenyr-ts.git
cd fenyr-ts

# Install
npm install

# Configure
cp .env.example .env
# Edit .env with your API keys

# Run
npm run single

Run Modes

# Single team analysis
npm run single

# HFT mode (rapid cycles)
npm run hft

# Custom
npx tsx src/index.ts --mode hft --hft-cycles 10 --hft-interval 20

🤖 Agents

Agent Stage Role
📊 Market Analyst Technical Analysis RSI, EMA, MACD signals
💭 Sentiment Agent Sentiment Analysis Funding rates, OI
🛡️ Risk Manager Risk Assessment Position sizing, veto power
Executor Order Execution Places orders
🎯 Coordinator Decision Making Consensus voting

Consensus Algorithm

const weights = {
  MarketAnalyst: 0.35,
  SentimentAgent: 0.25,
  RiskManager: 0.40  // Has veto power
};

// EXECUTE: confidence >= 0.65
// ALERT: confidence 0.45-0.65
// HOLD: confidence < 0.45

📦 SDK

Full TypeScript WEEX SDK with all endpoints:

import { createWeexClient } from './sdk/client.js';

const client = createWeexClient();

// Market
await client.getTicker('cmt_btcusdt');
await client.getCandles('cmt_btcusdt', '1H', 50);
await client.getDepth('cmt_btcusdt');
await client.getFundingRate('cmt_btcusdt');

// Account
await client.getAssets();
await client.getAllPositions();
await client.setLeverage('cmt_btcusdt', 10);

// Trade
await client.placeOrder('cmt_btcusdt', '0.0002', 1, 1);
await client.cancelOrder('cmt_btcusdt', 'orderId');
await client.placeTPSL('cmt_btcusdt', 'long', '90000', '85000');

// AI Log
await client.uploadAILog({
  stage: 'Strategy Generation',
  model: 'gpt-5.2',
  input: { rsi: 67.5, ema20: 88000 },
  output: { signal: 'BUY', confidence: 0.74 },
  explanation: 'Bullish EMA crossover with RSI momentum'
});

📁 Project Structure

fenyr-ts/
├── src/
│   ├── index.ts           # CLI entry point
│   ├── sdk/
│   │   ├── client.ts      # WEEX SDK
│   │   └── index.ts
│   ├── agents/
│   │   ├── base.ts        # Base agent class
│   │   ├── market-analyst.ts
│   │   ├── sentiment.ts
│   │   ├── risk-manager.ts
│   │   ├── executor.ts
│   │   ├── coordinator.ts
│   │   └── index.ts
│   └── tools/
│       ├── trading-tools.ts
│       └── index.ts
├── package.json
├── tsconfig.json
└── .env

🔗 Related

📜 License

MIT License - see LICENSE for details.


Made with 🤖 by Miny Labs

About

Multi-agent AI trading system for WEEX - TypeScript, GPT-5.2, 5 agents

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors