Get the defined global protections for your slave accounts.
URL: https://www.trade-copier.com/webservice/v4/protection/getGlobalProtection.php
The request may specify an optional filter object containing a slave_id that you want to select
Response: JSON object list
| Field Name | Field Type | Field Description |
|---|---|---|
| slave_id | string | Encrypted slave account ID |
| global_take_profit* | integer | Enable or disable global take profit mode (0-7) |
| global_take_profit_type* | integer | Global take profit calculation type (0=Close Only, 1= Close All and Disable Copy, 2= Disable Copy) |
| global_take_profit_value* | float | Global take profit threshold value |
| daily_take_profit* | integer | Enable or disable daily take profit mode (0-7) |
| daily_take_profit_type* | integer | Daily take profit calculation type (0=Close Only, 1= Close All and Disable Copy, 2= Disable Copy) |
| daily_take_profit_value* | float | Daily take profit threshold value |
| global_stop_loss | integer | Enable or disable global stop loss mode (0-7) |
| global_stop_loss_type* | integer | Global stop loss calculation type (0=Close Only, 1= Close All and Disable Copy, 2= Disable Copy) |
| global_stop_loss_value* | float | Global stop loss threshold value |
| daily_stop_loss* | integer | Enable or disable daily stop loss mode (0-7) |
| daily_stop_loss_type* | integer | Daily stop loss calculation type (0=Close Only, 1= Close All and Disable Copy, 2= Disable Copy) |
| daily_stop_loss_value* | float | Daily stop loss threshold value |
| Protection modes | Value | Description |
|---|---|---|
| daily_stop_loss | 0 | OFF |
| 2 | Daily Net Loss Amount | |
| 3 | Daily Net Loss % | |
| 4 | Daily Drawdown Amount | |
| 5 | Daily Drawdown % | |
| daily_take_profit | 0 | OFF |
| 2 | Daily Net Profit Amount | |
| 3 | Daily Net Profit % | |
| global_stop_loss | 0 | OFF |
| 1 | Absolute Equity Stop | |
| 2 | Net Loss Amount | |
| 3 | Net Loss % | |
| 4 | Drawdown Amount | |
| 5 | Drawdown % | |
| 6 | Unrealized Loss Amount | |
| 7 | Unrealized Loss % | |
| global_take_profit | 0 | OFF |
| 1 | Absolute Equity Target | |
| 2 | Net Profit Amount | |
| 3 | Net Profit % | |
| 6 | Unrealized Profit Amount | |
| 7 | Unrealized Profit % |
PHP example
<?php
echo "<link rel='stylesheet' type='text/css' href='https://www.trade-copier.com/webservice/example.css'>";
$url="https://www.trade-copier.com/webservice/v4/protection/getGlobalProtection.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Authorization: Bearer [[TOKEN]]',
);
// Open connection
$ch = curl_init();
// Setting the options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//Filter can specify a mix of fields, they are all optional
$filter = ['slave_id' => 'ABC'];
//$filter = []; //empty filter
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($filter));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
//We access the order(s) list
if(array_key_exists('globalProtections', $json)) {
echo '<table id="api_data">';
foreach($json->globalProtections as $row) {
foreach($row as $key => $val) {
echo '<th>'.$key.'</th>';
}
break;
}
foreach($json->globalProtections as $protection) {
echo '<tr>';
foreach($protection as $key => $val) {
echo '<td>'.$val.'</td>';
}
echo '</tr>';
}
echo '</table>';
} else {
//This is an error message that can be access like this:
//echo $json->code." ".$json->error;
echo json_encode($json);
}
?>