curl --request POST \
--url https://alphainsider.com/api/newOrderWebhook \
--header 'Content-Type: application/json' \
--data '
{
"strategy_id": "<string>",
"stock_id": "<string>",
"action": "{{strategy.market_position}}",
"api_token": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
strategy_id: '<string>',
stock_id: '<string>',
action: '{{strategy.market_position}}',
api_token: '<string>'
})
};
fetch('https://alphainsider.com/api/newOrderWebhook', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://alphainsider.com/api/newOrderWebhook"
payload = {
"strategy_id": "<string>",
"stock_id": "<string>",
"action": "{{strategy.market_position}}",
"api_token": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://alphainsider.com/api/newOrderWebhook",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'strategy_id' => '<string>',
'stock_id' => '<string>',
'action' => '{{strategy.market_position}}',
'api_token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://alphainsider.com/api/newOrderWebhook"
payload := strings.NewReader("{\n \"strategy_id\": \"<string>\",\n \"stock_id\": \"<string>\",\n \"action\": \"{{strategy.market_position}}\",\n \"api_token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"success": true,
"response": {
"order_id": "qoppbNXH4lG0-4x21YLCp",
"strategy_id": "7Wy5AzIKY9bCmkIqjcLSg",
"type": "market",
"action": "sell",
"stop_price": null,
"price": null,
"amount": "0.000200000000000",
"total": null,
"created_at": "2024-10-22T21:47:19.540Z",
"stock_id": "v3lhjrwEhNuAOxPT29oxO",
"figi_composite": null,
"symbol": "ETH-USD",
"name": "Ethereum",
"sector": "Cryptocurrencies",
"security": "cryptocurrency",
"exchange": "COINBASE",
"stock": "ETH-USD",
"peg": "USD",
"provider": "coinbase",
"slippage": "0.000000000000000",
"fee": "0.002500000000000",
"links": {
"trading_view": "https://www.tradingview.com/symbols/ETHUSD/?exchange=COINBASE",
"yahoo_finance": "https://finance.yahoo.com/quote/ETH-USD",
"coin_marketcap": "https://coinmarketcap.com/currencies/ethereum/",
"google_finance": "https://www.google.com/finance/quote/ETH-USD"
},
"stock_status": "active",
"bid": "2633.43",
"ask": "2633.43",
"last": "2633.43",
"order_dependencies": []
}
}{
"success": false,
"response": "Request failed."
}{
"success": false,
"response": "Authentication failed."
}newOrderWebhook
Create an order from a webhook signal. Tutorial setup.
Existing open strategy orders are cancelled before submission. By default, each alert moves fully into or out of the position at leverage. Set pyramiding to enter over several same-direction alerts.
curl --request POST \
--url https://alphainsider.com/api/newOrderWebhook \
--header 'Content-Type: application/json' \
--data '
{
"strategy_id": "<string>",
"stock_id": "<string>",
"action": "{{strategy.market_position}}",
"api_token": "<string>"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
strategy_id: '<string>',
stock_id: '<string>',
action: '{{strategy.market_position}}',
api_token: '<string>'
})
};
fetch('https://alphainsider.com/api/newOrderWebhook', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://alphainsider.com/api/newOrderWebhook"
payload = {
"strategy_id": "<string>",
"stock_id": "<string>",
"action": "{{strategy.market_position}}",
"api_token": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://alphainsider.com/api/newOrderWebhook",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'strategy_id' => '<string>',
'stock_id' => '<string>',
'action' => '{{strategy.market_position}}',
'api_token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://alphainsider.com/api/newOrderWebhook"
payload := strings.NewReader("{\n \"strategy_id\": \"<string>\",\n \"stock_id\": \"<string>\",\n \"action\": \"{{strategy.market_position}}\",\n \"api_token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"success": true,
"response": {
"order_id": "qoppbNXH4lG0-4x21YLCp",
"strategy_id": "7Wy5AzIKY9bCmkIqjcLSg",
"type": "market",
"action": "sell",
"stop_price": null,
"price": null,
"amount": "0.000200000000000",
"total": null,
"created_at": "2024-10-22T21:47:19.540Z",
"stock_id": "v3lhjrwEhNuAOxPT29oxO",
"figi_composite": null,
"symbol": "ETH-USD",
"name": "Ethereum",
"sector": "Cryptocurrencies",
"security": "cryptocurrency",
"exchange": "COINBASE",
"stock": "ETH-USD",
"peg": "USD",
"provider": "coinbase",
"slippage": "0.000000000000000",
"fee": "0.002500000000000",
"links": {
"trading_view": "https://www.tradingview.com/symbols/ETHUSD/?exchange=COINBASE",
"yahoo_finance": "https://finance.yahoo.com/quote/ETH-USD",
"coin_marketcap": "https://coinmarketcap.com/currencies/ethereum/",
"google_finance": "https://www.google.com/finance/quote/ETH-USD"
},
"stock_status": "active",
"bid": "2633.43",
"ask": "2633.43",
"last": "2633.43",
"order_dependencies": []
}
}{
"success": false,
"response": "Request failed."
}{
"success": false,
"response": "Authentication failed."
}Body
AlphaInsider strategy identifier.
AlphaInsider stock identifier, or SYMBOL:EXCHANGE in requests.
Order actions. Action "buy" is the same as "long", "sell" is the same as "short", "close" is the same as "flat".
For TradingView webhooks, use {{strategy.market_position}} to supply the strategy action.
See TradingView strategy alert guide for full list of automated actions.
buy, long, sell, short, close, flat User API token with newOrder permission.
Leverage to trade at. Defaults to 1 if not set.
0 <= x <= 2Must be a multiple of 0.01Number of entry steps used to reach the chosen leverage. The target exposure added by one step is leverage / pyramiding, measured as a multiple of the strategy's portfolio value.
For example, leverage: 2 and pyramiding: 4 give a step size of 2 / 4 = 0.5, or 50% of the portfolio value. Starting from no position, with each prior step filled, successive same-direction alerts target 0.5x, 1x, 1.5x, and 2x exposure (50%, 100%, 150%, and 200%). These are target levels; fees, sizing reserves, and market changes affect the resulting position.
AlphaInsider determines the current step from the filled holdings when each alert arrives, so an accepted but unfilled alert does not advance the position. At full leverage, further same-direction alerts rebalance toward the full target. An opposite-direction alert reverses to the first step on the new side: in the example, a long position becomes a 0.5x short target. "close"/"flat" or leverage: 0 closes the strategy's positions. Without pyramiding, each alert goes directly to the full leverage target or closes the position. Send leverage and pyramiding; AlphaInsider calculates the order sizes.
1 <= x <= 100Slippage fraction used in sizing reserves for allocation-generated market orders. Defaults to 0.002. It does not set a limit price.
0 <= x <= 0.05Must be a multiple of 0.001