Skip to content

gandolfoni/hl-katoshi-connector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HL-Katoshi-Connector

A specialized connector integrating Katoshi.ai's automated trading layer with Hyperliquid Exchange's perpetual futures trading platform.

Overview

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

Key Features

  • 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

Prerequisites

  • 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

Installation

npm install @katoshi/hl-connector
# or
yarn add @katoshi/hl-connector

Configuration

  1. Rename .env.example to .env
  2. 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

TradingView Alert Setup

  1. In TradingView, create a new alert
  2. Set webhook URL to your Katoshi endpoint: https://api.katoshi.ai/v1/webhook/hl
  3. Format your alert message as:
{
  "symbol": "{{ticker}}",
  "action": "{{strategy.order.action}}",
  "price": "{{strategy.order.price}}",
  "leverage": "{{strategy.leverage}}",
  "position_size": "{{strategy.position_size}}"
}

Advanced Configuration

Hyperliquid-Specific Settings

{
    "margin_type": "cross", // or "isolated"
    "leverage_mode": "fixed", // or "variable"
    "max_leverage": 10,
    "risk_limit": "50000" // USDC value
}

Katoshi.ai Risk Management

{
    "max_position_size": "10000", // USDC value
    "max_drawdown": "5", // percentage
    "trailing_stop": true,
    "stop_loss": "2", // percentage
    "take_profit": "5" // percentage
}

Usage

Running the connector:

npm start
# or
yarn start

Webhook Endpoints

  • Main trading endpoint: /webhook
  • Position management: /position
  • Risk management: /risk
  • Status checks: /health

Security Best Practices

  • 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

Error Handling

The connector implements robust error handling for common scenarios:

  • Network interruptions
  • API rate limits
  • Invalid order parameters
  • Insufficient margin
  • Position size limits

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Support

For technical support:

  • Join the Katoshi.ai Discord
  • Visit Hyperliquid Documentation
  • Check the Issues section of this repository

License

MIT License

Risk Disclaimer

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published