跳转至内容

添加新命令

目前,Hummingbot 支持以下命令:

Supported Commands

根据 hummingbot 客户端的使用情况,您可能需要向客户端添加新命令。这通过向 hummingbot/client/command 目录添加新的命令类来完成。

新的命令类应命名为 <command_name>_command.py

新的类应命名为 <CommandName>Command 并遵循驼峰命名法。

新类应包含一个名为 command_name 的函数,当在 Hummingbot 客户端中调用该命令时将运行此函数。

将新类添加到 hummingbot/client/command 目录中的 __init__.py 文件中,并将任何必要的导入添加到 __init__.py 文件中。

__init__.py File

最后一步是添加新命令类可能需要的任何其他函数。

请注意:检查 hummingbot/client/command 目录中是否存在与您正在添加的新命令相似的现有命令。

创建命令快捷方式

要使用此功能,请打开并配置 hummingbot_conf 文件夹下的 conf_client.yml

注意

在 Hummingbot 的过去版本(1.5.0 及以下版本)中,conf_client.yml 文件名为 conf_global.yml

导入代码行以创建自定义命令快捷方式。

# Command Shortcuts
# Define abbreviations for often used commands
# or batch grouped commands together

command_shortcuts:
  # Assign shortcut command
  command: spreads_refresh

  # Reference
  help: Set bid spread, ask spread, and order refresh time

  # Argument Label
  arguments: [Bid Spread, Ask Spread, Order Refresh Time]

  # Original config output with value
  output: [config bid_spread $1, config ask_spread $2, config order_refresh_time $3]

注意

自定义命令只能在导入策略后使用。

Custom Script Instructions