LeoYeAI/agent-master-skills / skills/binance-spot
spot
VerifiedBinance Spot request using the Binance API. Authentication requires API key and secret key. Supports testnet, mainnet, and demo.
| File | Kind | Size |
|---|---|---|
| CHANGELOG.md | markdown | 400 B |
| LICENSE.md | markdown | 1.0 KB |
| SKILL.md | skill md | 28.4 KB |
| _meta.json | config | 288 B |
| references/authentication.md | markdown | 4.1 KB |
references/authentication.md
View on GitHub# Binance Authentication
All trading endpoints require either HMAC SHA256, RSA, or Ed25519 signed requests.
**Always detect the key type before signing**, do not assume HMAC.
## Base URLs
| Environment | URL |
|-------------|-----|
| Mainnet | https://api.binance.com |
| Testnet | https://testnet.binance.vision |
## Required Headers
* `X-MBX-APIKEY`: your_api_key
* `User-Agent`: binance-spot/1.1.0 (Skill)
## Signing Process
### Step 1: Build Query String
Include all parameters plus `timestamp` (current Unix time in milliseconds):
`symbol=BTCUSDT&side=BUY&type=MARKET&quantity=0.001×tamp=1234567890123`
**Optional:** Add `recvWindow` (default 5000ms) for timestamp tolerance.
### Step 2: Percent‑Encode Parameters
Before generating the signature, **percent‑encode all parameter names and values using UTF‑8 encoding according to RFC 3986.**
Unreserved characters that must not be encoded: `A-Z a-z 0-9 - _ . ~`
- Chinese characters example:
`symbol=这是测试币456`
Percent‑encoded:
`symbol=%E8%BF%99%E6%98%AF%E6%B5%8B%E8%AF%95%E5%B8%81456`
**Important:**
The exact encoded query string must be used for both signing and the HTTP request.
### Step 3: Generate Signature
Generate the signature from the encoded query string. The agent will need to determine which signing method to use based on the credentials provided. If a secret key is provided, use HMAC SHA256. If a private key is provided, use RSA or Ed25519 depending on the key type.
#### HMAC SHA256 signature
Create HMAC SHA256 signature of the query string using your secret key:
```bash
# Example using openssl
echo -n "symbol=BTCUSDT&side=BUY&type=MARKET&quantity=0.001×tamp=1234567890123" | \
openssl dgst -sha256 -hmac "your_secret_key"
```
#### RSA signature
Create RSA signature of the query string using your private key:
```bash
# Example using openssl
echo -n "symbol=BTCUSDT&side=BUY&type=MARKET&quantity=0.001×tamp=1234567890123" | \
openssl dgst -sha256 -sign private_key.pem | base64
```
#### Ed25519 signature
Create Ed25519 signature of the query string using your private key:
```bash
# Example using openssl
echo -n "symbol=BTCUSDT&side=BUY&type=MARKET&quantity=0.001×tamp=1234567890123" | \
openssl pkeyutl -sign -inkey private_key.pem | base64
```
### Step 4: Append Signature
Add signature parameter to the query string:
`symbol=BTCUSDT&side=BUY&type=MARKET&quantity=0.001×tamp=1234567890123&signature=abc123...`
### Step 5: Add Product User Agent Header
Include `User-Agent` header with the following string: `binance-spot/1.1.0 (Skill)`
#### Complete Example
Request:
```bash
curl -X POST "https://api.binance.com/api/v3/order" \
-H "X-MBX-APIKEY: your_api_key" \
-H "User-Agent: binance-spot/1.1.0 (Skill)" \
-d "symbol=BTCUSDT&side=BUY&type=MARKET&quantity=0.001×tamp=1234567890123&signature=..."
```
```bash
#!/bin/bash
API_KEY="your_api_key"
SECRET_KEY="your_secret_key"
BASE_URL="https://api.binance.com" # or https://testnet.binance.vision
# Get current timestamp
TIMESTAMP=$(date +%s000)
# Build query string (without signature)
QUERY="symbol=BTCUSDT&side=BUY&type=MARKET&quantity=0.001×tamp=${TIMESTAMP}"
# Generate signature
# For HMAC SHA256:
SIGNATURE=$(echo -n "$QUERY" | openssl dgst -sha256 -hmac "$SECRET_KEY" | cut -d' ' -f2)
# For RSA or Ed25519, replace the above line with the appropriate signing command.
## RSA:
# SIGNATURE=$(echo -n "$QUERY" | openssl dgst -sha256 -sign private_key.pem | base64)
## Ed25519:
# SIGNATURE=$(echo -n "$QUERY" | openssl pkeyutl -sign -inkey private_key.pem | base64)
# Make request
curl -X POST "${BASE_URL}/api/v3/order?${QUERY}&signature=${SIGNATURE}" \
-H "X-MBX-APIKEY: ${API_KEY}"\
-H "User-Agent: binance-spot/1.1.0 (Skill)"
```
If you get -1021 Timestamp outside recvWindow:
1. Check server time: GET /api/v3/time
2. Sync your clock or adjust timestamp
3. Increase recvWindow (max 60000ms)
### Security Notes
* Never share your secret key
* Use IP whitelist in Binance API settings
* Enable only required permissions (spot trading, no withdrawals)
* Use testnet for development: https://testnet.binance.vision
* Testnet credentials are separate from mainnetRelated skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |