Getting Started
Trigger.Trade is a professional PHP-based trading connector that allows you to trade on multiple cryptocurrency exchanges through a unified API.
Important: To use the JSON Generator and API Encryptor tools, you need to
login with your subscription. These tools are only available to active subscribers.
What You Get
- Complete source code (PHP 8.0+)
- Support for 10 active exchanges: Bybit, BloFin, Toobit, Evedex, Pionex, Bitget, BingX, Binance, Kraken, OKX
- Coming Soon: Gate.io, MEXC (Spot), KuCoin, Coinbase Advanced, Deribit, HTX, Crypto.com, dYdX, BitMEX, Bitfinex, WhiteBIT, BitMart, Phemex, Hyperliquid, Apex Pro
- Coming Soon: MT4, MT5, and cTrader platform integrations
- 200+ features including multi-TP, pyramiding prevention, encryption
- Comprehensive documentation
- Admin dashboard
- JSON Generator - Generate trading configurations (login required)
- API Encryptor - Encrypt API credentials (login required)
- Monthly updates with new exchanges and features
Quick Start Workflow
- Subscribe: Purchase a subscription plan
- Login: Login with Whop
- Get API Keys: Follow the API Keys guide below
- Generate Config: Use the JSON Generator to create your trading setup
- Setup TradingView: Follow the TradingView setup guide
- Start Trading: Activate your TradingView alerts
Requirements
- Active subscription (for generator and encryptor access)
- API keys from your exchange
- TradingView account (for webhook alerts)
- Server hosting Trigger.Trade connector (provided by you or your hosting provider)
Getting API Keys from Exchanges
To use Trigger.Trade, you need API keys from your exchange. Follow these guides to obtain them.
Bybit API Keys
- Log in to Bybit: Go to www.bybit.com and log in to your account
- Navigate to API Management:
- Click on your profile icon (top right)
- Select "API" from the dropdown menu
- Or go directly to: API Management
- Create API Key:
- Click "Create New Key"
- Select "System-generated API Key"
- Choose "Read & Write" permissions
- Enable "Futures Trading" permission
- Enable "Unified Trading Account" if using UTA
- Set IP Restrictions (Recommended):
- Add your server IP address
- Or leave blank for development (less secure)
- Save Credentials:
- Copy your API Key immediately
- Copy your Secret Key immediately
- Important: Secret key is only shown once!
- Store them securely
- Testnet Option:
- For testing, use Bybit Testnet: testnet.bybit.com
- Create separate API keys on testnet
- Use
use_testnet: "1" in your requests
Security Tips:
- Never share your API keys
- Use IP whitelisting for production
- Enable only necessary permissions
- Regenerate keys if compromised
BloFin API Keys
- Log in to BloFin: Go to www.blofin.com and log in
- Navigate to API Management:
- Click on your profile icon
- Go to "API Management" or "API Settings"
- Or visit: API Management
- Create API Key:
- Click "Create API Key" or "Add API Key"
- Enter a label/name for your API key
- Set permissions: Enable "Trade" and "Read"
- Enable "Futures Trading" permission
- Set Passphrase:
- Create a secure passphrase (remember this!)
- This is required for BloFin API authentication
- Store it securely with your API keys
- IP Restrictions:
- Add your server IP for security
- Or leave blank for development
- Save Credentials:
- Copy API Key
- Copy Secret Key
- Save your Passphrase
- All three are required for BloFin
- Testnet:
Toobit API Keys
- Log in to Toobit: Go to www.toobit.com
- API Management:
- Go to Account Settings
- Navigate to "API Management" or "API Keys"
- Create API Key:
- Click "Create API Key"
- Enable "Trade" permissions
- Enable "Futures" if trading futures
- Save Credentials:
- Copy API Key and Secret Key
- Store securely
Evedex API Keys
- Log in to Evedex: Go to www.evedex.com
- API Management:
- Go to Account Settings
- Find "API Management" section
- Create API Key:
- Click "Create API Key"
- Set trading permissions
- Enable futures trading if needed
- Save Credentials:
- Copy API Key and Secret Key
- Store securely
Pionex API Keys
- Log in to Pionex: Go to www.pionex.com
- API Management:
- Go to Account Settings
- Navigate to "API Management" or "API Keys" section
- Or visit: Pionex API Management
- Create API Key:
- Click "Create API Key" or "New API Key"
- Set a label/name for your API key
- Enable "Read" and "Trade" permissions
- Important: Set up IP whitelisting for security (recommended)
- Save Credentials:
- Copy API Key and Secret Key immediately
- Warning: Secret key is only shown once - save it securely
- Store credentials in a secure location
- Note: Pionex uses underscore format for symbols (e.g., BTC_USDT)
- Security Best Practices:
- Enable IP whitelisting in API settings
- Only grant necessary permissions (Read + Trade)
- Never share your API keys
- Use the API Encryptor to encrypt credentials
Note: Pionex.US does not currently support API keys. Use the main Pionex platform (pionex.com) for API access. For more information, visit the
Pionex API documentation.
Bitget API Keys
- Log in to Bitget: Go to www.bitget.com
- API Management:
- Create API Key:
- Click "Create API Key"
- Complete security verification (2FA required)
- Set a label/name for your API key
- Enable "Read" permission
- Enable "Trade" permission
- Important: Set up IP whitelisting for security (highly recommended)
- Note: Bitget requires a passphrase - remember this as you'll need it
- Save Credentials:
- Copy API Key, Secret Key, and Passphrase immediately
- Warning: Secret key and passphrase are only shown once - save them securely
- Store credentials in a secure location
- Note: Bitget uses standard format for symbols (e.g., BTCUSDT)
BingX API Keys
- Log in to BingX: Go to www.bingx.com
- API Management:
- Create API Key:
- Click "Create API Key"
- Complete security verification
- Set a label/name for your API key
- Enable "Read" and "Trade" permissions
- Important: Set up IP whitelisting for security
- Save Credentials:
- Copy API Key and Secret Key immediately
- Warning: Secret key is only shown once - save it securely
- Store credentials in a secure location
- Note: BingX uses hyphen format for symbols (e.g., BTC-USDT)
Binance API Keys
- Log in to Binance: Go to www.binance.com
- API Management:
- Create API Key:
- Click "Create API"
- Complete security verification (2FA required)
- Set a label/name for your API key
- Enable "Enable Reading" permission
- Enable "Enable Futures" permission
- Important: Set up IP whitelisting for security (highly recommended)
- Security: Never enable "Enable Withdrawals" unless absolutely necessary
- Save Credentials:
- Copy API Key and Secret Key immediately
- Warning: Secret key is only shown once - save it securely
- Store credentials in a secure location
- Note: Binance uses standard format for symbols (e.g., BTCUSDT)
Kraken API Keys
- Log in to Kraken: Go to www.kraken.com
- API Management:
- Create API Key:
- Click "Generate API Key"
- Complete security verification (2FA required)
- Set a label/name for your API key
- Enable "Query Funds" permission
- Enable "Create & Modify Orders" permission
- Important: Set up IP whitelisting for security (highly recommended)
- Security: Never enable "Withdraw Funds" unless absolutely necessary
- Save Credentials:
- Copy API Key and Secret Key immediately
- Warning: Secret key is only shown once - save it securely
- Important: Secret key must be Base64-encoded (Kraken provides it this way)
- Store credentials in a secure location
- Note: Kraken uses XBT instead of BTC (e.g., XBTUSD or PI_XBTUSD for futures)
- Security Best Practices:
- Enable IP whitelisting in API settings
- Only grant necessary permissions (Query Funds, Create & Modify Orders)
- Never share your API keys
- Use the API Encryptor to encrypt credentials
- Regularly rotate your API keys
- Keep your secret key Base64-encoded as provided by Kraken
OKX API Keys
- Log in to OKX: Go to www.okx.com
- API Management:
- Create API Key:
- Click "Create API Key"
- Complete security verification (2FA required)
- Set a label/name for your API key
- Enable "Read" permission
- Enable "Trade" permission
- Important: Set up IP whitelisting for security (highly recommended)
- Security: Never enable "Withdraw" permission unless absolutely necessary
- Note: OKX requires a passphrase - remember this as you'll need it
- Save Credentials:
- Copy API Key, Secret Key, and Passphrase immediately
- Warning: Secret key and passphrase are only shown once - save them securely
- Store credentials in a secure location
- Note: OKX uses format like BTC-USDT-SWAP for futures (with -SWAP suffix)
- Security Best Practices:
- Enable IP whitelisting in API settings
- Only grant necessary permissions (Read + Trade)
- Never share your API keys
- Use the API Encryptor to encrypt credentials
- Regularly rotate your API keys
Next Steps: After obtaining API keys:
- Login: Login to Trigger.Trade (subscription required)
- Encrypt (Optional): Use the API Encryptor to encrypt your credentials
- Generate Config: Use the JSON Generator to create your trading configuration
- Setup Webhooks: Follow the TradingView setup guide below
TradingView Webhook Setup
Connect your TradingView alerts to Trigger.Trade using webhooks. Follow these steps to set up automated trading.
Prerequisites
- TradingView account (Free or Premium)
- Trigger.Trade subscription (for generator access)
- API keys from your exchange
- Your Trigger.Trade webhook URL
Access Required: The JSON Generator requires login. Make sure you have an active subscription and are logged in before proceeding.
Step 1: Generate Your Webhook Configuration
- Login to Trigger.Trade:
- Go to login page
- Login with Whop (if subscribed)
- You'll be redirected to the dashboard after login
- Open JSON Generator:
- Navigate to the Generator page
- If not logged in, you'll be redirected to login
- Configure Settings:
- Select your exchange (Bybit, BloFin, etc.)
- Enter your API credentials
- Set trading parameters (leverage, margin mode, etc.)
- Configure quantity and order types
- Set Base URL:
- Enter your domain (e.g.,
https://yourdomain.com)
- This is where your Trigger.Trade is hosted
- Generate Configuration:
- Click "Generate JSON & Webhook"
- You'll see webhook URL and JSON payload
Step 2: Create TradingView Alert
- Open TradingView Chart:
- Go to TradingView.com
- Open a chart for your trading pair (e.g., BTCUSDT)
- Add your trading strategy/indicator
- Create Alert:
- Click the "Alert" button (bell icon) on the chart
- Or right-click on the chart → "Add Alert"
- Configure Alert Conditions:
- Condition: Select your strategy condition (e.g., "Strategy Alert")
- Expiration: Set alert expiration (or leave unlimited)
- Frequency: Choose "Once Per Bar Close" (recommended)
- Set Notification Method:
- Scroll down to "Notifications" section
- Click "Webhook URL" checkbox
- You'll see a URL field appear
Step 3: Configure Webhook in TradingView
- Copy Webhook URL:
- In Trigger.Trade Generator, select the tab for your action:
- Enter Long: For opening long positions
- Exit Long: For closing long positions
- Enter Short: For opening short positions
- Exit Short: For closing short positions
- Click "Copy URL" button next to the webhook URL
- The URL will look like:
https://yourdomain.com/blofin/public/trade.php
- Paste in TradingView:
- Paste the webhook URL into TradingView's "Webhook URL" field
- Copy JSON Payload:
- In Trigger.Trade Generator, copy the JSON payload
- Click "Copy JSON" button
- Paste JSON in Message Field:
- In TradingView alert, find the "Message" field
- Paste the JSON payload here
- This JSON will be sent as POST body to your webhook
Step 4: Test Your Setup
- Use Testnet First:
- Set
use_testnet: "1" in your JSON
- Use testnet API keys
- Test with small amounts
- Create Test Alert:
- Set alert condition to trigger immediately
- Save and activate the alert
- Wait for alert to trigger
- Verify Execution:
- Check your exchange account for the order
- Check Trigger.Trade admin panel for trade logs
- Verify Telegram notifications (if enabled)
Step 5: Create Multiple Alerts
For a complete trading system, create separate alerts for each action:
- Long Entry Alert: Uses "Enter Long" webhook and JSON
- Long Exit Alert: Uses "Exit Long" webhook and JSON
- Short Entry Alert: Uses "Enter Short" webhook and JSON
- Short Exit Alert: Uses "Exit Short" webhook and JSON
Note: All alerts use the same webhook URL, but different JSON payloads based on the position type.
TradingView Alert Message Format
The JSON payload you paste in TradingView's "Message" field will be sent as the POST body. TradingView supports variables in the message:
{
"mode": "trade",
"api_key": "YOUR_API_KEY",
"secret_key": "YOUR_SECRET_KEY",
"coin_pair": "{{ticker}}",
"position": "0",
"qty": "100",
"entry_order_type": "1",
"leverage": "10"
}
TradingView Variables:
{{ticker}} - Symbol name (e.g., BTCUSDT)
{{close}} - Close price
{{time}} - Alert time
{{volume}} - Volume
You can use these variables in your JSON for dynamic values.
Troubleshooting TradingView Webhooks
Alert Not Triggering Trades
- Verify webhook URL is correct and accessible
- Check JSON payload is valid JSON
- Ensure API keys are correct
- Check exchange account has sufficient balance
- Verify API keys have trading permissions
Webhook URL Not Working
- Test URL in browser (should return error, but confirms it's accessible)
- Check server is running and accessible
- Verify HTTPS is enabled (required for TradingView)
- Check firewall/security settings
JSON Errors
- Validate JSON syntax using online JSON validator
- Ensure all required fields are present
- Check for special characters that need escaping
- Verify TradingView variables are properly formatted
Pro Tip: Start with testnet and small amounts. Once everything works correctly, switch to mainnet with your desired position sizes.
Telegram Notifications Setup
Get real-time notifications about your trades directly in Telegram. This feature allows you to monitor your trading activity, receive error alerts, and track successful trades.
Step 1: Add the Trigger.Trade Bot
- Open Telegram: Open the Telegram app on your phone or desktop
- Add the Bot: Click this link to add the bot: @DaviddTechAPIbot
- Start the Bot: Click "Start" or send
/start to the bot
- Verify Connection: The bot will confirm it's ready to send you notifications
Step 2: Get Your Telegram Chat ID
You need your Telegram Chat ID to receive notifications. There are two methods:
Method 1: Using @userinfobot (Easiest)
- Open Telegram: Search for
@userinfobot
- Start the Bot: Click "Start" or send
/start
- Get Your ID: The bot will immediately send you a message with your information
- Copy Your ID: Look for a number labeled "Id:" - this is your Chat ID (e.g.,
123456789)
- Save It: Copy this number - you'll use it as your
channelName in Trigger.Trade
Method 2: Using @getidsbot
- Search: Find
@getidsbot in Telegram
- Start: Click "Start" or send
/start
- Get ID: The bot will reply with your Chat ID
- Copy: Save the numeric ID shown
Method 3: For Telegram Channels/Groups
If you want to send notifications to a Telegram channel or group:
- Create Channel/Group: Create a new Telegram channel or group
- Add Bot as Admin: Add @DaviddTechAPIbot as an administrator to your channel/group
- Get Channel ID: Forward a message from the channel to
@userinfobot
- Use Channel ID: The ID will be negative (e.g.,
-1001234567890)
Important: For channels, the Chat ID will be negative. Make sure to include the minus sign when using it.
Note: You don't need to create your own bot or get a bot token. Simply add
@DaviddTechAPIbot and get your Chat ID - that's all you need!
Step 3: Configure Telegram in JSON Generator
- Login: Login to Trigger.Trade (subscription required)
- Open Generator: Navigate to the JSON Generator
- Scroll to Advanced Options: Find the "Advanced Options" section
- Set Telegram Bot Mode: Choose your notification preference:
- All: Receive all notifications (successful trades, errors, info)
- Errors Only: Only receive error notifications
- Notifications: Manual trader mode (notifications only)
- Enter Chat ID: In the "Telegram Channel ID" field, enter your Chat ID from Step 2
- Generate JSON: Click "Generate JSON & Webhook"
- Copy JSON: Your generated JSON will include the Telegram settings
Step 4: Add Telegram Settings to Your JSON
Your generated JSON will include these Telegram fields:
{
"mode": "trade",
"api_key": "YOUR_API_KEY",
"secret_key": "YOUR_SECRET_KEY",
"coin_pair": "BTCUSDT",
"position": "0",
"qty": "100",
"telegram_bot": "0",
"channelName": "123456789"
}
Important: The
channelName field should contain your Telegram Chat ID (the number you got from @userinfobot), not a channel name. The bot
@DaviddTechAPIbot will automatically send notifications to this ID.
Telegram Bot Modes Explained:
- "0" - All: Receive all trade notifications including successful trades, errors, and balance updates
- "1" - Errors Only: Only receive notifications when errors occur
- "2" - Notifications: Manual trader mode - notifications only, no trades executed
Step 5: Test Your Telegram Notifications
Make sure you've added and started the @DaviddTechAPIbot before testing.
- Send Test Alert: Trigger a test trade from TradingView
- Check Telegram: You should receive a notification in Telegram
- Verify Format: The notification should include:
- Trade status (success/error)
- Symbol and position
- Order details
- Balance information
- Execution time
Telegram Notification Format
Your Telegram notifications will look like this:
✅ Trade Executed Successfully
📊 Symbol: BTCUSDT
📈 Position: Long
💰 Quantity: 0.001 BTC
💵 Price: $45,000.00
⚡ Leverage: 10x
📊 Margin Mode: Isolated
💼 Balance Info:
Wallet Balance: $1,000.00
Available Margin: $950.00
⏱ Execution Time: 0.234s
🆔 Log ID: abc123xyz
Troubleshooting Telegram Notifications
Not Receiving Notifications
- Verify your Chat ID is correct (check with @userinfobot again)
- Ensure you've started a conversation with your bot (send /start)
- Check that
channelName is included in your JSON
- Verify
telegram_bot is set to "0", "1", or "2"
Wrong Chat ID Format
- Personal chats: Positive number (e.g.,
123456789)
- Channels/Groups: Negative number (e.g.,
-1001234567890)
- Make sure there are no spaces or extra characters
Bot Not Responding
- Make sure you've added and started @DaviddTechAPIbot
- Send
/start to the bot to initialize it
- Check that the bot hasn't been blocked
- Verify your Chat ID is correct
Pro Tip: Use a dedicated Telegram channel for trading notifications so you can easily review your trading history and share it with team members if needed.
API Encryptor Guide
The API Encryptor adds an extra layer of security to your API credentials by encrypting them before use. This helps protect your credentials even if they're intercepted.
Access Required: The API Encryptor requires login. Make sure you have an active subscription and are logged in before proceeding.
What is the Encryptor?
The encryptor uses industry-standard encryption to protect your API credentials:
- Algorithm: AES-256-CBC encryption
- Key Derivation: PBKDF2 with SHA-256
- Iterations: 100,000 iterations (high security) or 1,000 (standard)
- Purpose: Adds an extra layer of security to your API keys
Important: The encryptor protects your credentials during transmission and storage, but it does NOT protect against:
- Sharing your encrypted credentials publicly
- Malware or keyloggers on your device
- Phishing attacks
Always follow best security practices.
Step 1: Access the Encryptor
- Login: Login to Trigger.Trade with your subscription
- Navigate: Go to the API Encryptor page
- Verify Access: You should see the encryptor form (if not, you'll be redirected to login)
Step 2: Enter Your API Credentials
- API Key: Enter your exchange API key
- Secret Key: Enter your exchange secret key
- Passphrase: Enter your passphrase (required for BloFin, optional for others)
- If left empty, a default passphrase will be used
- For BloFin, you must enter your actual passphrase
Security Note: Your credentials are encrypted client-side in your browser. They are never sent to our servers in plain text.
Step 3: Choose Security Level
Select your preferred security level:
- Standard (1K iterations): Faster encryption, good security
- Recommended for: Frequent use, lower security requirements
- Encryption time: ~0.1 seconds
- High (100K iterations): Slower encryption, maximum security
- Recommended for: High-value accounts, maximum security
- Encryption time: ~1-2 seconds
Step 4: Encrypt Your Credentials
- Click "Encrypt API Credentials": The encryption happens in your browser
- Wait for Encryption: This may take 1-2 seconds for high security
- View Results: Your encrypted credentials will appear in the output panel
Step 5: Copy Encrypted Credentials
- Encrypted API Key: Click the copy button next to the encrypted API key
- Encrypted Secret Key: Click the copy button next to the encrypted secret key
- Save Securely: Store these encrypted values securely
Note: The encrypted credentials are long strings. Make sure to copy the entire string without any truncation.
Step 6: Use Encrypted Credentials in Generator
- Open Generator: Go to the JSON Generator
- Enable Encryption: In Advanced Options, set "Encryption" to "ON"
- Paste Encrypted Values:
- Paste your encrypted API key in the API Key field
- Paste your encrypted secret key in the Secret Key field
- If you used a custom passphrase, you'll need to provide it (or use default)
- Generate JSON: Click "Generate JSON & Webhook"
- Use in TradingView: The generated JSON will work with encrypted credentials
How Encryption Works
The encryption process:
- Key Derivation: Your passphrase (or default) is used with PBKDF2 to derive an encryption key
- Encryption: Your API credentials are encrypted using AES-256-CBC
- Encoding: The encrypted data is base64 encoded for easy transmission
- Decryption: When used, Trigger.Trade decrypts the credentials server-side
Encryption Example
Your plain text credentials:
API Key: abc123xyz789
Secret Key: secret123456
After encryption (example):
Encrypted API Key: U2FsdGVkX1+vupppZksvRf5pq5g5XkFy...
Encrypted Secret Key: U2FsdGVkX1+3xJKLmNOPQRSTUVWX...
Best Practices
- Use High Security: For production trading, use the "High" security level
- Store Securely: Keep your encrypted credentials in a secure password manager
- Don't Share: Even encrypted credentials should not be shared publicly
- Regular Updates: Re-encrypt credentials if you suspect they've been compromised
- Backup: Keep a secure backup of your encrypted credentials
Troubleshooting
Encryption Fails
- Check that all fields are filled correctly
- Ensure your browser supports modern JavaScript
- Try refreshing the page and trying again
Decryption Fails When Trading
- Verify you're using the exact encrypted strings (no extra spaces)
- Ensure encryption is enabled in the generator
- Check that you're using the same passphrase (if custom)
- Verify the encrypted credentials weren't truncated when copying
Passphrase Issues
- For BloFin: You must use your actual exchange passphrase
- For other exchanges: You can use default or custom passphrase
- Remember: You need the same passphrase to decrypt
Security Tip: Combine encryption with other security measures like IP whitelisting on your exchange API keys for maximum protection.
API Reference
Endpoint
POST /blofin/public/trade.php
Basic Trade Request
{
"mode": "trade",
"api_key": "YOUR_API_KEY",
"secret_key": "YOUR_SECRET_KEY",
"coin_pair": "BTCUSDT",
"position": "0",
"qty": "0.001",
"entry_order_type": "0",
"leverage": "10",
"margin_mode": "isolated"
}
Position Values
0 - Open Long
1 - Open Short
3 - Close Long
4 - Close Short
5 - Reduce Long
6 - Reduce Short
Order Types
0 - Market Order
1 - Limit Order
Response Format
{
"success": true,
"status": "success",
"order_id": "123456789",
"message": "Order placed successfully",
"data": {
"symbol": "BTCUSDT",
"side": "buy",
"quantity": "0.001",
"price": "50000",
"execution_time_ms": 85.5
}
}
Key Features
Multi-Take Profit
Set up to 3 take-profit levels with custom sizes:
{
"mode": "trade",
"coin_pair": "BTCUSDT",
"position": "0",
"qty": "0.001",
"tp_1_price": "52000",
"tp_1_size": "50",
"tp_2_price": "53000",
"tp_2_size": "30",
"tp_3_price": "54000",
"tp_3_size": "20"
}
Pyramiding Prevention
Prevent conflicting positions:
{
"mode": "trade",
"coin_pair": "BTCUSDT",
"position": "0",
"pyramiding": "0"
}
pyramiding: "0" - Enabled (blocks conflicts)
pyramiding: "1" - Disabled (allows duplicates)
API Encryption
Encrypt your API credentials:
{
"mode": "encrypt_credentials",
"api_key": "YOUR_API_KEY",
"secret_key": "YOUR_SECRET_KEY",
"passphrase": "YOUR_PASSPHRASE",
"security_level": 1
}
Telegram Notifications
Enable Telegram notifications:
{
"mode": "trade",
"telegram_bot": "1",
"channelName": "@your_channel"
}
Supported Exchanges
Bybit
Status: Fully Supported
Endpoint: /bybit/public/trade.php
Features: Unified Trading Account, 300+ error codes, broker support
BloFin
Status: Fully Supported
Endpoint: /blofin/public/trade.php
Features: TPSL orders, multi-TP system, full feature parity
Toobit
Status: Supported
Endpoint: /toobit/public/trade.php
Features: Core trading, account management
Evedex
Status: Supported
Endpoint: /evedex/public/trade.php
Features: Core trading, account management
Code Examples
PHP Example
<?php
require_once 'vendor/autoload.php';
require_once 'blofin/src/BlofinClient.php';
$client = new BlofinConnector\BlofinClient(
'YOUR_API_KEY',
'YOUR_SECRET_KEY',
'0', // testnet: 0=mainnet, 1=testnet
'' // passphrase (if required)
);
$result = $client->execute([
'mode' => 'trade',
'coin_pair' => 'BTCUSDT',
'position' => '0',
'qty' => '0.001',
'leverage' => '10',
'take_profit_price' => '52000',
'stop_loss_price' => '48000'
]);
print_r($result);
?>
cURL Example
curl -X POST https://your-domain.com/blofin/public/trade.php \
-H "Content-Type: application/json" \
-d '{
"mode": "trade",
"api_key": "YOUR_API_KEY",
"secret_key": "YOUR_SECRET_KEY",
"coin_pair": "BTCUSDT",
"position": "0",
"qty": "0.001"
}'
JavaScript Example
fetch('https://your-domain.com/blofin/public/trade.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
mode: 'trade',
api_key: 'YOUR_API_KEY',
secret_key: 'YOUR_SECRET_KEY',
coin_pair: 'BTCUSDT',
position: '0',
qty: '0.001'
})
})
.then(response => response.json())
.then(data => console.log(data));
TradingView Webhook Example
In TradingView alert, set:
- Webhook URL:
https://yourdomain.com/blofin/public/trade.php
- Message: (JSON payload from generator)
{
"mode": "trade",
"api_key": "YOUR_API_KEY",
"secret_key": "YOUR_SECRET_KEY",
"coin_pair": "{{ticker}}",
"position": "0",
"qty": "100",
"entry_order_type": "1",
"leverage": "10"
}
Error Codes Reference
When trading with Trigger.Trade, you may encounter error codes from the exchanges. We've compiled a comprehensive reference guide to help you understand and resolve these errors.
Complete Error Reference: For a detailed, searchable list of all error codes from all supported exchanges, visit our
Error Codes Reference Page.
Common Error Categories
System Errors
These errors relate to API authentication, rate limits, and server issues:
- 10003 (Bybit) / 152401 (BloFin): Invalid API key or IP not whitelisted
- 10004 (Bybit) / 152409 (BloFin): Signature verification failed
- 10006 (Bybit) / 429 (BloFin): Rate limit exceeded
- 152408 (BloFin): Passphrase error (BloFin requires passphrase)
Order Errors
These errors occur when placing or managing orders:
- 110004 (Bybit) / 150004 (BloFin): Insufficient balance
- 110001 (Bybit) / 102014 (BloFin): Order size too large
- 110007 (Bybit): Order size too small
- 110014 (Bybit) / 102022 (BloFin): No position to close
- 110094 (Bybit): Order value must be at least $5 USDT
Parameter Errors
These errors indicate issues with request parameters:
- 10001 (Bybit): Price required for limit orders
- 152001 (BloFin): Parameter cannot be empty
- 152002 (BloFin): Parameter error
- 152014 (BloFin): Invalid trading pair
Configuration Errors
These errors relate to account settings and trading configuration:
- 110016 (Bybit) / 102089 (BloFin): Position mode mismatch
- 110010 (Bybit): Invalid leverage value
- 110017 (Bybit): Leverage too high
- 110015 (Bybit): Invalid margin mode
Quick Troubleshooting Tips
- Check API Credentials: Verify your API key, secret key, and passphrase (for BloFin) are correct
- Verify Permissions: Ensure your API key has trading permissions enabled
- Check IP Whitelist: If using IP restrictions, ensure your server IP is whitelisted
- Verify Balance: Ensure you have sufficient balance for the order
- Check Order Size: Verify order size meets minimum requirements (usually $5 USDT minimum)
- Verify Trading Pair: Ensure the symbol format is correct (e.g., BTCUSDT for Bybit, BTC-USDT for BloFin)
- Check Position Mode: Ensure position mode matches your account settings
Need More Help? Visit our
complete Error Codes Reference for searchable, detailed explanations of all error codes from Bybit, BloFin, Toobit, and Evedex.
Troubleshooting
Common Issues
Database Connection Error
Solution: Check file permissions and ensure SQLite extension is enabled.
chmod 777 database/
php -m | grep sqlite
API Authentication Failed
Solution: Verify your API key, secret key, and permissions on the exchange.
- Double-check API key and secret key are correct
- Verify API keys have trading permissions enabled
- Check if IP restrictions are blocking your server
- For BloFin, ensure passphrase is correct
Order Execution Failed
Solution: Check error message in response. Common issues:
- Insufficient balance
- Invalid symbol
- Order size too small
- Market closed
- Leverage too high
- Position mode mismatch
Telegram Notifications Not Working
Solution:
- Make sure you've added and started @DaviddTechAPIbot
- Verify your Chat ID is correct (get it from @userinfobot)
- Check that
channelName field contains your Chat ID
- Ensure
telegram_bot is set to "0", "1", or "2"
Webhook Not Receiving Requests
Solution:
- Verify webhook URL is accessible (test in browser)
- Check server logs for incoming requests
- Ensure HTTPS is enabled (TradingView requires HTTPS)
- Verify TradingView alert is actually triggering
- Check firewall settings
JSON Generator Not Accessible
Solution: The generator requires login. Make sure you:
- Have an active subscription
- Are logged in with Whop
- Have an active Whop subscription