{
  "schemaVersion": "1.0",
  "item": {
    "slug": "nautilus-trader",
    "name": "Nautilus Trader",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/ahuserious/nautilus-trader",
    "canonicalUrl": "https://clawhub.ai/ahuserious/nautilus-trader",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/nautilus-trader",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=nautilus-trader",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "references/CHANGELOG.md",
      "references/README.md",
      "references/api.md",
      "references/backtesting.md",
      "references/concepts.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/nautilus-trader"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/nautilus-trader",
    "agentPageUrl": "https://openagent3.xyz/skills/nautilus-trader/agent",
    "manifestUrl": "https://openagent3.xyz/skills/nautilus-trader/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/nautilus-trader/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Nautilus Trader Skill",
        "body": "Comprehensive assistance with NautilusTrader development. Includes complete Hyperliquid mainnet integration with SDK patch for live trading."
      },
      {
        "title": "Overview",
        "body": "This skill covers:\n\nStrategy development with NautilusTrader\nBacktesting using the Parquet data catalog\nLive trading deployment on Hyperliquid mainnet\nSDK patch for Hyperliquid price precision requirements"
      },
      {
        "title": "When to Use",
        "body": "Building trading strategies with NautilusTrader\nRunning backtests with historical data\nDeploying strategies to Hyperliquid mainnet\nDebugging NautilusTrader adapter issues\nWorking with multi-timeframe (MTF) indicators"
      },
      {
        "title": "Core Dependencies",
        "body": "# NautilusTrader (backtesting + live trading framework)\npip install nautilus_trader\n\n# Hyperliquid SDK (for live trading patch)\npip install hyperliquid-python-sdk eth-account python-dotenv\n\n# Data handling\npip install pandas numpy"
      },
      {
        "title": "Verify Installation",
        "body": "import nautilus_trader\nprint(f\"Nautilus Trader: {nautilus_trader.__version__}\")\n# Tested with v1.222.0"
      },
      {
        "title": "Environment Variables",
        "body": "Create a .env file for Hyperliquid credentials:\n\nHYPERLIQUID_PK=your_private_key_without_0x_prefix\nHYPERLIQUID_VAULT=0xYourVaultAddressHere"
      },
      {
        "title": "1. Apply the Hyperliquid Patch (for live trading)",
        "body": "# CRITICAL: Import patch BEFORE Nautilus Trader\nimport hyperliquid_patch\n\n# Then import Nautilus normally\nfrom nautilus_trader.adapters.hyperliquid import HYPERLIQUID\nfrom nautilus_trader.live.node import TradingNode"
      },
      {
        "title": "2. Basic Strategy Template",
        "body": "from nautilus_trader.trading.strategy import Strategy\nfrom nautilus_trader.config import StrategyConfig\nfrom nautilus_trader.model.data import Bar, BarType\nfrom nautilus_trader.model.enums import OrderSide, TimeInForce\nfrom nautilus_trader.model.identifiers import InstrumentId\nfrom decimal import Decimal\n\nclass MyStrategyConfig(StrategyConfig):\n    instrument_id: str\n    bar_type: str\n    trade_size: Decimal = Decimal(\"0.1\")\n\nclass MyStrategy(Strategy):\n    def __init__(self, config: MyStrategyConfig):\n        super().__init__(config)\n        self.instrument_id = InstrumentId.from_str(config.instrument_id)\n        self.bar_type = BarType.from_str(config.bar_type)\n        self.trade_size = config.trade_size\n\n    def on_start(self):\n        self.instrument = self.cache.instrument(self.instrument_id)\n        self.subscribe_bars(self.bar_type)\n\n    def on_bar(self, bar: Bar):\n        # Your strategy logic here\n        pass\n\n    def on_stop(self):\n        self.close_all_positions(self.instrument_id)"
      },
      {
        "title": "Heiken Ashi Indicator",
        "body": "from nautilus_trader.indicators.base.indicator import Indicator\nfrom nautilus_trader.model.data import Bar\n\nclass HeikenAshi(Indicator):\n    \"\"\"Heiken Ashi candle smoothing indicator.\"\"\"\n\n    def __init__(self):\n        super().__init__([])\n        self.ha_open = 0.0\n        self.ha_close = 0.0\n        self.ha_high = 0.0\n        self.ha_low = 0.0\n        self._prev_ha_open = None\n        self._prev_ha_close = None\n        self.initialized = False\n\n    def handle_bar(self, bar: Bar) -> None:\n        o, h, l, c = float(bar.open), float(bar.high), float(bar.low), float(bar.close)\n\n        self.ha_close = (o + h + l + c) / 4\n\n        if self._prev_ha_open is None:\n            self.ha_open = (o + c) / 2\n        else:\n            self.ha_open = (self._prev_ha_open + self._prev_ha_close) / 2\n\n        self.ha_high = max(h, self.ha_open, self.ha_close)\n        self.ha_low = min(l, self.ha_open, self.ha_close)\n\n        self._prev_ha_open = self.ha_open\n        self._prev_ha_close = self.ha_close\n        self.initialized = True\n\n    @property\n    def is_bullish(self) -> bool:\n        return self.ha_close > self.ha_open\n\n    @property\n    def is_bearish(self) -> bool:\n        return self.ha_close < self.ha_open\n\n    def reset(self) -> None:\n        self._prev_ha_open = None\n        self._prev_ha_close = None\n        self.initialized = False"
      },
      {
        "title": "Multi-Timeframe EMA Strategy",
        "body": "See references/hyperliquid.md for complete MTF EMA + Heiken Ashi strategy implementation.\n\nKey concepts:\n\nHTF (Higher Timeframe): Determines trend direction via EMA crossover\nLTF (Lower Timeframe): Entry timing via Heiken Ashi confirmation\nEntry: HA color change in trend direction\nExit: HA color reversal"
      },
      {
        "title": "Engine Setup",
        "body": "from nautilus_trader.backtest.engine import BacktestEngine, BacktestEngineConfig\nfrom nautilus_trader.model.currencies import USD\nfrom nautilus_trader.model.enums import AccountType, OmsType\nfrom nautilus_trader.model.identifiers import Venue\nfrom nautilus_trader.model.objects import Money\nfrom nautilus_trader.persistence.catalog import ParquetDataCatalog\nfrom decimal import Decimal\n\ndef run_backtest():\n    config = BacktestEngineConfig(\n        trader_id=\"BACKTESTER-001\",\n        logging_level=\"INFO\",\n    )\n    engine = BacktestEngine(config=config)\n\n    # Add venue\n    engine.add_venue(\n        venue=Venue(\"HYPERLIQUID\"),\n        oms_type=OmsType.NETTING,\n        account_type=AccountType.MARGIN,\n        base_currency=USD,\n        starting_balances=[Money(100_000, USD)],\n    )\n\n    # Load data from catalog\n    catalog = ParquetDataCatalog(\"./data_catalog\")\n\n    instruments = catalog.instruments()\n    for instrument in instruments:\n        engine.add_instrument(instrument)\n\n    bars = catalog.bars()\n    engine.add_data(bars)\n\n    # Add strategy\n    strategy = MyStrategy(config=MyStrategyConfig(\n        instrument_id=\"SOL-USD.HYPERLIQUID\",\n        bar_type=\"SOL-USD.HYPERLIQUID-5-MINUTE-LAST-EXTERNAL\",\n        trade_size=Decimal(\"1.0\"),\n    ))\n    engine.add_strategy(strategy)\n\n    # Run\n    engine.run()\n\n    # Results\n    print(engine.trader.generate_account_report(Venue(\"HYPERLIQUID\")))\n    print(engine.trader.generate_order_fills_report())\n    print(engine.trader.generate_positions_report())\n\n    engine.dispose()"
      },
      {
        "title": "Data Catalog",
        "body": "See references/backtesting.md and references/data.md for detailed catalog operations:\n\nParquetDataCatalog - Query and manage Parquet data files\nBarDataWrangler - Convert pandas DataFrames to Nautilus Bar objects\nwrite_data() - Persist data to catalog\nquery() - Retrieve data with time filters"
      },
      {
        "title": "Node Configuration",
        "body": "import os\nfrom dotenv import load_dotenv\n\nload_dotenv()\n\n# CRITICAL: Apply patch BEFORE Nautilus imports\nimport hyperliquid_patch\n\nfrom nautilus_trader.adapters.hyperliquid import (\n    HYPERLIQUID,\n    HyperliquidDataClientConfig,\n    HyperliquidExecClientConfig,\n)\nfrom nautilus_trader.live.node import TradingNode, TradingNodeConfig\nfrom nautilus_trader.config import LiveDataEngineConfig, LiveExecEngineConfig\n\ndef main():\n    node_config = TradingNodeConfig(\n        trader_id=\"LIVE-001\",\n        data_engine=LiveDataEngineConfig(),\n        exec_engine=LiveExecEngineConfig(),\n    )\n\n    node = TradingNode(config=node_config)\n\n    data_config = HyperliquidDataClientConfig(\n        wallet_address=os.getenv(\"HYPERLIQUID_VAULT\"),\n        is_testnet=False,\n    )\n\n    exec_config = HyperliquidExecClientConfig(\n        wallet_address=os.getenv(\"HYPERLIQUID_VAULT\"),\n        private_key=os.getenv(\"HYPERLIQUID_PK\"),\n        is_testnet=False,\n    )\n\n    node.build()\n\n    # Add your strategy\n    strategy = MyStrategy(config=my_config)\n    node.trader.add_strategy(strategy)\n\n    node.run()\n\nif __name__ == \"__main__\":\n    main()"
      },
      {
        "title": "Set Leverage (One-Time Setup)",
        "body": "from hyperliquid.exchange import Exchange\nfrom hyperliquid.utils import constants\nfrom eth_account import Account\nimport os\n\nprivate_key = os.getenv(\"HYPERLIQUID_PK\")\nif not private_key.startswith(\"0x\"):\n    private_key = \"0x\" + private_key\n\naccount = Account.from_key(private_key)\nexchange = Exchange(account, constants.MAINNET_API_URL)\n\n# Set 10x leverage for SOL (cross margin)\nexchange.update_leverage(10, \"SOL\", is_cross=True)"
      },
      {
        "title": "Network Latency",
        "body": "For best performance, deploy on AWS ap-northeast-1 (Tokyo):\n\nPing to Hyperliquid CloudFront: ~1ms\nAPI latency: ~28ms"
      },
      {
        "title": "The Problem",
        "body": "Nautilus Trader v1.222.0 has bugs in the Hyperliquid adapter:\n\nRust HTTP client serialization causes type mismatches\nPrice precision exceeds Hyperliquid's 5 significant figure limit"
      },
      {
        "title": "The Solution",
        "body": "Bypass the buggy adapter using the official Hyperliquid Python SDK. The patch file is located at references/hyperliquid_patch.py."
      },
      {
        "title": "Price Precision Rules",
        "body": "Hyperliquid requires maximum 5 significant figures for all prices:\n\nPriceValid?Sig Figs$139.05Yes5$139.054No6$1.2345Yes5$1.23456No6$12345Yes5$123456No6"
      },
      {
        "title": "Usage",
        "body": "# CRITICAL: Import patch BEFORE any Nautilus imports\nimport hyperliquid_patch\n\n# Then import Nautilus normally\nfrom nautilus_trader.adapters.hyperliquid import HYPERLIQUID\n\nThe patch auto-applies on import and handles:\n\nPrice formatting to 5 significant figures\nRounding up for buys, down for sells (ensures fills)\nSDK-based order submission bypassing Rust client"
      },
      {
        "title": "Verified Working",
        "body": "Tested on Hyperliquid Mainnet 2025-01-12:\n\nSELL 0.72 SOL @ $143.38 - FILLED\nBUY 0.71 SOL @ $143.39 - FILLED"
      },
      {
        "title": "File Structure",
        "body": "your_trading_project/\n├── .env                        # Credentials (gitignored)\n├── hyperliquid_patch.py        # SDK patch for live trading\n├── heiken_ashi.py              # Heiken Ashi indicator\n├── my_strategy.py              # Strategy implementation\n├── backtest.py                 # Backtest runner\n├── live.py                     # Live trading runner\n└── data_catalog/               # Parquet data for backtesting"
      },
      {
        "title": "Bar Type Format",
        "body": "{symbol}.{venue}-{step}-{aggregation}-{price_type}-{source}\n\nExamples:\nSOL-USD.HYPERLIQUID-1-HOUR-LAST-EXTERNAL\nSOL-USD.HYPERLIQUID-5-MINUTE-LAST-EXTERNAL\nBTC-USD.HYPERLIQUID-15-MINUTE-LAST-EXTERNAL"
      },
      {
        "title": "Order Rejected: Invalid Price",
        "body": "Ensure prices have max 5 significant figures. Use the format_price_5_sigfigs() function from the patch."
      },
      {
        "title": "Connection Error",
        "body": "Check .env has correct HYPERLIQUID_PK and HYPERLIQUID_VAULT\nVerify private key format (with or without 0x prefix)\nConfirm vault address is correct"
      },
      {
        "title": "Patch Not Applied",
        "body": "Ensure import hyperliquid_patch comes BEFORE any Nautilus imports."
      },
      {
        "title": "Missing Data in Backtest",
        "body": "Verify data catalog path exists\nCheck instrument IDs match between data and strategy config\nEnsure bar types are correctly formatted"
      },
      {
        "title": "Position Not Closing",
        "body": "Check that reduce_only=True is set on exit orders for netting accounts."
      },
      {
        "title": "Reference Files",
        "body": "Detailed documentation is available in references/:\n\nFileDescriptionhyperliquid.mdComplete Hyperliquid integration guidehyperliquid_patch.pySDK patch source codestrategies.mdStrategy patterns and examplesbacktesting.mdData catalog and backtest APIdata.mdData handling and wranglinggetting_started.mdNautilusTrader fundamentalsconcepts.mdCore concepts and architectureapi.mdFull API reference\n\nUse view to read specific reference files when detailed information is needed."
      }
    ],
    "body": "Nautilus Trader Skill\n\nComprehensive assistance with NautilusTrader development. Includes complete Hyperliquid mainnet integration with SDK patch for live trading.\n\nOverview\n\nThis skill covers:\n\nStrategy development with NautilusTrader\nBacktesting using the Parquet data catalog\nLive trading deployment on Hyperliquid mainnet\nSDK patch for Hyperliquid price precision requirements\nWhen to Use\nBuilding trading strategies with NautilusTrader\nRunning backtests with historical data\nDeploying strategies to Hyperliquid mainnet\nDebugging NautilusTrader adapter issues\nWorking with multi-timeframe (MTF) indicators\nPrerequisites\nCore Dependencies\n# NautilusTrader (backtesting + live trading framework)\npip install nautilus_trader\n\n# Hyperliquid SDK (for live trading patch)\npip install hyperliquid-python-sdk eth-account python-dotenv\n\n# Data handling\npip install pandas numpy\n\nVerify Installation\nimport nautilus_trader\nprint(f\"Nautilus Trader: {nautilus_trader.__version__}\")\n# Tested with v1.222.0\n\nEnvironment Variables\n\nCreate a .env file for Hyperliquid credentials:\n\nHYPERLIQUID_PK=your_private_key_without_0x_prefix\nHYPERLIQUID_VAULT=0xYourVaultAddressHere\n\nQuick Start\n1. Apply the Hyperliquid Patch (for live trading)\n# CRITICAL: Import patch BEFORE Nautilus Trader\nimport hyperliquid_patch\n\n# Then import Nautilus normally\nfrom nautilus_trader.adapters.hyperliquid import HYPERLIQUID\nfrom nautilus_trader.live.node import TradingNode\n\n2. Basic Strategy Template\nfrom nautilus_trader.trading.strategy import Strategy\nfrom nautilus_trader.config import StrategyConfig\nfrom nautilus_trader.model.data import Bar, BarType\nfrom nautilus_trader.model.enums import OrderSide, TimeInForce\nfrom nautilus_trader.model.identifiers import InstrumentId\nfrom decimal import Decimal\n\nclass MyStrategyConfig(StrategyConfig):\n    instrument_id: str\n    bar_type: str\n    trade_size: Decimal = Decimal(\"0.1\")\n\nclass MyStrategy(Strategy):\n    def __init__(self, config: MyStrategyConfig):\n        super().__init__(config)\n        self.instrument_id = InstrumentId.from_str(config.instrument_id)\n        self.bar_type = BarType.from_str(config.bar_type)\n        self.trade_size = config.trade_size\n\n    def on_start(self):\n        self.instrument = self.cache.instrument(self.instrument_id)\n        self.subscribe_bars(self.bar_type)\n\n    def on_bar(self, bar: Bar):\n        # Your strategy logic here\n        pass\n\n    def on_stop(self):\n        self.close_all_positions(self.instrument_id)\n\nStrategy Development\nHeiken Ashi Indicator\nfrom nautilus_trader.indicators.base.indicator import Indicator\nfrom nautilus_trader.model.data import Bar\n\nclass HeikenAshi(Indicator):\n    \"\"\"Heiken Ashi candle smoothing indicator.\"\"\"\n\n    def __init__(self):\n        super().__init__([])\n        self.ha_open = 0.0\n        self.ha_close = 0.0\n        self.ha_high = 0.0\n        self.ha_low = 0.0\n        self._prev_ha_open = None\n        self._prev_ha_close = None\n        self.initialized = False\n\n    def handle_bar(self, bar: Bar) -> None:\n        o, h, l, c = float(bar.open), float(bar.high), float(bar.low), float(bar.close)\n\n        self.ha_close = (o + h + l + c) / 4\n\n        if self._prev_ha_open is None:\n            self.ha_open = (o + c) / 2\n        else:\n            self.ha_open = (self._prev_ha_open + self._prev_ha_close) / 2\n\n        self.ha_high = max(h, self.ha_open, self.ha_close)\n        self.ha_low = min(l, self.ha_open, self.ha_close)\n\n        self._prev_ha_open = self.ha_open\n        self._prev_ha_close = self.ha_close\n        self.initialized = True\n\n    @property\n    def is_bullish(self) -> bool:\n        return self.ha_close > self.ha_open\n\n    @property\n    def is_bearish(self) -> bool:\n        return self.ha_close < self.ha_open\n\n    def reset(self) -> None:\n        self._prev_ha_open = None\n        self._prev_ha_close = None\n        self.initialized = False\n\nMulti-Timeframe EMA Strategy\n\nSee references/hyperliquid.md for complete MTF EMA + Heiken Ashi strategy implementation.\n\nKey concepts:\n\nHTF (Higher Timeframe): Determines trend direction via EMA crossover\nLTF (Lower Timeframe): Entry timing via Heiken Ashi confirmation\nEntry: HA color change in trend direction\nExit: HA color reversal\nBacktesting\nEngine Setup\nfrom nautilus_trader.backtest.engine import BacktestEngine, BacktestEngineConfig\nfrom nautilus_trader.model.currencies import USD\nfrom nautilus_trader.model.enums import AccountType, OmsType\nfrom nautilus_trader.model.identifiers import Venue\nfrom nautilus_trader.model.objects import Money\nfrom nautilus_trader.persistence.catalog import ParquetDataCatalog\nfrom decimal import Decimal\n\ndef run_backtest():\n    config = BacktestEngineConfig(\n        trader_id=\"BACKTESTER-001\",\n        logging_level=\"INFO\",\n    )\n    engine = BacktestEngine(config=config)\n\n    # Add venue\n    engine.add_venue(\n        venue=Venue(\"HYPERLIQUID\"),\n        oms_type=OmsType.NETTING,\n        account_type=AccountType.MARGIN,\n        base_currency=USD,\n        starting_balances=[Money(100_000, USD)],\n    )\n\n    # Load data from catalog\n    catalog = ParquetDataCatalog(\"./data_catalog\")\n\n    instruments = catalog.instruments()\n    for instrument in instruments:\n        engine.add_instrument(instrument)\n\n    bars = catalog.bars()\n    engine.add_data(bars)\n\n    # Add strategy\n    strategy = MyStrategy(config=MyStrategyConfig(\n        instrument_id=\"SOL-USD.HYPERLIQUID\",\n        bar_type=\"SOL-USD.HYPERLIQUID-5-MINUTE-LAST-EXTERNAL\",\n        trade_size=Decimal(\"1.0\"),\n    ))\n    engine.add_strategy(strategy)\n\n    # Run\n    engine.run()\n\n    # Results\n    print(engine.trader.generate_account_report(Venue(\"HYPERLIQUID\")))\n    print(engine.trader.generate_order_fills_report())\n    print(engine.trader.generate_positions_report())\n\n    engine.dispose()\n\nData Catalog\n\nSee references/backtesting.md and references/data.md for detailed catalog operations:\n\nParquetDataCatalog - Query and manage Parquet data files\nBarDataWrangler - Convert pandas DataFrames to Nautilus Bar objects\nwrite_data() - Persist data to catalog\nquery() - Retrieve data with time filters\nLive Trading on Hyperliquid\nNode Configuration\nimport os\nfrom dotenv import load_dotenv\n\nload_dotenv()\n\n# CRITICAL: Apply patch BEFORE Nautilus imports\nimport hyperliquid_patch\n\nfrom nautilus_trader.adapters.hyperliquid import (\n    HYPERLIQUID,\n    HyperliquidDataClientConfig,\n    HyperliquidExecClientConfig,\n)\nfrom nautilus_trader.live.node import TradingNode, TradingNodeConfig\nfrom nautilus_trader.config import LiveDataEngineConfig, LiveExecEngineConfig\n\ndef main():\n    node_config = TradingNodeConfig(\n        trader_id=\"LIVE-001\",\n        data_engine=LiveDataEngineConfig(),\n        exec_engine=LiveExecEngineConfig(),\n    )\n\n    node = TradingNode(config=node_config)\n\n    data_config = HyperliquidDataClientConfig(\n        wallet_address=os.getenv(\"HYPERLIQUID_VAULT\"),\n        is_testnet=False,\n    )\n\n    exec_config = HyperliquidExecClientConfig(\n        wallet_address=os.getenv(\"HYPERLIQUID_VAULT\"),\n        private_key=os.getenv(\"HYPERLIQUID_PK\"),\n        is_testnet=False,\n    )\n\n    node.build()\n\n    # Add your strategy\n    strategy = MyStrategy(config=my_config)\n    node.trader.add_strategy(strategy)\n\n    node.run()\n\nif __name__ == \"__main__\":\n    main()\n\nSet Leverage (One-Time Setup)\nfrom hyperliquid.exchange import Exchange\nfrom hyperliquid.utils import constants\nfrom eth_account import Account\nimport os\n\nprivate_key = os.getenv(\"HYPERLIQUID_PK\")\nif not private_key.startswith(\"0x\"):\n    private_key = \"0x\" + private_key\n\naccount = Account.from_key(private_key)\nexchange = Exchange(account, constants.MAINNET_API_URL)\n\n# Set 10x leverage for SOL (cross margin)\nexchange.update_leverage(10, \"SOL\", is_cross=True)\n\nNetwork Latency\n\nFor best performance, deploy on AWS ap-northeast-1 (Tokyo):\n\nPing to Hyperliquid CloudFront: ~1ms\nAPI latency: ~28ms\nHyperliquid SDK Patch\nThe Problem\n\nNautilus Trader v1.222.0 has bugs in the Hyperliquid adapter:\n\nRust HTTP client serialization causes type mismatches\nPrice precision exceeds Hyperliquid's 5 significant figure limit\nThe Solution\n\nBypass the buggy adapter using the official Hyperliquid Python SDK. The patch file is located at references/hyperliquid_patch.py.\n\nPrice Precision Rules\n\nHyperliquid requires maximum 5 significant figures for all prices:\n\nPrice\tValid?\tSig Figs\n$139.05\tYes\t5\n$139.054\tNo\t6\n$1.2345\tYes\t5\n$1.23456\tNo\t6\n$12345\tYes\t5\n$123456\tNo\t6\nUsage\n# CRITICAL: Import patch BEFORE any Nautilus imports\nimport hyperliquid_patch\n\n# Then import Nautilus normally\nfrom nautilus_trader.adapters.hyperliquid import HYPERLIQUID\n\n\nThe patch auto-applies on import and handles:\n\nPrice formatting to 5 significant figures\nRounding up for buys, down for sells (ensures fills)\nSDK-based order submission bypassing Rust client\nVerified Working\n\nTested on Hyperliquid Mainnet 2025-01-12:\n\nSELL 0.72 SOL @ $143.38 - FILLED\nBUY 0.71 SOL @ $143.39 - FILLED\n\nConfiguration\nFile Structure\nyour_trading_project/\n├── .env                        # Credentials (gitignored)\n├── hyperliquid_patch.py        # SDK patch for live trading\n├── heiken_ashi.py              # Heiken Ashi indicator\n├── my_strategy.py              # Strategy implementation\n├── backtest.py                 # Backtest runner\n├── live.py                     # Live trading runner\n└── data_catalog/               # Parquet data for backtesting\n\nBar Type Format\n{symbol}.{venue}-{step}-{aggregation}-{price_type}-{source}\n\nExamples:\nSOL-USD.HYPERLIQUID-1-HOUR-LAST-EXTERNAL\nSOL-USD.HYPERLIQUID-5-MINUTE-LAST-EXTERNAL\nBTC-USD.HYPERLIQUID-15-MINUTE-LAST-EXTERNAL\n\nTroubleshooting\nOrder Rejected: Invalid Price\n\nEnsure prices have max 5 significant figures. Use the format_price_5_sigfigs() function from the patch.\n\nConnection Error\nCheck .env has correct HYPERLIQUID_PK and HYPERLIQUID_VAULT\nVerify private key format (with or without 0x prefix)\nConfirm vault address is correct\nPatch Not Applied\n\nEnsure import hyperliquid_patch comes BEFORE any Nautilus imports.\n\nMissing Data in Backtest\nVerify data catalog path exists\nCheck instrument IDs match between data and strategy config\nEnsure bar types are correctly formatted\nPosition Not Closing\n\nCheck that reduce_only=True is set on exit orders for netting accounts.\n\nReference Files\n\nDetailed documentation is available in references/:\n\nFile\tDescription\nhyperliquid.md\tComplete Hyperliquid integration guide\nhyperliquid_patch.py\tSDK patch source code\nstrategies.md\tStrategy patterns and examples\nbacktesting.md\tData catalog and backtest API\ndata.md\tData handling and wrangling\ngetting_started.md\tNautilusTrader fundamentals\nconcepts.md\tCore concepts and architecture\napi.md\tFull API reference\n\nUse view to read specific reference files when detailed information is needed."
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/ahuserious/nautilus-trader",
    "publisherUrl": "https://clawhub.ai/ahuserious/nautilus-trader",
    "owner": "ahuserious",
    "version": "0.1.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/nautilus-trader",
    "downloadUrl": "https://openagent3.xyz/downloads/nautilus-trader",
    "agentUrl": "https://openagent3.xyz/skills/nautilus-trader/agent",
    "manifestUrl": "https://openagent3.xyz/skills/nautilus-trader/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/nautilus-trader/agent.md"
  }
}