Custom Code
Send signals to EZPZ Trader from your own scripts, bots or servers with a single HTTP request.
The request
Any program that can make an HTTP POST with a JSON body can send signals. Use the Content-Type: application/json header and your strategy's webhook URL.
cURL
curl -X POST "https://ezpztrader.com/trading/webhook/{uuid}/{secret}/" \
-H "Content-Type: application/json" \
-d '{"ticker": "AAPL", "action": "buy", "quantity": 1}'
Python
import requests
WEBHOOK_URL = "https://ezpztrader.com/trading/webhook/{uuid}/{secret}/"
response = requests.post(WEBHOOK_URL, json={
"ticker": "AAPL",
"action": "buy",
"quantity": 1,
}, timeout=10)
print(response.status_code, response.json())
JavaScript (Node.js 18+)
const response = await fetch("https://ezpztrader.com/trading/webhook/{uuid}/{secret}/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ ticker: "AAPL", action: "buy", quantity: 1 }),
});
console.log(response.status, await response.json());
Handling the response
200with"success": true: accepted. Check the signal's page for each account's result.400with amessageCode: refused, nothing traded. Fix the message. See Webhook Responses.429: too many requests. Slow down.503: not traded. Send it again.
Don't resend after a 200.
Tips
- Keep the webhook URL out of your code repository. Load it from an environment variable or secret store.
- Send
timewith the moment your signal was generated (ISO-8601, with timezone) so stale signals can be rejected. - Set the strategy's IP restriction to your server's IP addresses.
↑ ↓ to move · Enter to open · Esc to close