@hummingbot/skills 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -0
- package/package.json +28 -0
- package/skills/candles-feed/SKILL.md +259 -0
- package/skills/candles-feed/scripts/calculate_indicator.sh +359 -0
- package/skills/candles-feed/scripts/get_candles.sh +158 -0
- package/skills/candles-feed/scripts/get_funding_rate.sh +112 -0
- package/skills/candles-feed/scripts/get_price.sh +86 -0
- package/skills/candles-feed/scripts/list_candle_connectors.sh +47 -0
- package/skills/executor-creator/SKILL.md +212 -0
- package/skills/executor-creator/scripts/clear_position.sh +54 -0
- package/skills/executor-creator/scripts/create_executor.sh +92 -0
- package/skills/executor-creator/scripts/get_executor.sh +37 -0
- package/skills/executor-creator/scripts/get_executor_schema.sh +37 -0
- package/skills/executor-creator/scripts/get_executors_summary.sh +30 -0
- package/skills/executor-creator/scripts/get_position.sh +44 -0
- package/skills/executor-creator/scripts/get_positions.sh +30 -0
- package/skills/executor-creator/scripts/list_executor_types.sh +30 -0
- package/skills/executor-creator/scripts/list_executors.sh +52 -0
- package/skills/executor-creator/scripts/setup_executor.sh +197 -0
- package/skills/executor-creator/scripts/stop_executor.sh +54 -0
- package/skills/hummingbot-api-setup/SKILL.md +308 -0
- package/skills/hummingbot-api-setup/references/original_setup.sh +628 -0
- package/skills/hummingbot-api-setup/scripts/check_prerequisites.sh +92 -0
- package/skills/hummingbot-api-setup/scripts/deploy_full_stack.sh +151 -0
- package/skills/hummingbot-api-setup/scripts/health_check.sh +100 -0
- package/skills/hummingbot-api-setup/scripts/step1_detect_system.sh +88 -0
- package/skills/hummingbot-api-setup/scripts/step2_check_dependencies.sh +81 -0
- package/skills/keys-manager/SKILL.md +132 -0
- package/skills/keys-manager/scripts/add_credentials.sh +106 -0
- package/skills/keys-manager/scripts/get_connector_config.sh +67 -0
- package/skills/keys-manager/scripts/list_account_credentials.sh +82 -0
- package/skills/keys-manager/scripts/list_connectors.sh +64 -0
- package/skills/keys-manager/scripts/remove_credentials.sh +79 -0
- package/skills/keys-manager/scripts/setup_connector.sh +214 -0
- package/skills.json +137 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Check prerequisites for Hummingbot deployment
|
|
3
|
+
# Returns JSON with status of each requirement
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
check_docker() {
|
|
8
|
+
if command -v docker &> /dev/null && docker info &> /dev/null; then
|
|
9
|
+
echo "true"
|
|
10
|
+
else
|
|
11
|
+
echo "false"
|
|
12
|
+
fi
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
check_docker_compose() {
|
|
16
|
+
if command -v docker &> /dev/null && docker compose version &> /dev/null; then
|
|
17
|
+
echo "true"
|
|
18
|
+
else
|
|
19
|
+
echo "false"
|
|
20
|
+
fi
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
check_git() {
|
|
24
|
+
if command -v git &> /dev/null; then
|
|
25
|
+
echo "true"
|
|
26
|
+
else
|
|
27
|
+
echo "false"
|
|
28
|
+
fi
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
check_port() {
|
|
32
|
+
local port=$1
|
|
33
|
+
if ! lsof -i :$port &> /dev/null; then
|
|
34
|
+
echo "true"
|
|
35
|
+
else
|
|
36
|
+
echo "false"
|
|
37
|
+
fi
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
check_disk_space() {
|
|
41
|
+
# Check for at least 5GB free space
|
|
42
|
+
local free_space=$(df -BG . | awk 'NR==2 {print $4}' | sed 's/G//')
|
|
43
|
+
if [ "$free_space" -ge 5 ]; then
|
|
44
|
+
echo "true"
|
|
45
|
+
else
|
|
46
|
+
echo "false"
|
|
47
|
+
fi
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
# Run checks
|
|
51
|
+
DOCKER_OK=$(check_docker)
|
|
52
|
+
COMPOSE_OK=$(check_docker_compose)
|
|
53
|
+
GIT_OK=$(check_git)
|
|
54
|
+
PORT_8000_OK=$(check_port 8000)
|
|
55
|
+
PORT_15672_OK=$(check_port 15672)
|
|
56
|
+
PORT_5432_OK=$(check_port 5432)
|
|
57
|
+
DISK_OK=$(check_disk_space)
|
|
58
|
+
|
|
59
|
+
# Determine overall status
|
|
60
|
+
if [ "$DOCKER_OK" = "true" ] && [ "$COMPOSE_OK" = "true" ] && [ "$GIT_OK" = "true" ] && \
|
|
61
|
+
[ "$PORT_8000_OK" = "true" ] && [ "$PORT_15672_OK" = "true" ] && [ "$PORT_5432_OK" = "true" ] && \
|
|
62
|
+
[ "$DISK_OK" = "true" ]; then
|
|
63
|
+
READY="true"
|
|
64
|
+
else
|
|
65
|
+
READY="false"
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
# Output JSON
|
|
69
|
+
cat << EOF
|
|
70
|
+
{
|
|
71
|
+
"ready": $READY,
|
|
72
|
+
"checks": {
|
|
73
|
+
"docker": $DOCKER_OK,
|
|
74
|
+
"docker_compose": $COMPOSE_OK,
|
|
75
|
+
"git": $GIT_OK,
|
|
76
|
+
"port_8000_available": $PORT_8000_OK,
|
|
77
|
+
"port_15672_available": $PORT_15672_OK,
|
|
78
|
+
"port_5432_available": $PORT_5432_OK,
|
|
79
|
+
"disk_space_5gb": $DISK_OK
|
|
80
|
+
},
|
|
81
|
+
"messages": [
|
|
82
|
+
$([ "$DOCKER_OK" = "false" ] && echo '"Docker is not installed or not running",' || echo '')
|
|
83
|
+
$([ "$COMPOSE_OK" = "false" ] && echo '"Docker Compose is not available",' || echo '')
|
|
84
|
+
$([ "$GIT_OK" = "false" ] && echo '"Git is not installed",' || echo '')
|
|
85
|
+
$([ "$PORT_8000_OK" = "false" ] && echo '"Port 8000 is already in use",' || echo '')
|
|
86
|
+
$([ "$PORT_15672_OK" = "false" ] && echo '"Port 15672 is already in use",' || echo '')
|
|
87
|
+
$([ "$PORT_5432_OK" = "false" ] && echo '"Port 5432 is already in use",' || echo '')
|
|
88
|
+
$([ "$DISK_OK" = "false" ] && echo '"Less than 5GB disk space available",' || echo '')
|
|
89
|
+
$([ "$READY" = "true" ] && echo '"All prerequisites met, ready to deploy"' || echo '"Some prerequisites not met"')
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
EOF
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Deploy the complete Hummingbot stack
|
|
3
|
+
# Usage: ./deploy_full_stack.sh [--with-gateway] [--api-user USERNAME] [--api-pass PASSWORD]
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
# Default values
|
|
8
|
+
API_USER="${API_USER:-admin}"
|
|
9
|
+
API_PASS="${API_PASS:-admin}"
|
|
10
|
+
WITH_GATEWAY=false
|
|
11
|
+
REPO_DIR="${HUMMINGBOT_API_DIR:-$HOME/hummingbot-api}"
|
|
12
|
+
|
|
13
|
+
# Parse arguments
|
|
14
|
+
while [[ $# -gt 0 ]]; do
|
|
15
|
+
case $1 in
|
|
16
|
+
--with-gateway)
|
|
17
|
+
WITH_GATEWAY=true
|
|
18
|
+
shift
|
|
19
|
+
;;
|
|
20
|
+
--api-user)
|
|
21
|
+
API_USER="$2"
|
|
22
|
+
shift 2
|
|
23
|
+
;;
|
|
24
|
+
--api-pass)
|
|
25
|
+
API_PASS="$2"
|
|
26
|
+
shift 2
|
|
27
|
+
;;
|
|
28
|
+
--repo-dir)
|
|
29
|
+
REPO_DIR="$2"
|
|
30
|
+
shift 2
|
|
31
|
+
;;
|
|
32
|
+
*)
|
|
33
|
+
echo "Unknown option: $1"
|
|
34
|
+
exit 1
|
|
35
|
+
;;
|
|
36
|
+
esac
|
|
37
|
+
done
|
|
38
|
+
|
|
39
|
+
echo "=== Hummingbot Full Stack Deployment ==="
|
|
40
|
+
|
|
41
|
+
# Step 1: Check prerequisites
|
|
42
|
+
echo ""
|
|
43
|
+
echo "Step 1: Checking prerequisites..."
|
|
44
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
45
|
+
PREREQ_RESULT=$("$SCRIPT_DIR/check_prerequisites.sh")
|
|
46
|
+
READY=$(echo "$PREREQ_RESULT" | grep -o '"ready": [^,]*' | cut -d' ' -f2)
|
|
47
|
+
|
|
48
|
+
if [ "$READY" != "true" ]; then
|
|
49
|
+
echo "Prerequisites not met:"
|
|
50
|
+
echo "$PREREQ_RESULT"
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
echo "All prerequisites met."
|
|
54
|
+
|
|
55
|
+
# Step 2: Clone or update repository
|
|
56
|
+
echo ""
|
|
57
|
+
echo "Step 2: Setting up repository..."
|
|
58
|
+
if [ -d "$REPO_DIR" ]; then
|
|
59
|
+
echo "Repository exists at $REPO_DIR, pulling latest..."
|
|
60
|
+
cd "$REPO_DIR"
|
|
61
|
+
git pull origin main || echo "Warning: Could not pull latest changes"
|
|
62
|
+
else
|
|
63
|
+
echo "Cloning hummingbot-api repository..."
|
|
64
|
+
git clone https://github.com/hummingbot/hummingbot-api.git "$REPO_DIR"
|
|
65
|
+
cd "$REPO_DIR"
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
# Step 3: Configure environment
|
|
69
|
+
echo ""
|
|
70
|
+
echo "Step 3: Configuring environment..."
|
|
71
|
+
if [ -f .env.example ] && [ ! -f .env ]; then
|
|
72
|
+
cp .env.example .env
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
# Update credentials in .env if it exists
|
|
76
|
+
if [ -f .env ]; then
|
|
77
|
+
# Use sed to update or add credentials
|
|
78
|
+
if grep -q "^API_USERNAME=" .env; then
|
|
79
|
+
sed -i.bak "s/^API_USERNAME=.*/API_USERNAME=$API_USER/" .env
|
|
80
|
+
else
|
|
81
|
+
echo "API_USERNAME=$API_USER" >> .env
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
if grep -q "^API_PASSWORD=" .env; then
|
|
85
|
+
sed -i.bak "s/^API_PASSWORD=.*/API_PASSWORD=$API_PASS/" .env
|
|
86
|
+
else
|
|
87
|
+
echo "API_PASSWORD=$API_PASS" >> .env
|
|
88
|
+
fi
|
|
89
|
+
rm -f .env.bak
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
# Step 4: Pull Docker images
|
|
93
|
+
echo ""
|
|
94
|
+
echo "Step 4: Pulling Docker images..."
|
|
95
|
+
docker compose pull
|
|
96
|
+
|
|
97
|
+
# Step 5: Start services
|
|
98
|
+
echo ""
|
|
99
|
+
echo "Step 5: Starting services..."
|
|
100
|
+
if [ "$WITH_GATEWAY" = true ]; then
|
|
101
|
+
docker compose --profile gateway up -d
|
|
102
|
+
else
|
|
103
|
+
docker compose up -d
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
# Step 6: Wait for services to be healthy
|
|
107
|
+
echo ""
|
|
108
|
+
echo "Step 6: Waiting for services to be healthy..."
|
|
109
|
+
MAX_RETRIES=30
|
|
110
|
+
RETRY_COUNT=0
|
|
111
|
+
|
|
112
|
+
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
|
|
113
|
+
if curl -s -u "$API_USER:$API_PASS" http://localhost:8000/health > /dev/null 2>&1; then
|
|
114
|
+
echo "API server is healthy!"
|
|
115
|
+
break
|
|
116
|
+
fi
|
|
117
|
+
echo "Waiting for API server... (attempt $((RETRY_COUNT + 1))/$MAX_RETRIES)"
|
|
118
|
+
sleep 2
|
|
119
|
+
RETRY_COUNT=$((RETRY_COUNT + 1))
|
|
120
|
+
done
|
|
121
|
+
|
|
122
|
+
if [ $RETRY_COUNT -eq $MAX_RETRIES ]; then
|
|
123
|
+
echo "Warning: API server health check timed out"
|
|
124
|
+
fi
|
|
125
|
+
|
|
126
|
+
# Step 7: Output status
|
|
127
|
+
echo ""
|
|
128
|
+
echo "=== Deployment Complete ==="
|
|
129
|
+
echo ""
|
|
130
|
+
|
|
131
|
+
# Get container status
|
|
132
|
+
CONTAINERS=$(docker compose ps --format json 2>/dev/null || docker compose ps)
|
|
133
|
+
|
|
134
|
+
cat << EOF
|
|
135
|
+
{
|
|
136
|
+
"status": "deployed",
|
|
137
|
+
"api_url": "http://localhost:8000",
|
|
138
|
+
"api_docs": "http://localhost:8000/docs",
|
|
139
|
+
"credentials": {
|
|
140
|
+
"username": "$API_USER",
|
|
141
|
+
"password": "$API_PASS"
|
|
142
|
+
},
|
|
143
|
+
"gateway_enabled": $WITH_GATEWAY,
|
|
144
|
+
"repo_dir": "$REPO_DIR",
|
|
145
|
+
"next_steps": [
|
|
146
|
+
"Add exchange API keys using the keys skill",
|
|
147
|
+
"Create a controller configuration",
|
|
148
|
+
"Deploy your first trading bot"
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
EOF
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Health check for all Hummingbot services
|
|
3
|
+
# Usage: ./health_check.sh [--api-url URL] [--api-user USERNAME] [--api-pass PASSWORD]
|
|
4
|
+
|
|
5
|
+
API_URL="${API_URL:-http://localhost:8000}"
|
|
6
|
+
API_USER="${API_USER:-admin}"
|
|
7
|
+
API_PASS="${API_PASS:-admin}"
|
|
8
|
+
|
|
9
|
+
# Parse arguments
|
|
10
|
+
while [[ $# -gt 0 ]]; do
|
|
11
|
+
case $1 in
|
|
12
|
+
--api-url)
|
|
13
|
+
API_URL="$2"
|
|
14
|
+
shift 2
|
|
15
|
+
;;
|
|
16
|
+
--api-user)
|
|
17
|
+
API_USER="$2"
|
|
18
|
+
shift 2
|
|
19
|
+
;;
|
|
20
|
+
--api-pass)
|
|
21
|
+
API_PASS="$2"
|
|
22
|
+
shift 2
|
|
23
|
+
;;
|
|
24
|
+
*)
|
|
25
|
+
shift
|
|
26
|
+
;;
|
|
27
|
+
esac
|
|
28
|
+
done
|
|
29
|
+
|
|
30
|
+
check_api_health() {
|
|
31
|
+
local response
|
|
32
|
+
local http_code
|
|
33
|
+
|
|
34
|
+
response=$(curl -s -w "\n%{http_code}" -u "$API_USER:$API_PASS" "$API_URL/health" 2>/dev/null)
|
|
35
|
+
http_code=$(echo "$response" | tail -n1)
|
|
36
|
+
|
|
37
|
+
if [ "$http_code" = "200" ]; then
|
|
38
|
+
echo "healthy"
|
|
39
|
+
else
|
|
40
|
+
echo "unhealthy"
|
|
41
|
+
fi
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
check_docker_container() {
|
|
45
|
+
local container_name=$1
|
|
46
|
+
local status
|
|
47
|
+
|
|
48
|
+
status=$(docker inspect --format='{{.State.Health.Status}}' "$container_name" 2>/dev/null || echo "not_found")
|
|
49
|
+
|
|
50
|
+
if [ "$status" = "healthy" ]; then
|
|
51
|
+
echo "healthy"
|
|
52
|
+
elif [ "$status" = "not_found" ]; then
|
|
53
|
+
# Check if container exists but doesn't have health check
|
|
54
|
+
if docker ps --format '{{.Names}}' | grep -q "^${container_name}$"; then
|
|
55
|
+
echo "running"
|
|
56
|
+
else
|
|
57
|
+
echo "not_running"
|
|
58
|
+
fi
|
|
59
|
+
else
|
|
60
|
+
echo "$status"
|
|
61
|
+
fi
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# Check services
|
|
65
|
+
API_STATUS=$(check_api_health)
|
|
66
|
+
POSTGRES_STATUS=$(check_docker_container "hummingbot-postgres")
|
|
67
|
+
EMQX_STATUS=$(check_docker_container "hummingbot-emqx")
|
|
68
|
+
GATEWAY_STATUS=$(check_docker_container "hummingbot-gateway")
|
|
69
|
+
|
|
70
|
+
# Determine overall health
|
|
71
|
+
if [ "$API_STATUS" = "healthy" ]; then
|
|
72
|
+
OVERALL="healthy"
|
|
73
|
+
elif [ "$API_STATUS" = "unhealthy" ] && [ "$POSTGRES_STATUS" != "not_running" ]; then
|
|
74
|
+
OVERALL="degraded"
|
|
75
|
+
else
|
|
76
|
+
OVERALL="unhealthy"
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
# Output JSON
|
|
80
|
+
cat << EOF
|
|
81
|
+
{
|
|
82
|
+
"overall": "$OVERALL",
|
|
83
|
+
"services": {
|
|
84
|
+
"api_server": {
|
|
85
|
+
"status": "$API_STATUS",
|
|
86
|
+
"url": "$API_URL"
|
|
87
|
+
},
|
|
88
|
+
"postgresql": {
|
|
89
|
+
"status": "$POSTGRES_STATUS"
|
|
90
|
+
},
|
|
91
|
+
"emqx": {
|
|
92
|
+
"status": "$EMQX_STATUS"
|
|
93
|
+
},
|
|
94
|
+
"gateway": {
|
|
95
|
+
"status": "$GATEWAY_STATUS"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
99
|
+
}
|
|
100
|
+
EOF
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Step 1: Detect operating system and architecture
|
|
3
|
+
# Returns JSON with system information
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
# Detect OS
|
|
8
|
+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
9
|
+
|
|
10
|
+
# Detect architecture
|
|
11
|
+
ARCH=$(uname -m)
|
|
12
|
+
case "$ARCH" in
|
|
13
|
+
x86_64|amd64) ARCH="amd64" ;;
|
|
14
|
+
aarch64|arm64) ARCH="arm64" ;;
|
|
15
|
+
armv7*|armv8*) ARCH="arm" ;;
|
|
16
|
+
armv*) ARCH="arm" ;;
|
|
17
|
+
*) ARCH="unknown" ;;
|
|
18
|
+
esac
|
|
19
|
+
|
|
20
|
+
# Check disk space (need 2GB minimum)
|
|
21
|
+
REQUIRED_MB=2048
|
|
22
|
+
if [[ "$OS" == "linux" ]] || [[ "$OS" == "darwin" ]]; then
|
|
23
|
+
AVAILABLE_MB=$(df -m . 2>/dev/null | tail -1 | awk '{print $4}')
|
|
24
|
+
else
|
|
25
|
+
AVAILABLE_MB=0
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
if [[ -n "$AVAILABLE_MB" ]] && [[ $AVAILABLE_MB -ge $REQUIRED_MB ]]; then
|
|
29
|
+
DISK_OK="true"
|
|
30
|
+
else
|
|
31
|
+
DISK_OK="false"
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
# Check if running in container
|
|
35
|
+
if [ -f /.dockerenv ] || grep -q docker /proc/1/cgroup 2>/dev/null; then
|
|
36
|
+
IN_CONTAINER="true"
|
|
37
|
+
else
|
|
38
|
+
IN_CONTAINER="false"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# Determine if supported
|
|
42
|
+
if [[ "$OS" == "linux" ]] || [[ "$OS" == "darwin" ]]; then
|
|
43
|
+
SUPPORTED="true"
|
|
44
|
+
else
|
|
45
|
+
SUPPORTED="false"
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# Detect package manager (Linux only)
|
|
49
|
+
PKG_MANAGER="none"
|
|
50
|
+
if [[ "$OS" == "linux" ]]; then
|
|
51
|
+
if command -v apt-get &> /dev/null; then
|
|
52
|
+
PKG_MANAGER="apt-get"
|
|
53
|
+
elif command -v yum &> /dev/null; then
|
|
54
|
+
PKG_MANAGER="yum"
|
|
55
|
+
elif command -v dnf &> /dev/null; then
|
|
56
|
+
PKG_MANAGER="dnf"
|
|
57
|
+
elif command -v apk &> /dev/null; then
|
|
58
|
+
PKG_MANAGER="apk"
|
|
59
|
+
elif command -v pacman &> /dev/null; then
|
|
60
|
+
PKG_MANAGER="pacman"
|
|
61
|
+
fi
|
|
62
|
+
elif [[ "$OS" == "darwin" ]]; then
|
|
63
|
+
if command -v brew &> /dev/null; then
|
|
64
|
+
PKG_MANAGER="homebrew"
|
|
65
|
+
fi
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
cat << EOF
|
|
69
|
+
{
|
|
70
|
+
"os": "$OS",
|
|
71
|
+
"arch": "$ARCH",
|
|
72
|
+
"supported": $SUPPORTED,
|
|
73
|
+
"disk_space_mb": ${AVAILABLE_MB:-0},
|
|
74
|
+
"disk_space_ok": $DISK_OK,
|
|
75
|
+
"required_disk_mb": $REQUIRED_MB,
|
|
76
|
+
"in_container": $IN_CONTAINER,
|
|
77
|
+
"package_manager": "$PKG_MANAGER",
|
|
78
|
+
"messages": [
|
|
79
|
+
"Operating System: $OS",
|
|
80
|
+
"Architecture: $ARCH",
|
|
81
|
+
"Disk Space: ${AVAILABLE_MB:-unknown}MB available (${REQUIRED_MB}MB required)",
|
|
82
|
+
$([ "$DISK_OK" = "false" ] && echo "\"WARNING: Insufficient disk space\"," || echo "")
|
|
83
|
+
$([ "$SUPPORTED" = "false" ] && echo "\"WARNING: Unsupported operating system\"," || echo "")
|
|
84
|
+
$([ "$IN_CONTAINER" = "true" ] && echo "\"NOTE: Running inside a container\"," || echo "")
|
|
85
|
+
"Package Manager: $PKG_MANAGER"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
EOF
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Step 2: Check for required dependencies
|
|
3
|
+
# Returns JSON with dependency status
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
check_command() {
|
|
8
|
+
if command -v "$1" &> /dev/null; then
|
|
9
|
+
echo "true"
|
|
10
|
+
else
|
|
11
|
+
echo "false"
|
|
12
|
+
fi
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
# Check each dependency
|
|
16
|
+
GIT_OK=$(check_command git)
|
|
17
|
+
CURL_OK=$(check_command curl)
|
|
18
|
+
DOCKER_OK=$(check_command docker)
|
|
19
|
+
MAKE_OK=$(check_command make)
|
|
20
|
+
|
|
21
|
+
# Check docker-compose (either plugin or standalone)
|
|
22
|
+
if docker compose version &> /dev/null 2>&1; then
|
|
23
|
+
DOCKER_COMPOSE_OK="true"
|
|
24
|
+
DOCKER_COMPOSE_TYPE="plugin"
|
|
25
|
+
elif command -v docker-compose &> /dev/null; then
|
|
26
|
+
DOCKER_COMPOSE_OK="true"
|
|
27
|
+
DOCKER_COMPOSE_TYPE="standalone"
|
|
28
|
+
else
|
|
29
|
+
DOCKER_COMPOSE_OK="false"
|
|
30
|
+
DOCKER_COMPOSE_TYPE="none"
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
# Build missing list
|
|
34
|
+
MISSING=()
|
|
35
|
+
[ "$GIT_OK" = "false" ] && MISSING+=("git")
|
|
36
|
+
[ "$CURL_OK" = "false" ] && MISSING+=("curl")
|
|
37
|
+
[ "$DOCKER_OK" = "false" ] && MISSING+=("docker")
|
|
38
|
+
[ "$DOCKER_COMPOSE_OK" = "false" ] && MISSING+=("docker-compose")
|
|
39
|
+
[ "$MAKE_OK" = "false" ] && MISSING+=("make")
|
|
40
|
+
|
|
41
|
+
# Determine overall status
|
|
42
|
+
if [ ${#MISSING[@]} -eq 0 ]; then
|
|
43
|
+
ALL_OK="true"
|
|
44
|
+
else
|
|
45
|
+
ALL_OK="false"
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# Convert missing array to JSON
|
|
49
|
+
MISSING_JSON=$(printf '%s\n' "${MISSING[@]}" | jq -R . | jq -s .)
|
|
50
|
+
|
|
51
|
+
cat << EOF
|
|
52
|
+
{
|
|
53
|
+
"all_dependencies_met": $ALL_OK,
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"git": {
|
|
56
|
+
"installed": $GIT_OK,
|
|
57
|
+
"purpose": "Clone repositories"
|
|
58
|
+
},
|
|
59
|
+
"curl": {
|
|
60
|
+
"installed": $CURL_OK,
|
|
61
|
+
"purpose": "Download files and make API calls"
|
|
62
|
+
},
|
|
63
|
+
"docker": {
|
|
64
|
+
"installed": $DOCKER_OK,
|
|
65
|
+
"purpose": "Run containerized services"
|
|
66
|
+
},
|
|
67
|
+
"docker_compose": {
|
|
68
|
+
"installed": $DOCKER_COMPOSE_OK,
|
|
69
|
+
"type": "$DOCKER_COMPOSE_TYPE",
|
|
70
|
+
"purpose": "Orchestrate multi-container deployments"
|
|
71
|
+
},
|
|
72
|
+
"make": {
|
|
73
|
+
"installed": $MAKE_OK,
|
|
74
|
+
"purpose": "Run build and setup commands"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"missing": $MISSING_JSON,
|
|
78
|
+
"missing_count": ${#MISSING[@]},
|
|
79
|
+
"next_step": $([ "$ALL_OK" = "true" ] && echo '"All dependencies installed. Proceed to step 4 (check Docker status)."' || echo '"Install missing dependencies using step3_install_dependency.sh"')
|
|
80
|
+
}
|
|
81
|
+
EOF
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: keys-manager
|
|
3
|
+
description: Manage exchange API keys and credentials for Hummingbot trading. Use this skill when the user wants to add, remove, or list API credentials for exchanges like Binance, Coinbase, Kraken, etc.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Hummingbot Keys Skill
|
|
8
|
+
|
|
9
|
+
This skill manages exchange API keys and credentials for Hummingbot. It uses **progressive disclosure** to guide users through the setup process step by step.
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
- Hummingbot API server must be running (use the setup skill first)
|
|
14
|
+
- API server credentials (default: admin/admin)
|
|
15
|
+
|
|
16
|
+
## Quick Start: Setup Connector (Progressive Disclosure)
|
|
17
|
+
|
|
18
|
+
The `setup_connector.sh` script uses a 4-step progressive flow:
|
|
19
|
+
|
|
20
|
+
### Step 1: List Available Exchanges
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
./scripts/setup_connector.sh
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Shows all available connectors and current account status.
|
|
27
|
+
|
|
28
|
+
### Step 2: Show Required Credentials
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
./scripts/setup_connector.sh --connector binance
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Shows what credential fields are required for that exchange.
|
|
35
|
+
|
|
36
|
+
### Step 3: Select Account
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
./scripts/setup_connector.sh --connector binance \
|
|
40
|
+
--credentials '{"binance_api_key":"YOUR_KEY","binance_api_secret":"YOUR_SECRET"}'
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Shows available accounts and prompts you to select one.
|
|
44
|
+
|
|
45
|
+
### Step 4: Connect
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
./scripts/setup_connector.sh --connector binance \
|
|
49
|
+
--credentials '{"binance_api_key":"YOUR_KEY","binance_api_secret":"YOUR_SECRET"}' \
|
|
50
|
+
--account master_account
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Completes the connection. Use `--force` to override existing credentials.
|
|
54
|
+
|
|
55
|
+
## Other Scripts
|
|
56
|
+
|
|
57
|
+
### List All Connectors
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
./scripts/list_connectors.sh
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Get Connector Requirements
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
./scripts/get_connector_config.sh --connector binance
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Add Credentials Directly
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
./scripts/add_credentials.sh \
|
|
73
|
+
--connector binance \
|
|
74
|
+
--account master_account \
|
|
75
|
+
--credentials '{"binance_api_key": "KEY", "binance_api_secret": "SECRET"}'
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Remove Credentials
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
./scripts/remove_credentials.sh \
|
|
82
|
+
--connector binance \
|
|
83
|
+
--account master_account
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### List Account Credentials
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
./scripts/list_account_credentials.sh --account master_account
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Supported Exchanges
|
|
93
|
+
|
|
94
|
+
### Centralized Exchanges (CEX)
|
|
95
|
+
|
|
96
|
+
| Exchange | Connector Name | Required Fields |
|
|
97
|
+
|----------|----------------|-----------------|
|
|
98
|
+
| Binance | `binance` | api_key, api_secret |
|
|
99
|
+
| Binance Perpetual | `binance_perpetual` | api_key, api_secret |
|
|
100
|
+
| Coinbase | `coinbase_advanced_trade` | api_key, api_secret |
|
|
101
|
+
| Kraken | `kraken` | api_key, api_secret |
|
|
102
|
+
| KuCoin | `kucoin` | api_key, api_secret, passphrase |
|
|
103
|
+
| Gate.io | `gate_io` | api_key, api_secret |
|
|
104
|
+
| OKX | `okx` | api_key, api_secret, passphrase |
|
|
105
|
+
| Bybit | `bybit` | api_key, api_secret |
|
|
106
|
+
| Hyperliquid | `hyperliquid_perpetual` | address, secret_key |
|
|
107
|
+
|
|
108
|
+
## Security Notes
|
|
109
|
+
|
|
110
|
+
- **Never log credentials** - credentials should only be passed to scripts, never echoed
|
|
111
|
+
- **Credentials are encrypted** - Hummingbot encrypts all stored credentials
|
|
112
|
+
- **API key permissions** - recommend users create keys with minimal required permissions
|
|
113
|
+
|
|
114
|
+
## API Endpoints Used
|
|
115
|
+
|
|
116
|
+
| Endpoint | Method | Description |
|
|
117
|
+
|----------|--------|-------------|
|
|
118
|
+
| `/connectors/` | GET | List available connectors |
|
|
119
|
+
| `/connectors/{name}/config-map` | GET | Get required credential fields |
|
|
120
|
+
| `/accounts/` | GET | List accounts |
|
|
121
|
+
| `/accounts/{name}/credentials` | GET | List account credentials |
|
|
122
|
+
| `/accounts/{name}/credentials` | POST | Add credentials |
|
|
123
|
+
| `/accounts/{name}/credentials/{connector}` | DELETE | Remove credentials |
|
|
124
|
+
|
|
125
|
+
## Error Handling
|
|
126
|
+
|
|
127
|
+
| Error | Cause | Solution |
|
|
128
|
+
|-------|-------|----------|
|
|
129
|
+
| "Invalid credentials" | Wrong API key/secret | Verify credentials are correct |
|
|
130
|
+
| "Connector not found" | Typo in connector name | Use Step 1 to see valid names |
|
|
131
|
+
| "Account not found" | Account doesn't exist | Use default "master_account" |
|
|
132
|
+
| "Credentials already exist" | Connector already configured | Use --force to override |
|