Trade Copier API Documentation
Access the power of our state-of-the-art technology via our intuitive RESTful API.
Tailor the Trade Copier to suit your specific requirements and seamlessly integrate our cutting-edge technology into your website.
- Build and host your personalized Trade Copier Dashboard, establishing a direct connection to our Trade Copier server from your application or website
- Effortlessly manage trading accounts and copy settings, gaining real-time access to orders, open positions, and closed trades
- Gain access to advanced settings as global account protection, risk management symbol mappings, advanced filters, and templates
- Get comprehensive and detailed performance reporting for your customers
- Specially designed to cater to White Label platforms and Signal Providers, ensuring a perfect fit for your business model
Access our comprehensive Trade Copier API documentation by creating a username and registering on our website here - no payment required. The Trade Copier API can be used for free if you have minimum 10 paid accounts otherwise it requires the Trade Copier API add-on.
For any inquiries, feel free to reach out to our support team through Live Chat or via email at support@duplikium.com.
Connection
Get access to the Trade Copier API
Connect your application to the Trade Copier API with the following details that you can find in the Trade Copier API Settings under your user profile drop down menu at the top of your cockpit.
- Auth-Token: an Auth-Token is required to connect to the Trade Copier API
- Auth-Username: the Auth-Username is your cockpit username
- Trade Copier API URL address: https://www.trade-copier.com/webservice/v4/
- In your request, you must include your Auth-Username AND Auth-Token in the request Headers.
- Only connection through SSL is supported.
Accounts
Get, add, update, delete trading accounts in the Trade Copier cockpit.
Add a Master or a Slave account in your Trade Copier cockpit
URL: https://www.trade-copier.com/webservice/v4/account/addAccount.php
Response: JSON object with the newly added account
Fields noted with a * are optional
Field Name | Field Type | Field Description |
---|---|---|
type | string | 0=Master or 1=Slave |
name | string | Custom account name |
broker | string | mt4, mt5, ctrader, fxcm_fc or lmax (always in lower case) |
login | string | Your broker account login |
password | string | Your broker account password |
server | string | MT4: IG-DEMO, FxPro.com-Real02, Ava-Real 1, etc. MT5: ActivTrades-Server, Binary.com-Server, FxPro-MT5, etc. cTrader: leave blank LMax Demo: https://web-order.london-demo.lmax.com LMax Live: https://api.lmaxtrader.com FXCM_FC: http://www.fxcorporate.com/Hosts.jsp |
environment | string | Real or Demo |
status | int | The account is 0=disabled, 1=enabled |
group* | string | One of your existing template's ID. |
subscription | string | The subscription key of the subscription to assign to your account or "auto", which this automatically selects an available subscription for this account |
pending* | int | Copy pending order is 0=disabled, 1=enabled |
stop_loss* | int | Copy StopLoss is 0=disabled, 1=enabled |
take_profit* | int | Copy TakeProfit is 0=disabled, 1=enabled |
comment* | string | Custom comment that appears in MT4, MT5 and cTrader terminal trade comment |
alert_email* | int | Send warning email is 0=disabled, 1=enabled |
alert_sms* | int | Send warning sms is 0=disabled, 1=enabled |
access_token* | string | Access token for ctrader |
refresh_token* | string | Refresh token for ctrader |
expiry_token* | string | Expiry token for ctrader |
account* | string | Account name for ctrader |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/account/addAccount.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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);
//We define the template, you can get the existing templates with the "getTemplates.php" webservice
$template = 'DEF';//Template's ID
//$template = null;//No Template
//We define the subscription for the account, you can get available subscriptions with the "getSubscriptions.php" webservice
$subscription = 'auto';//Automaticaly select an available subscription
//$subscription = 'ABCD1234' ;//Subscription's key
//$subscription = null;//No subscription
// Adding data to POST
$account = [
'type' => 1,//0=Master, 1=Slave
'name' => 'name',//Custom name for your account
'broker' => 'mt4',//mt4, mt5, ctrader, lmax, fxcm_fc
'login' => 'login12',
'password' => 'password',
'server' => 'fxpro.com',
'environment' => 'Demo', //Demo, Real
'status' => '0',//The account is 0=disabled, 1=enabled
'group' => $template,//Always an EMPTY string for Master
'subscription' => $subscription,//Always an EMPTY string for Master.
'pending' => '0',//0=disabled, 1=enabled
'stop_loss' => '0',//0=disabled, 1=enabled
'take_profit' => '0',//0=disabled, 1=enabled
'comment' => '',//Custom comment that appears in MT4 terminal trade comment. Only for MT4.
'alert_email' => '0',//0=disabled, 1=enabled
'alert_sms' => '0'//0=disabled, 1=enabled
];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($account));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
if(array_key_exists('account', $json))
{
//We access the added account data
echo "New account added: ".$json->account->account_id." ".$json->account->name.
" ".$json->account->login." ".$json->account->server;
}
else
{
//This is an error message that can be access like this:
//echo $json->code." ".$json->error;
echo json_encode($json);
}
?>
Delete a Master or Slave account from your Trade Copier cockpit
URL: https://www.trade-copier.com/webservice/v4/account/deleteAccount.php
Response: JSON object with account Id
Field Name | Field Type | Field Description |
---|---|---|
account_id | string | Unique identifier of the account |
PHP example
<?php
$url="https://".$_SERVER['SERVER_NAME']."/webservice/v4/account/deleteAccount.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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);
// Account ID to be removed
$account = [
'account_id' => 'ABC'
];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($account));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
if(array_key_exists('account', $json))
{
//We access the deleted account data
echo "Account ".$json->account->account_id." has been deleted!";
}
else
{
//This is an error message that can be access like this:
//echo $json->code." ".$json->error;
echo json_encode($json);
}
?>
Get a full list of your existing accounts in your Trade Copier cockpit
URL: https://www.trade-copier.com/webservice/v4/account/getAccounts.php
The request may specify an optional filter object containing a single account_id that you want to select, or an array of IDs. If the filter is empty or absent, it will select all your accounts.
Response: JSON object list
Field Name | Field Type | Field Description |
---|---|---|
account_id | string | Unique identifier of the account |
type | int | 0=Master or 1=Slave |
name | string | Custom account name |
broker | string | mt4, mt5, ctrader, fxcm_fc or lmax (always in lower case) |
login | string | Your broker account login |
account | string | Account name |
password | string | The account's password |
server | string | MT4: IG-DEMO, FxPro.com-Real02, Ava-Real 1, etc. MT5: ActivTrades-Server, Binary.com-Server, FxPro-MT5, etc. cTrader: leave blank LMax Demo: https://web-order.london-demo.lmax.com LMax Live: https://api.lmaxtrader.com FXCM_FC: http://www.fxcorporate.com/Hosts.jsp |
environment | string | Real or Demo |
status | int | The account is 0=disabled, 1=enabled |
state | string | Last state of the account: CONNECTED DISCONNECTED SYMBOL_NOT_FOUND ORDER_FAILED ORDER_FAILED_MARGIN INVESTOR_PASSWORD SELLOUT_SL SELLOUT_TP CLOSE_ONLY_SL CLOSE_ONLY_TP FROZEN_SL FROZEN_TP EMPTY_EWALLET NONE |
groupid | string | One of your existing templates's Id. Empty if none are assigned |
subscription_key | string | Unique key of the subscription assigned to the account. Empty if none are assigned |
subscription_name | string | Name of the subscription assigned to the account. Empty if none are assigned |
expiration | string | Expiration date of the subscription assigned to the account. Empty if none are assigned |
pending | int | Copy pending order is 0=disabled, 1=enabled |
stop_loss | int | Copy StopLoss is 0=disabled, 1=enabled |
take_profit | int | Copy TakeProfit is 0=disabled, 1=enabled |
comment | string | Custom comment that appears in MT4, MT5 and cTrader terminal trade comment |
alert_email | int | Send warning email for account disconnection is 0=disabled, 1=enabled |
alert_sms | int | Send warning sms for account disconnection is 0=disabled, 1=enabled |
alert_email_failed | int | Send warning email for failed copied orders is 0=disabled, 1=enabled |
alert_sms_failed | int | Send warning sms for failed copied orders is 0=disabled, 1=enabled |
globalstoploss | int | Global account StopLoss is 0=disabled, 1=enabled |
globalstoplosstype | int | Global account StopLoss is 0=Close Only, 1=Sell Out, 2=Frozen |
globalstoplossvalue | float | Global account StopLoss |
globatakeprofit | int | Global account TakeProfit is 0=disabled, 1=enabled |
globaltakeprofitvalue | float | Global account TakeProfit |
globaltakeprofittype | int | Global account TakeProfit is 0=Close Only, 1=Sell Out, 2=Frozen |
balance | string | Updated after each trade and every 5 minutes. Balance should be used carefully since it is not updated regularly |
equity | string | Updated after each trade and every 5 minutes. Equity should be used carefully since it is not updated regularly |
free_margin | string | Updated after each trade and every 5 minutes. FreeMargin should be used carefully since it is not updated regularly |
credit | string | Updated after each trade and every 5 minutes. Credit should be used carefully since it is not updated regularly |
ccy | string | Account currency |
mode | int | Accounting type: 0: Hedging, 1:Netting |
open_trades | int | Number of open trades on the account |
lastUpdate | string | Date and time of last update on the account |
access_token | string | Access token for ctrader |
refresh_token | string | Refresh token for ctrader |
expiry_token | string | Expiry token for ctrader |
account | string | Account name for ctrader |
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/account/getAccounts.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['account_id' => 'ABC'];
//$filter = ['account_id' => ['ABC', 'DEF']];
//$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 existing account(s) list
if(array_key_exists('accounts', $json))
{
echo '<table id="api_data">';
foreach($json->accounts as $row) {
foreach($row as $key => $val) {
echo '<th>'.$key.'</th>';
}
break;
}
foreach($json->accounts as $account)
{
echo '<tr>';
foreach($account 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);
}
?>
Update a Master or Slave account of your Trade Copier cockpit
URL: https://www.trade-copier.com/webservice/v4/account/updateAccount.php
Response: JSON object with account fields
Fields noted with a * are optional
Field Name | Field Type | Field Description |
---|---|---|
account_id | string | Account ID of the account that you want to update |
type* | int | 0=Master or 1=Slave |
name* | string | Custom account name |
broker* | string | mt4, mt5, ctrader, fxcm_fc or lmax (always in lower case) |
login* | string | Your broker account login |
password* | string | Your broker account password |
server* | string | MT4: IG-DEMO, FxPro.com-Real02, Ava-Real 1, etc. MT5: ActivTrades-Server, Binary.com-Server, FxPro-MT5, etc. cTrader: leave blank LMax Demo: https://web-order.london-demo.lmax.com LMax Live: https://api.lmaxtrader.com FXCM_FC: http://www.fxcorporate.com/Hosts.jsp |
environment* | string | Real or Demo |
status* | int | The account is 0=disabled, 1=enabled |
group* | string | One of your existing template's ID or it can be null to remove it |
subscription_key* | string | The subscription key of the subscription to assign to your account or "auto", which this automatically selects an available subscription for this account |
pending* | int | Copy pending order is 0=disabled, 1=enabled |
stop_loss* | int | Copy StopLoss is 0=disabled, 1=enabled |
take_profit* | int | Copy TakeProfit is 0=disabled, 1=enabled |
comment* | string | Custom comment that appears in MT4, MT5 and cTrader terminal trade comment |
alert_email* | int | Send warning email for account disconnection is 0=disabled, 1=enabled |
alert_sms* | int | Send warning sms for account disconnection is 0=disabled, 1=enabled |
alert_email_failed* | int | Send warning email for failed copied orders is 0=disabled, 1=enabled |
alert_sms_failed* | int | Send warning sms for failed copied orders is 0=disabled, 1=enabled |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/account/updateAccount.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username:[[USERNAME]]',
'Auth-Token: [[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);
//If needed, we update the Risk Factor's template, you can get the existing template with the "getTemplates.php" webservice
$template= 'DEF';//Template name
//$template= null;//No template
//If needed, we update the subscription for the account, you can get available subscriptions with the "getSubscriptions.php" webservice
$subscription = 'auto';//Automaticaly select an available subscription
//$subscription = 'ABCD1234';
//$subscription = null;
// Account data to be updated
$account = [
'account_id' => 'ABC',//Mandatory
'name' => 'nameZZ',
'broker' => 'mt4',//mt4, mt5, ctrader, lmax, fxcm_fc
'login' => 'login111',
'password' => 'password',
'group' => $template,
'subscription' => $subscription,
'alert_sms' => '0'
];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($account));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
//We access the updated account data
if(array_key_exists('account', $json))
{
//We access the added account data
echo "Account ".$json->account->account_id." updated: ".$json->account->name." ".$json->account->login." ".$json->account->server;
}
else
{
//This is an error message that can be access like this:
//echo $json->code." ".$json->error;
echo json_encode($json);
}
?>
Subscriptions
Get your active subscriptions
Get all your subscriptions.
URL: https://www.trade-copier.com/webservice/v4/subscription/getSubscriptions.php
The request can specify an optional filter with an array of numbers to only get certain types of subscriptions.
Response: JSON object list
Field Name | Field Type | Field Description |
---|---|---|
subscription_key | string | Unique identifier of the subscription |
name | string | Name of the susbcription |
price | float | Price of the subscription |
currency | string | Currency in which the subscription was paid for |
cancel_date | string | Date and time of cancellation of subscription if applicable |
expiration_date | string | Date and time of expiration of the subscription |
status | int | Status of order |
invoice_status | int | Last invoice's status |
paid_date | string | Date and time of payment for the subscription |
type | int | Type of subscription. 0: Free Master, 1: Free Slave, 2: Prepay, 3: Add-On, 4: Subscription 5: Prepay Daily |
total_accounts | int | Total Number of accounts you can add with this subscription |
available_accounts | int | Number of available accounts you can currently add with this subscription |
app_name | string | Payment method |
term | int | Billing cycle in days |
invoices | array | All invoices of the deposit |
invoice_key | string | Unique identifier of the invoice |
total | string | Amount paid |
currency | string | Currency in which the invoice was made |
invoice_status | string | Status of the invoice order. 401=pending, 402=paid, 403=refunded |
paid_date | string | Date on which the invoice was made |
coupon_code | string | Coupon code of the invoice |
amount | string | Discount from coupon, can be a percentage or absolute value |
percentage | string | Indicates whether amount is a percentage or not. 1=percentage, empty means absolute value |
app_name | string | Payment method |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/subscription/v4/getSubscriptions.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['types' => [1, 3]];
//$filter = ['types' => [1]];
//$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 subscription(s) list
if(array_key_exists('subscriptions', $json))
{
echo '<table id="api_data">';
foreach($json->subscriptions as $row) {
foreach($row as $key => $val) {
if($key != 'invoices')
echo '<th>'.$key.'</th>';
}
break;
}
foreach($json->subscriptions as $subscription)
{
echo '<tr>';
foreach($subscription as $key => $val)
{
if($key != 'invoices')
echo '<td>'.$val.'</td>';
}
echo '</tr>';
echo '<tr>';
foreach($subscription->invoices as $invoice)
{
echo '<th>Invoices</th>';
foreach($invoice as $key => $val)
{
echo '<th>'.$key.'</th>';
}
echo '<tr>';
echo '</tr>';
echo '<td></td>';
foreach($invoice as $key => $val)
{
echo '<td>'.$val.'</td>';
}
}
echo '</tr>';
echo '<tr><td></td></tr>';
}
echo '</table>';
}
else
{
//This is an error message that can be access like this:
//echo $json>code." ".$json>error;
echo json_encode($json);
}
?>
Copy and Symbols Settings
Manage accounts and specific symbols copy settings.
Get the copy settings defined for your trade copier accounts.
URL: https://www.trade-copier.com/webservice/v4/settings/getSettings.php
The request may specify an optional filter to only retrieve settings for a certain master and/or slave or group
Response: JSON object list
Field Name | Field Type | Field Description |
---|---|---|
date | string | Datetime of the last time the setting was updated |
id_master | string | Unique identifier of the master account |
id_slave | string | Unique identifier of the slave account. Empty if it has a template ID |
id_group | string | Unique identifier of the template. Empty if it has a slave ID |
master_name | string | Name of the master account |
slave_name | string | Name of the slave account |
group_name | string | Name of the template |
risk_factor_value | float | Value of the risk factor |
risk_factor_type | int | RiskFactor type or not defined: 0: Auto Risk (Equity) 1: Auto Risk (Balance) 2: Auto Risk (Free Margin) 3: Multiplier (Notional) 4: Fixed Lot 5: Fixed Leverage (Equity) 6: Fixed Leverage (Balance) 7: Fixed Leverage (Free Margin) 10: Fixed Units 11. Multiplier(Lot) |
risk_factor_type_string | string | Meaning of the risk factor type |
order_side | int | -1 = sell only, 1 = buy only |
max_order_size | float | Maximum order size |
min_order_size | float | Minimum order size |
copier_status | int | Status of the setting on the trade copier. See row underneath for codes |
copier_status_string | string | Meaning of the copier status. -1 = close only, 0 = frozen, 1 = on, 2 = open only |
symbol_master | string | Symbol on the master's broker |
symbol | string | Symbol on the slave's broker |
pending_order | int | Enable/disable copying on pending orders. 0 = off, 1 = on |
stop_loss | int | 0 = off, 1 = on, 2 = on with updates |
stop_loss_fixed_value | float | |
stop_loss_fixed_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
stop_loss_min_value | float | |
stop_loss_min_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
stop_loss_max_value | float | |
stop_loss_max_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
take_profit | int | 0 = off, 1 = on, 2 = on with updates |
take_profit_fixed_value | float | |
take_profit_fixed_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
take_profit_min_value | float | |
take_profit_min_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
take_profit_max_value | float | |
take_profit_max_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
trailing_stop_value | float | |
trailing_stop_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
max_risk_value | float | |
max_risk_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
comment | string | |
max_slippage | float | Max slippage in pips |
max delay | float | Max delay in seconds |
force_min_round_up | int | |
round_down | int | |
split_order | int | |
price_improvement | float | Price improvement in pips |
max_position_size_a | float | |
max_position_size_s | float | |
max_position_size_a_m | float | |
max_position_size_s_m | float | |
max_open_count_a | int | |
max_open_count_s | int | |
max_open_count_a_m | int | |
max_open_count_s_m | int | |
max_daily_order_count_a | int | |
max_daily_order_count_s | int | |
max_daily_order_count_a_m | int | |
max_daily_order_count_s_m | int | |
global_stop_loss | int | 0 = off, 1 = on |
global_stop_loss_value | float | |
global_stop_loss_type | int | 0 = close only, 1 = sell out, 2 = freeze |
global_take_profit | int | 0 = off, 1 = on |
global_take_profit_value | float | |
global_take_profit_type | int | 0 = close only, 1 = sell out, 2 = freeze |
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/settings/getSettings.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['id_slave' => "ABC", 'id_master' => "DEF"];
//$filter = ['id_slave' => "ABC"];
//$filter = ['id_group' => "GHI"];
//$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 settings list
if(array_key_exists('settings', $json)) {
echo '<table id="api_data">';
foreach($json->settings as $row) {
foreach($row as $key => $val) {
echo '<th>'.$key.'</th>';
}
break;
}
foreach($json->settings as $setting) {
echo '<tr>';
foreach($setting 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);
}
?>
Get a full list of your Copy Settings for a master, slave or template
URL: https://www.trade-copier.com/webservice/v4/settings/setSettings.php
Response: JSON response description
All fields are optional except id_slave or id_group
Field Name | Field Type | Field Description |
---|---|---|
id_master | string | Unique identifier of the master account. Will be a default setting for all masters if empty |
id_slave | string | Unique identifier of the slave account. Must be empty if template ID is set |
id_group | string | Unique identifier of the template. Must be empty if slave ID is set |
risk_factor_value | float | Value of the risk factor |
risk_factor_type | int | Risk Factor type or not defined: 0: Auto Risk (Equity) 1: Auto Risk (Balance) 2: Auto Risk (Free Margin) 3: Multiplier (Notional) 4: Fixed Lot 5: Fixed Leverage (Equity) 6: Fixed Leverage (Balance) 7: Fixed Leverage (Free Margin) 10: Fixed Units 11. Multiplier(Lot) |
order_side | int | -1 = sell only, 1 = buy only |
max_order_size | float | Maximum order size |
min_order_size | float | Minimum order size |
copier_status | int | Status of the setting on the trade copier. -1 = close only, 0 = frozen, 1 = on, 2 = open only |
symbol_master | string | Symbol on the master's broker. Must be set if symbol field is set |
symbol | string | Symbol on the slave's broker. Must be set if symbol_master field is set |
pending_order | int | Enable/disable copying on pending orders. 0 = off, 1 = on |
stop_loss | int | 0 = off, 1 = on, 2 = on with updates |
stop_loss_fixed_value | float | |
stop_loss_fixed_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
stop_loss_min_value | float | |
stop_loss_min_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
stop_loss_max_value | float | |
stop_loss_max_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
take_profit | int | 0 = off, 1 = on, 2 = on with updates |
take_profit_fixed_value | float | |
take_profit_fixed_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
take_profit_min_value | float | |
take_profit_min_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
take_profit_max_value | float | |
take_profit_max_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
trailing_stop_value | float | |
trailing_stop_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
max_risk_value | float | |
max_risk_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
comment | string | |
max_slippage | float | Max slippage in pips |
max delay | float | Max delay in seconds |
force_min_round_up | int | |
round_down | int | |
split_order | int | |
price_improvement | float | Price improvement in pips |
max_position_size_a | float | |
max_position_size_s | float | |
max_position_size_a_m | float | |
max_position_size_s_m | float | |
max_open_count_a | int | |
max_open_count_s | int | |
max_open_count_a_m | int | |
max_open_count_s_m | int | |
max_daily_order_count_a | int | |
max_daily_order_count_s | int | |
max_daily_order_count_a_m | int | |
max_daily_order_count_s_m | int | |
global_stop_loss | int | 0 = off, 1 = on |
global_stop_loss_value | float | |
global_stop_loss_type | int | 0 = close only, 1 = sell out, 2 = freeze |
global_take_profit | int | 0 = off, 1 = on |
global_take_profit_value | float | |
global_take_profit_type | int | 0 = close only, 1 = sell out, 2 = freeze |
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/settings/setSettings.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: username',
'Auth-Token: key',
);
// 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);
// Slave/Group Settings list to be added, updated or removed
$settings = [
['slave_id' => '29524', 'master_id' => '33934', 'risk_factor_value' => '0.11', 'risk_factor_type' => '3', 'max_order_size' => '1.23', 'copier_status' => '0'],
['slave_id' => '29524', 'risk_factor_value' => '0.99', 'risk_factor_type' => '4', 'max_order_size' => '0.12', 'copier_status' => '1'],
['group_id' => '4735', 'risk_factor_value' => '1.02', 'risk_factor_type' => '5', 'max_order_size' => '0.12'],
];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($settings));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
//If updated is successful, we use the getRiskFactors webservice to check the new value
if(array_key_exists('success', $json))
{
echo $json->code."-".$json->success;
}
else
{
//This is an error message that can be access like this:
//echo $json->code." ".$json->error;
echo json_encode($json);
}
?>
Symbols Mapping
Define which Master symbol corresponds to which Slave symbol in case of complex symbol like XAUUSD to GOLD. By default, our Trade Copier is able to automatically define the suffix by itself. For instance EURUSD to EURUSDm or USDCHF to USDCHFpro
Simplified version of setSettings: add one or several settings with only the master/slave symbols and Ids defined. This will only add a mapping if it does not exist already.
URL: https://www.trade-copier.com/webservice/v4/mapping/addMappings.php
Even if adding only one mapping, it must be inside an array
Response: JSON response description, with either how many mappings have been added, or an error message
Fields noted with a * are optional
Field Name | Field Type | Field Description |
---|---|---|
id_master | string | Unique identifier of the master account linked to the mapping |
id_slave* | string | Unique identifier of the slave account linked to the mapping, or null if defining a template |
id_group* | string | Unique identifier of the template linked to the mapping, or null if defining a slave |
symbol | string | Slave symbol of setting you want to add |
symbol_master | string | Master symbol of setting you want to add |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/mapping/addMappings.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username:[[USERNAME]]',
'Auth-Token: [[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);
$mappings = [
['id_slave' => "DEF", 'id_master' => "ABC", 'symbol' => 'APITEST', 'symbol_master' => 'TESTAPI'],
['id_group' => "GHI", 'id_master' => "ABC", 'symbol' => 'TESTAPI', 'symbol_master' => 'APITEST']
];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($settings));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
if(array_key_exists('success', $json))
{
echo 'Added '.$json->added_count.' mappings';
}
else
{
//This is an error message that can be access like this:
//echo $json>code." ".$json>error;
echo json_encode($json);
}
?>
Deletes all of a setting's symbol mappings
URL: https://www.trade-copier.com/webservice/v4/mapping/deleteAllMappings.php
You must specify a slave or group Id, but not both.
Response: JSON object with success or error message
Fields noted with a * are optional
Field Name | Field Type | Field Description |
---|---|---|
id_master | string | Unique identifier of the master account linked to the mapping |
id_slave* | string | Unique identifier of the slave account linked to the mapping, or null if defining a template |
id_group* | string | Unique identifier of the template linked to the mapping, or null if defining a slave |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/mapping/deleteAllMappings.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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);
$args= ['id_slave' => "DEF", 'id_master' => "ABC"];
//$args= ['id_group' => "GHI", 'id_master' => "ABC"];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($args));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
if(array_key_exists('success', $json))
{
echo 'Deleted all mappings successfully';
}
else
{
//This is an error message that can be access like this:
//echo $json>code." ".$json>error;
echo json_encode($json);
}
?>
Delete a setting's symbol mapping
URL: https://www.trade-copier.com/webservice/v4/mapping/deleteMapping.php
You must specify a slave or group Id, but not both.
Response: JSON object with success or error message
Fields noted with a * are optional
Field Name | Field Type | Field Description |
---|---|---|
id_master | string | Unique identifier of the master account linked to the mapping |
id_slave* | string | Unique identifier of the slave account linked to the mapping, or null if defining a template |
id_group* | string | Unique identifier of the template linked to the mapping, or null if defining a slave |
symbol | string | Slave symbol of setting you want to delete |
symbol_master | string | Master symbol of setting you want to delete |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/mapping/deleteMapping.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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);
$mapping= ['id_slave' => "DEF", 'id_master' => "ABC", 'symbol' => 'NEW', 'symbol_master' => 'NEWMASTER'];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($mapping));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
if(array_key_exists('success', $json))
{
echo 'Mapping deleted successfully';
}
else
{
//This is an error message that can be access like this:
//echo $json>code." ".$json>error;
echo json_encode($json);
}
?>
Simplified version of setSettings: edits a mapping's symbols.
URL: https://www.trade-copier.com/webservice/v4/mapping/editMapping.php
You must specify a slave or group Id, but not both.
Response: JSON response description, with either how many mappings have been updated (0 or 1), or an error message
Fields noted with a * are optional
Field Name | Field Type | Field Description |
---|---|---|
id_master | string | Unique identifier of the master account linked to the mapping |
id_slave* | string | Unique identifier of the slave account linked to the mapping, or null if defining a template |
id_group* | string | Unique identifier of the template linked to the mapping, or null if defining a slave |
old_symbol | string | Old slave symbol of the mapping |
old_symbol_master | string | Old master symbol of the mapping |
symbol | string | New slave symbol you want to define it to |
symbol_master | string | New master symbol you want to define it to |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/mapping/editMapping.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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);
$args= ['id_slave' => "DEF", 'id_master' => "ABC", 'symbol' => 'NEW', 'symbol_master' => 'NEWMASTER', 'old_symbol' => 'APITEST', 'old_symbol_master' => 'TESTAPI'];
//$args= ['id_group' => "GHI", 'id_master' => "ABC", 'symbol' => 'NEW', 'symbol_master' => 'NEWMASTER', 'old_symbol' => 'APITEST', 'old_symbol_master' => 'TESTAPI'];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($args));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
if(array_key_exists('success', $json))
{
echo 'Updated '.$json->updated_count.' mappings';
}
else
{
//This is an error message that can be access like this:
//echo $json>code." ".$json>error;
echo json_encode($json);
}
?>
Global Account Protection
Protect your equity using our Account Protection feature.
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 | Unique identifier of the slave account |
stop_loss | int | Enable or disable stop loss. 1 = enable, 0 = disable |
stop_loss_type | int | Type of stop loss. 0 = close only, 1 = sell out, 2 = frozen |
stop_loss_value | float | Stop loss value |
take_profit | int | Enable or disable take profit. 1 = enable, 0 = disable |
take_profit_type | int | Type of take profit. 0 = close only, 1 = sell out, 2 = frozen |
take_profit_value | float | Take profit value |
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',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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);
}
?>
Define global protection for a slave account
URL: https://www.trade-copier.com/webservice/v4/protection/setGlobalProtection.php
Response: JSON object with success or error message
Fields noted with a * are optional
Field Name | Field Type | Field Description |
---|---|---|
slave_id | string | Unique identifier of the slave account |
stop_loss* | int | Enable or disable stop loss. 1 = enable, 0 = disable |
stop_loss_type* | int | Type of stop loss. 0 = close only, 1 = sell out, 2 = frozen |
stop_loss_value* | float | Stop loss value |
take_profit* | int | Enable or disable take profit. 1 = enable, 0 = disable |
take_profit_type* | int | Type of take profit. 0 = close only, 1 = sell out, 2 = frozen |
take_profit_value* | float | Take profit value |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/protection/setGlobalProtection.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 (except slave id)
$filter = ['slave_id' => 'ABC', 'stop_loss' => 1, 'stop_loss_type' => 0, 'take_profit' => 1, 'take_profit_value' => 10.05];
//$filter = ['slave_id' => 'ABC', 'stop_loss_type' => 2, 'take_profit' => 0];
//$filter = ['slave_id' => 'ABC', 'stop_loss' => 1, 'stop_loss_type' => 0, 'stop_loss_value' => 20 'take_profit' => 1, 'take_profit_type' => 0, 'take_profit_value' => 10.05];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($filter));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
//Success message or error
if(array_key_exists('success', $json)) {
echo $json->code."-".$json->success;
} else {
//This is an error message that can be access like this:
//echo $json->code." ".$json->error;
echo json_encode($json);
}
?>
Symbols Filters
Filter symbols to copy using a Blacklist or Whitelist.
Deletes a symbol filter for an account.
URL: https://www.trade-copier.com/webservice/v4/filter/deleteFiltersSymbol.php
Response: JSON object with success or error message
Field Name | Field Type | Field Description |
---|---|---|
user_id | string | Unique identifier of the account |
symbol | string | Symbol to delete |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/filter/deleteFiltersSymbol.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['user_id' => 'ABC', 'symbol' => 'APITEST'];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($filter));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
if(array_key_exists('success', $json))
{
echo 'Symbol deleted succesfully';
}
else
{
//This is an error message that can be access like this:
//echo $json->code." ".$json->error;
echo json_encode($json);
}
?>
Add a symbol filter for an account.
URL: https://www.trade-copier.com/webservice/v4/filter/addFiltersSymbol.php
Response: JSON object with success or error message
Field Name | Field Type | Field Description |
---|---|---|
user_id | string | Unique identifier of the account |
symbol | string | Symbol to add |
status | string | The status of the symbol, will be the same value for all of them. 1=On, 0=Off |
type | string | If the symbol is whitelisted or blacklisted, will be the same value for all of them. 0= Whitelist, 1=Blacklist |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/filter/addFiltersSymbol.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['user_id' => 'ABC', 'symbol' => 'EURUSD', 'type'=> 1; 'status'=> 1];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($filter));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
if(array_key_exists('success', $json))
{
echo 'Symbol added succesfully';
}
else
{
//This is an error message that can be access like this:
//echo $json->code." ".$json->error;
echo json_encode($json);
}
?>
Edit the type (whitelist/blacklist) of and/or if to use the filter for all symbol filters for an account.
URL: https://www.trade-copier.com/webservice/v4/filter/editFiltersSymbol.php
You must specify either a type or a status, but both are not necessary.
Response: JSON object with success or error message
Fields noted with a * are optional
Field Name | Field Type | Field Description |
---|---|---|
user_id | string | Unique identifier of the account |
type* | int | Set type of all symbols on account. 0 = whitelist, 1 = blacklist |
status* | int | Enable or disable all symbols on account |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/filter/editFiltersSymbol.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['user_id' => 'ABC', 'status' => '0', 'type' => '1'];
//$filter = ['user_id' => 'ABC', 'type' => '1'];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($filter));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
if(array_key_exists('success', $json))
{
echo 'Symbol edited succesfully';
}
else
{
//This is an error message that can be access like this:
//echo $json->code." ".$json->error;
echo json_encode($json);
}
?>
Get symbol filters for an account. Will return an empty array if no filters have been added to the account.
URL: https://www.trade-copier.com/webservice/v4/filter/getFiltersSymbols.php
Response: JSON object list
Field Name | Field Type | Field Description |
---|---|---|
user_id | string | Unique identifier of the account |
symbol | string | The symbol being filtered |
status | string | The status of the symbol, will be the same value for all of them. 1=On, 0=Off |
type | string | If the symbol is whitelisted or blacklisted, will be the same value for all of them. 0= Whitelist, 1=Blacklist |
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/filter/getFiltersSymbols.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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);
//Account id
$filter = ['user_id' => 'ABC'];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($filter));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
if(array_key_exists('filtersSymbol', $json))
{
echo '<table id="api_data">';
foreach($json->filtersSymbols as $row) {
foreach($row as $key => $val) {
echo '<th>'.$key.'</th>';
}
break;
}
foreach($json->filtersSymbol as $filter)
{
echo '<tr>';
foreach($filter 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);
}
?>
Templates
Define Templates to manage common settings for a group of slaves.
Add a new template.
URL: https://www.trade-copier.com/webservice/v4/template/addTemplate.php
Response: JSON object with the new template's ID.
Field Name | Field Type | Field Description |
---|---|---|
name | string | Name of the template |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/template/addTemplate.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['name' => 'My first template'];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($filter));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
//We check if the update was successful
if(array_key_exists('template', $json))
{
echo 'Added new Template, ID : ' . $json->template;
}
else
{
//This is an error message that can be access like this:
//echo $json->code." ".$json->error;
echo json_encode($json);
}
?>
Delete one of your templates.
URL: https://www.trade-copier.com/webservice/v4/template/deleteTemplate.php
Response: JSON object with success or error message
Field Name | Field Type | Field Description |
---|---|---|
group_id | string | Unique identifier of the template |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/template/deleteTemplate.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['group_id' => 'GHI'];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($filter));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
//We check if the deletion was successful
if(array_key_exists('success', $json))
{
echo 'Template has been deleted successfully';
}
else
{
//This is an error message that can be access like this:
//echo $json->code." ".$json->error;
echo json_encode($json);
}
?>
Edit a template.
URL: https://www.trade-copier.com/webservice/v4/template/editTemplate.php
Response: JSON object with success or error message
Field Name | Field Type | Field Description |
---|---|---|
group_id | string | Unique identifier of the template |
name | string | New name of the template |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/template/editTemplate.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['group_id' => 'GHI', 'name' => 'Template #1'];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($filter));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
//We check if the update was successful
if(array_key_exists('success', $json))
{
echo 'Template has been updated successfully';
}
else
{
//This is an error message that can be access like this:
//echo $json->code." ".$json->error;
echo json_encode($json);
}
?>
Get a full list of all your templates.
URL: https://www.trade-copier.com/webservice/v4/template/getTemplates.php
Response: JSON object list
Field Name | Field Type | Field Description |
---|---|---|
group_id | string | Unique identifier of the account |
name | string | Name of the template |
PHP example
<?php echo "<link rel='stylesheet' type='text/css' href='https://www.trade-copier.com/webservice/example.css'>"; $url="https://".$_SERVER['SERVER_NAME']."/webservice/v4/template/getTemplates.php"; $headers = array( 'Content-Type: application/x-www-form-urlencoded', 'Auth-Username: [[USERNAME]]', 'Auth-Token: [[TOKEN]]', ); // Open connection $ch = curl_init(); // Setting the options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, false); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Execute request $json = json_decode(curl_exec($ch)); // Close connection curl_close($ch); //We access the existing group(s) list if(is_array($json) && array_key_exists('groups', $json)) { echo '<table id="api_data">'; foreach($json->groups as $row) { foreach($row as $key => $val) { echo '<th>'.$key.'</th>'; } break; } foreach($json->groups as $group) { echo '<tr>'; foreach($group 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); } ?>
Orders
Get the list of orders copied from the Trade Copier.
Get a description of an error from your slave order
URL: https://www.trade-copier.com/webservice/v4/order/getOrderStatusComment.php
You must specify an error id.
Response: JSON object
Field Name | Field Type | Field Description |
---|---|---|
comment | string | Description of the error |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/v4/order/getOrderStatusComment.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['error_id' => 15];
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 comment
if(array_key_exists('comment', $json)) {
echo $json->comment;
} else {
//This is an error message that can be access like this:
//echo $json->code." ".$json->error;
echo json_encode($json);
}
?>
Get up to 1000 slave orders
URL: https://www.trade-copier.com/webservice/v4/order/getSlaveOrders.php
The request may specify an optional filter object containing parameters to retrieve successful, failed and/or skipped orders, a master order id, or a start position to search from. You can also limit the number of rows in the result.
Response: JSON object list
Field Name | Field Type | Field Description |
---|---|---|
data | array | |
created_date | string | Date/Time |
slave_name | string | Name of the "Slave" account |
master_name | string | Name of the "Master" account |
master_ticket | string | Ticket given by broker |
side | string | Combination of side and action. Side can be Buy, Sell, BuyLimit, SellLimit, BuyStop and SellStop; action can be N/A, PendingOpen, PendingModify, PendingCancel, PendingFill, PendingFillToClose, PositionOpen, PositionModify, PositionClosePartial, PositionClose, ProtectionModify, ProtectionFill |
quantity | float | Quantity requested for the order |
quantity_executed | float | Quantity when the order was executed |
quantity_usd | float | Executed quantity converted into USD |
symbol | string | Instrument name |
price | float | Price of the order |
status | string | Status of the order, works as an error message field |
error | string | Indicates if order has an error or a skipped order. 0=success, 1=error, 2=skipped |
latency | string | Request latency and order latency respectively |
order_id_slave | string | Unique identifier of this slave order |
stopLoss | string | StopLoss value of the initial order |
takeProfit | string | TakeProfit value of the initial order |
error_id | int | Identifier of the order status, is still present if not explicitly an error |
fees | float | Fees to pass the order |
recordsTotal | int | Total number of slave orders you have |
recordsFIltered | int | Number of results corresponding to your filter. Will have the same value as recordsTotal if no filter is given |
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/order/getSlaveOrders.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['start' => 10, 'length' => 50];
//$filter = ['successOrders' => true, 'failOrders' => false, 'skipOrders' => true];
//$filter = ['order_id_master' => 12345];
//$filter = ['start' => 10, 'length' => 50, 'order_id_master' => 12345, 'successOrders' => true];
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('data', $json)) {
echo '<table id="api_data">';
foreach($json->data as $row) {
foreach($row as $key => $val) {
echo '<th>'.$key.'</th>';
}
break;
}
foreach($json->data as $order) {
echo '<tr>';
foreach($order 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);
}
?>
Get up to 1000 master orders at a time
URL: https://www.trade-copier.com/webservice/v4/order/getMasterOrders.php
The request may specify an optional filter object containing parameters to retrieve successful, failed and/or skipped orders, or a start position to search from. You can also limit the number of rows in the result.
Response: JSON object list
Field Name | Field Type | Field Description |
---|---|---|
data | array | |
timestamp | string | Date/Time |
name | string | Name of the "Master" account |
side | string | Combination of side and action. Side can be Buy, Sell, BuyLimit, SellLimit, BuyStop and SellStop; action can be N/A, PendingOpen, PendingModify, PendingCancel, PendingFill, PendingFillToClose, PositionOpen, PositionModify, PositionClosePartial, PositionClose, ProtectionModify, ProtectionFill |
symbol | string | Instrument name |
master_ticket | string | Ticket given by broker |
quantity | float | Quantity requested for the order |
quantity_usd | float | Quantity requested for the order in USD |
cnt_success | int | Number of successful slave orders from this master order |
cnt_fail | int | Number of failed slave orders from this master order |
cnt_skip | int | Number of skipped slave orders from this master order |
slave_count | int | Total number of slave orders linked to this master order |
order_id_master | string | Unique identifier of this master order |
stopLoss | float | StopLoss value of the initial order |
takeProfit | float | TakeProfit value of the initial order |
price | float | Price of the order |
recordsTotal | int | Total number of master orders you have |
recordsFIltered | int | Number of results corresponding to your filter. Will have the same value as recordsTotal if no filter is given |
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/order/getMasterOrders.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['start' => 0, 'length' => 10];
//$filter = ['successOrders' => true, 'failOrders' => false, 'skipOrders' => true];
//$filter = ['start' => 10, 'length' => 300, 'successOrders' => true];
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('data', $json)) {
echo '<table id="api_data">';
foreach($json->data as $row) {
foreach($row as $key => $val) {
echo '<th>'.$key.'</th>';
}
break;
}
foreach($json->data as $order) {
echo '<tr>';
foreach($order 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);
}
?>
Positions
Gather open and closed positions of your masters and slaves.
Get up to 1000 closed positions
URL: https://www.trade-copier.com/webservice/v4/position/getClosedPositions.php
The request may specify an optional filter object containing parameters to only retrieve positions between 2 dates, an account id or type, to include orders from inactive accounts, or a start position to search from. You can also limit the number of rows in the result.
Response: JSON object list
Field Name | Field Type | Field Description |
---|---|---|
account_id | string | Unique identifier of the "Slave" account |
master_id | string | Unique identifier of the "Master" account |
ticket | string | Trade identifier (is not globally unique, but it is unique per account_id) |
ticketMaster | string | Master trade identifier. If equal to the ticket, it is a manual trade |
openTime | string | Trade open time |
side | string | Can be Buy, Sell, BuyLimit, SellLimit, BuyStop and SellStop |
symbol | string | Instrument name |
openPrice | float | |
stopPrice | float | |
limitPrice | float | |
stopLoss | float | |
takeProfit | float | |
closeTime | string | Trade close time |
closePrice | float | |
amountLot | float | Amount expressed in lot, can vary from one broker/technology to another |
quantityCcy | float | Quantity expressed in the account currency |
profitCcy | float | Profit expressed in the account currency |
swap | float | Swap expressed in the account currency |
commissionBrokerCcy | float | The broker's commission expressed in the account currency |
notional_USD | float | Amount equivalent in USD |
ccy | string | Account currency |
comment | string | Comment for the position |
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/position/getClosedPositions.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['start' => 10, 'length' => 50];
//$filter = ['show_off' => true]; //include inactive accounts positions
//$filter = ['account_type' => '1']; //0 = master, 1 = slave
//$filter = ['from' => "2022-04-01 00:00:00.000", 'to' => "2022-04-30 22:59:59.999", 'account_type' => '1'];
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('data', $json)) {
echo '<table id="api_data">';
foreach($json->data as $row) {
foreach($row as $key => $val) {
echo '<th>'.$key.'</th>';
}
break;
}
foreach($json->data as $position) {
echo '<tr>';
foreach($position 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);
}
?>
Get up to 1000 open positions
URL: https://www.trade-copier.com/webservice/v4/position/getOpenPositions.php
The request may specify an optional filter object containing parameters to only retrieve positions between 2 dates, an account id or type, to include orders from inactive accounts, or a start position to search from. You can also limit the number of rows in the result.
Response: JSON object list
Field Name | Field Type | Field Description |
---|---|---|
account_id | string | Unique identifier of the "Slave" account |
master_id | string | Unique identifier of the "Master" account |
master_name | string | Name of the "Master" account |
ticket | string | Trade identifier (is not globally unique, but it is unique per account_id) |
masterTicket | string | Master trade identifier. If equal to the ticket, it is a manual trade |
openTime | string | Trade open time |
side | string | Can be Buy, Sell, BuyLimit, SellLimit, BuyStop and SellStop |
symbol | string | Instrument name |
openPrice | float | |
stopPrice | float | |
limitPrice | float | |
stopLoss | float | |
takeProfit | float | |
amountLot | float | Amount expressed in lot, can vary from one broker/technology to another |
quantityCcy | float | Quantity expressed in the account currency |
swapCcy | float | Swap expressed in the account currency |
commissionBrokerCcy | float | The broker's commission expressed in the account currency |
notional_USD | float | Amount equivalent in USD |
ccy | string | Account currency |
comment | string | Comment for the position |
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/position/getOpenPositions.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['start' => 10, 'length' => 50];
//$filter = ['show_off' => true]; //include inactive accounts positions
//$filter = ['account_type' => '1']; //0 = master, 1 = slave
//$filter = ['from' => "2022-04-01 00:00:00.00", 'to' => "2022-04-30 22:59:59.999", 'account_type' => '1'];
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('data', $json)) {
echo '<table id="api_data">';
foreach($json->data as $row) {
foreach($row as $key => $val) {
echo '<th>'.$key.'</th>';
}
break;
}
foreach($json->data as $position) {
echo '<tr>';
foreach($position 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);
}
?>
Reporting
Get detailled reporting on the performance of the trading accounts.
Retreive up to 1000 rows of data for your accounts' statistics for one month.
URL: https://www.trade-copier.com/webservice/v4/reporting/getReporting.php
The request may specify an optional filter object containing parameters for a start position to search from or to limit the number of rows in the result. It may also specify which month and/or year to retreive the data from; the default is the current month and year. You can retreive all months with month=0 and/or all years with year=0. You can also filter the results by account_id (single account_id or an array of account_id).
Response: JSON object list
Field Name | Field Type | Field Description |
---|---|---|
month | int | Month of the reporting |
year | int | Year of the reporting |
name | string | Name of the account |
broker | string | Broker of the account |
login | string | Login of the account |
server | string | Server of the account |
currency | string | Currency of the follower |
hwm | float | High Water Mark of the follower's reporting |
balance_start | float | Balance at the start of the month |
deposit_withdrawal | float | How much has been withdrawn |
balance_end | float | Balance at the end of the month or today if current month |
pnl | float | Profit And Loss this month |
performance | float | Percentage of performance in profit |
accountStatus | int | Account is 0=disabled, 1=enabled |
accountType | int | Account is 0=master, 1=slave |
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/reporting/getReporting.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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 = ['start' => 10, 'length' => 50];
//$filter = ['month' => 12, 'year' => 2023, 'start' => 25];
//$filter = ['start' => 30, 'length' => 50, 'month' => 1, 'year' => 2024];
//$filter = ['start' => 0, 'length' => 20, 'account_id' => 'ddfdfgwges'];
//$filter = ['start' => 0, 'length' => 20, 'account_id' => ['ddfdfgwges', 'jtzjeggfh']];
//$filter = ['start' => 0, 'length' => 20, 'year' => 2024, 'month' => 1, 'account_id' => ['ddfdfgwges', 'jtzjeggfh']];
$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('reporting', $json)) {
echo '<table id="api_data">';
foreach($json->reporting as $row) {
foreach($row as $key => $val) {
echo '<th>'.$key.'</th>';
}
break;
}
foreach($json->reporting as $stat) {
echo '<tr>';
foreach($stat 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);
}
?>
eWallet Deposit
See history of deposit on the eWallet used for Prepay plan
Get deposits made onto the prepay e-wallet. Works similarly to subscriptions
URL: https://www.trade-copier.com/webservice/v4/deposit/getEwalletDeposits.php
Response: JSON object list
Field Name | Field Type | Field Description |
---|---|---|
order_status | string | Status of the deposit. 301=None, 303=active, 305=expired, 306=cancelled |
total | string | Amount deposited |
currency | string | Currency in which the deposit was made |
modified_date | string | Last modified date of the deposit |
cancel_date | string | Date at which the deposit was cancelled. Sends back date 0 if not cancelled |
subscription_key | string | Unique identifier of the deposit |
invoices | array | All invoices of the deposit |
total | string | Amount paid |
currency | string | Currency in which the invoice was made |
invoice_status | string | Status of the invoice order. 401=pending, 402=paid, 403=refunded |
paid_date | string | Date on which the invoice was made |
coupon_code | string | Coupon code of the invoice |
amount | string | Discount from coupon, can be a percentage or absolute value |
percentage | string | Indicates whether amount is a percentage or not. 1=percentage, empty means absolute value |
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/deposit/getEWalletDeposits.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[TOKEN]]',
);
// Open connection
$ch = curl_init();
// Setting the options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
if(is_array($json) && array_key_exists('deposits', $json))
{
echo '<table id="api_data">';
foreach($json->subscriptions as $row) {
foreach($row as $key => $val) {
if($key != 'invoices')
echo '<th>'.$key.'</th>';
}
break;
}
foreach($json->subscriptions as $subscription)
{
echo '<tr>';
foreach($subscription as $key => $val)
{
if($key != 'invoices')
echo '<td>'.$val.'</td>';
}
echo '</tr>';
echo '<tr>';
foreach($subscription->invoices as $invoice)
{
echo '<th>Invoices</th>';
foreach($invoice as $key => $val)
{
echo '<th>'.$key.'</th>';
}
echo '<tr>';
echo '</tr>';
echo '<td></td>';
foreach($invoice as $key => $val)
{
echo '<td>'.$val.'</td>';
}
}
echo '</tr>';
echo '<tr><td></td></tr>';
}
echo '</table>';
}
else
{
//This is an error message that can be access like this:
//echo $json>code." ".$json>error;
echo json_encode($json);
}
?>
eWallet Fees
Check all fees taken on the eWallet used for Prepay plan and SMS
Get your fees of using the eWallet.
URL: https://www.trade-copier.com/webservice/v4/fee/getFees.php
You can send an optional parameter to group fees by message type.
Response: JSON object list
Field Name | Field Type | Field Description |
---|---|---|
amount | string | The amount the fee deducted from the eWallet |
date_fees | string | Date of the fee |
message | string | Type of fee. Possible messages include "DAILY_FEES", "DAILY_ORDER" or "DAILY_UPDATE" |
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/fee/getFees.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[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);
$grouping = ['type_group' => '1']; //group by type
//$grouping = ['type_group' => '0']; //DON'T group by type
//$filter = []; //DON'T group by type
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($grouping));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
if(array_key_exists('data', $json))
{
echo '<table id="api_data">';
foreach($json->data as $row) {
foreach($row as $key => $val) {
echo '<th>'.$key.'</th>';
}
break;
}
foreach($json->dataas $fee)
{
echo '<tr>';
foreach($fee 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);
}
?>
Notifications
Messages center where the activity is tracked and Duplikium share information about the Trade Copier.
Get your most recent notifications about changes to your accounts etc, done via the API or directly through the website.
URL: https://www.trade-copier.com/webservice/v4/notification/getNotifications.php
Response: JSON object list
Field Name | Field Type | Field Description |
---|---|---|
timestamp | string | When the notification dates from |
type | int | The type of notifications. 0=error, 1=success, 2=warning, 3=info |
name | string | Source of the notification |
text | string | Message to display |
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/notification/getNotifications.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Auth-Username: [[USERNAME]]',
'Auth-Token: [[TOKEN]]',
);
// Open connection
$ch = curl_init();
// Setting the options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
if(is_array($json) && array_key_exists('notifications', $json))
{
echo '<table id="api_data">';
foreach($json->notifications as $row) {
foreach($row as $key => $val) {
echo '<th>'.$key.'</th>';
}
break;
}
foreach($json->notifications as $notification)
{
echo '<tr>';
foreach($notification 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);
}
?>
Got questions? We're one message away.