A specialized connector integrating Katoshi.ai's automated trading layer with Hyperliquid Exchange's perpetual futures trading platform.
Katoshi.ai is an automated trading layer designed to bring sophisticated algorithmic trading capabilities to Hyperliquid Exchange. Hyperliquid is a decentralized perpetual futures exchange known for its high-performance infrastructure and unique market making capabilities.
This connector serves as a crucial bridge between TradingView's alert system and the Hyperliquid exchange API via Katoshi.ai, enabling automated execution of trading strategies with:
- Direct integration with Hyperliquid's perpetual futures markets
- Automated order execution through Katoshi.ai's trading layer
- Support for advanced order types and position management
- Real-time monitoring and execution of TradingView alerts
- Seamless integration with Hyperliquid's decentralized perpetual futures platform
- Katoshi.ai's automated trading logic and risk management
- WebSocket support for real-time order execution
- Advanced position management through Hyperliquid's API
- Configurable leverage and risk parameters
- Node.js (version 16.x or higher)
- Hyperliquid Exchange account and API credentials
- TradingView Pro account (for webhook alerts)
- Basic understanding of perpetual futures trading
- Familiarity with Katoshi.ai's trading parameters
npm install @katoshi/hl-connector
# or
yarn add @katoshi/hl-connector
- Rename
.env.example
to.env
- Configure your Hyperliquid and Katoshi.ai credentials:
HL_API_KEY=your_hyperliquid_api_key
HL_API_SECRET=your_hyperliquid_secret
KATOSHI_API_KEY=your_katoshi_key
WEBSOCKET_URL=wss://hyperliquid.io/ws
- In TradingView, create a new alert
- Set webhook URL to your Katoshi endpoint:
https://api.katoshi.ai/v1/webhook/hl
- Format your alert message as:
{
"symbol": "{{ticker}}",
"action": "{{strategy.order.action}}",
"price": "{{strategy.order.price}}",
"leverage": "{{strategy.leverage}}",
"position_size": "{{strategy.position_size}}"
}
{
"margin_type": "cross", // or "isolated"
"leverage_mode": "fixed", // or "variable"
"max_leverage": 10,
"risk_limit": "50000" // USDC value
}
{
"max_position_size": "10000", // USDC value
"max_drawdown": "5", // percentage
"trailing_stop": true,
"stop_loss": "2", // percentage
"take_profit": "5" // percentage
}
Running the connector:
npm start
# or
yarn start
- Main trading endpoint:
/webhook
- Position management:
/position
- Risk management:
/risk
- Status checks:
/health
- Use secure environment variables for API keys
- Implement IP whitelisting for TradingView webhooks
- Regular security audits of dependencies
- Enable 2FA on both Hyperliquid and Katoshi.ai accounts
- Monitor position sizes and leverage limits
The connector implements robust error handling for common scenarios:
- Network interruptions
- API rate limits
- Invalid order parameters
- Insufficient margin
- Position size limits
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
For technical support:
- Join the Katoshi.ai Discord
- Visit Hyperliquid Documentation
- Check the Issues section of this repository
Trading perpetual futures on decentralized exchanges carries significant risks including but not limited to:
- High volatility
- Potential for liquidation
- Smart contract risks
- Network congestion affecting order execution
This tool is for experienced traders who understand these risks. Always start with small position sizes and test thoroughly before deploying significant capital.