Download OpenAPI specification: [Risk_Calculator_API.yaml]
This document describes Autochartist's Risk Calculator API which provides users with an indication of the position size to be taken given a base currency, pair to trade, a stop loss, and a cash value to risk.
Our APIs require the following url parameters on every call:
brokerid – your customer ID on our systems (provided to you)
user – a unique ID of the end-user consuming the information. For server-2-Server integrations this would typically be your company name
accounttype – 0 = LIVE, 1 = DEMO
expiry – Unix timestamp of when this token will expire________token – a token generated by MD5(user|[accounttype]|[expiry][secretkey])
in which secretkey is the secret key provided to you, not to be shared with the end-user
Note the ‘|’ (Pipe) character before and after the AccountType parameter
$expiryDate = time() + (3 * 24 * 60 * 60);
$userid = “myuserid”;
$accountType = “0”;
$secretKey = “secretkey”;
$token = md5(“${userid}|${accountType}|${expiryDate}${secretKey }”);
echo $token;
?>
import hashlib
import time
expiry_date = int(time.time()) + (3 * 24 * 60 * 60)
userid = "myuserid"
account_type = "0"
secret_key = "secretkey"
token = hashlib.md5(f"{userid}|{account_type}|{expiry_date}{secret_key}".encode("utf-8")).hexdigest()
print(token)
Determines position size by specifying the amount that you are prepared to risk, opening and stop loss price, account currency, currency pair and contract type(Standard, Mini or Micro).
{
"account_currency" : [account currency, eg. "USD"],
"trade_pair" : [trading pair, eg "EURUSD"],
"contract_type" : [account type, "Standard"/"Micro"/"mini",
"account_risk" : [risk amount], eg 1000.00,
"entry_level" : [entry level, eg 1.18347],
"stop_loss" : [exit level, eg. 1.18705]
}
A valid request with an authorized MD5 token will be accepted
| account_type | string Example: account_type={{account_type}} LIVE / DEMO |
| broker_id | string Example: broker_id={{broker_id}} the broekr_id as provided by Autochartist |
| token | string Example: token={{token}} |
| expire | string Example: expire={{expire}} Expiry of this link as a unix timestamp |
| user | string Example: user={{user}} username |
{- "account_currency": "{{account_currency}}",
- "trade_pair": "{{trade_pair}}",
- "contract_type": "{{contract_type}}",
- "account_risk": "{{account_risk}}",
- "entry_level": "{{entry_level}}",
- "stop_loss": "{{stop_loss}}"
}{- "lot_size": 2.79,
- "risk_in_pips": 35
}