Sierra Chart Website APIs
- Introduction
- Create New Sierra Chart Accounts
- Get Status of Sierra Chart Accounts
- Search For Sierra Chart Account By Email
- Manage Custom Studies Users
- Set Price Levels
- Manage Reseller Billing
- Get Transactions
- API Result and Error Messages
- API and Messages for Sierra Chart Live and Simulated Trading Systems
Introduction
This page documents the available application program interfaces (API) for Sierra Chart website services available to outside developers.
All of the available website services are actively monitored for abuse and security issues. Therefore, use these services properly. Do not make too many requests to the Web server over a short period of time. This will be detected and additional requests will be blocked.
The different APIs available for website services are divided into what are called Services.
Common Specifications
Script
The API URL is https://www.sierrachart.com/API.php. The connection must be secure by using TLS v1.2.
The method by which the parameters need to be given to the website script is through a POST method.
Common Parameters
The following are the common parameters to be passed to the script using a POST method:
- AdminUsername: This must be set to your Sierra Chart Account Name that has been given access to create new user accounts through the Sierra Chart website control panel.
Since the administrator username and password is specified with each call, each call performs its own authentication. There is no separate authentication. - AdminPassword: This must be set to your Sierra Chart Account Password.
- Service: This must be set to API Service you want to use.
- Action: This must be set a supported API action provided by the Service you want to use.
Create New Sierra Chart Accounts
Introduction
Sierra Chart provides a website interface to support the programmatic creation of a new Sierra Chart account. This is available only to authorized users.
The documentation here describes the current method to create a new Sierra Chart account and replaces the https://www.sierrachart.com/register.php script. This older script does not support creating an account in an automated way.
Specifications
The website script for creating new Sierra Chart accounts is https://www.sierrachart.com/API.php. The connection must be secure by using TLS.
The method by which the parameters need to be given to the website script is through a POST method.
- AdminUsername: This must be set to your Sierra Chart Account Name that has been given access to create new user accounts through the Sierra Chart website control panel.
- AdminPassword: This must be set to your Sierra Chart Account Password.
- Service: This must be set to CreateSCAccount.
- Action: This must be set to CreateSCAccount to create a new account or CheckIfSCAccountIsAvailable to check if an account name is available.
- UserSCUsername: The Sierra Chart Account Name for the new account to be created. Required, at least six characters long.
- UserSCPassword: Used only when Action is set to CreateSCAccount. The Sierra Chart Account Password for the new account to be created. The minimum length is 6 characters. The following are the valid characters for a password: 0-9, a-z, A-Z, and special characters with the exception of a \.
- FirstName: The user's first name. Optional. Used only when Action is set to CreateSCAccount.
- LastName: The user's last name or a company name. Required, at least two characters long. Used only when Action is set to CreateSCAccount.
- Address: The user's address. Used only when Action is set to CreateSCAccount.
- City: The user's city. Optional. Used only when Action is set to CreateSCAccount.
- State: The user's state. Optional. Used only when Action is set to CreateSCAccount.
- PostCode: The user's postal/zip code. Optional. Used only when Action is set to CreateSCAccount.
- Country: The user's country. Using the ISO 3166-1 English Short Name. Used only when Action is set to CreateSCAccount.
- UserEmail: The user's email address. Used only when Action is set to CreateSCAccount.
- TelNumber: The user's telephone number. Optional. Used only when Action is set to CreateSCAccount.
Return Text: Refer to the API Result and Error Messages section.
Get Status of Sierra Chart Accounts
Introduction
Sierra Chart provides a website interface to query the status Sierra Chart accounts. This is available only to authorized users and is limited to accounts that they manage.
Specifications
The website script for getting the status of Sierra Chart accounts is https://www.sierrachart.com/API.php. The connection must be secure by using TLS.
The method by which the parameters need to be given to the website script is through a POST method.
- AdminUsername: This must be set to your Sierra Chart Account Name which has been authorized access to this API.
- AdminPassword: This must be set to your Sierra Chart Account Password.
- Service: This must be set to the text SCAccount.
- Action: This must be set to the text GetStatus.
- UserSCUsername: The Sierra Chart Account Name that you want to get the status for.
Return Text: A JSON array with the Usage End Date, Services Balance and Last Login Date for the account. For error strings, refer to the API Result and Error Messages section.
Search For Sierra Chart Account By Email
Introduction
Sierra Chart provides a website interface to search for Sierra Chart accounts using an email address as the search term.
This interface is available only to authorized users.
Specifications
The website script for searching of Sierra Chart accounts is https://www.sierrachart.com/API.php. The connection must be secure by using TLS.
The method by which the parameters need to be given to the website script is through a POST method.
For security purposes the API does not accept the AdminUsername or AdminPassword to be passed via a "GET" (or via the URL).
- AdminUsername: This must be set to your Sierra Chart Account Name which has been authorized access to this API.
- AdminPassword: This must be set to your Sierra Chart Account Password.
- Service: This must be set to the text SCAccount.
- Action: This must be set to the text SearchByEmail.
- UserEmail: The User Email to Search for.
Return Text: A JSON array of Sierra Chart accounts. Fields returned: 'UserID', 'UserName', 'FirstName', 'LastName', 'Email', 'AccountUsageEndDate', 'LastLoginDateTimeUTC'.
For error strings, refer to the API Result and Error Messages section.
Manage Custom Studies Users
Introduction
The Manage Custom Studies Users service, is a service which allows you to Add Sierra Chart accounts to be allowed to use Custom Studies in a Custom Studies DLL file or Remove Sierra Chart accounts from using the Custom Studies in a Custom Studies DLL file.
To use this service, your Sierra Chart Account Name must have already established management of a Custom Studies DLL file name for which you are adding/removing users through this service.
For instructions and additional information about controlling access to studies in a Custom Studies DLL file, refer to Redistributing and Allowing Use Only by a Defined List of Users documentation.
Specifications
The website script for Managing Custom Studies Users is https://www.sierrachart.com/API.php.
The method by which the parameters need to be given to the website script is through a POST method.
The following are the list of the parameters for this script for the purpose of Managing Custom Studies Users.
- AdminUsername: This must be set to your Sierra Chart Account Name that has been given access to manage custom studies users through the Sierra Chart website control panel.
- AdminPassword: This must be set to your Sierra Chart Password.
- Service: This must be set to CustomDLLStudiesManagement.
- SCDLLName: The SCDLLName of the custom studies DLL file.
- Action: Must be set to add, remove, update, IsUserAuthorized, or GetAllUsersForDLL.
- UserSCUsername: This must be set to the Sierra Chart Account Name of the user you want to add or remove. To determine a Sierra Chart Account Name of a user, have them provide you the name that is displayed after Registered To: under Help >> About on the menu in Sierra Chart.
- ServiceLevel: This is an optional parameter which can be set to any 64-bit integer, that is then accessible through an ACSIL study. Refer to sc.DLLNameUserServiceLevel.
- EndDate: This is an optional parameter specifying the ending date the user has access to the Custom Studies. The format is: YYYY/MM/DD. It can be left unset if not needed. When it is unset, there is no time limit to the custom studies access.
Return Text: Refer to the API Result and Error Messages section.
Set Price Levels
Introduction
The Set Price Levels service, allows you to set the price levels for the Price Levels study.
Specifications
The website endpoint for setting price levels is https://www.sierrachart.com/API.php?Service=SetPriceLevels&SCDLLName=[SCDLLNAME]&Symbol=[SYMBOL].
The following are the list of the parameters for this script for the purpose of Managing Custom Studies Users.
- SCDLLName [GET]: The SCDLLName of the custom studies DLL file.
- Symbol [GET]: The Symbol for which the Price Levels apply.
- Service [GET/POST]: This must be set to SetPriceLevels.
- AdminUsername: This must be set to your Sierra Chart Account Name that has been given access to manage custom studies users through the Sierra Chart website control panel.
- AdminPassword: This must be set to your Sierra Chart Password.
- Data: Enter the Price Levels separated by commas "," example: 2.5 , 7.89 , 99.99.
- StartDate: The set Price Levels will be returned for the date set, or if the optional EndDate is set then the dates ranging from the set StartDate to the optional EndDate.
- EndDate: Optional - If set, then the set Price Levels will be returned for the dates ranging from the set StartDate to the EndDate.
- ExpirationDate: Optional - If set, then the set Price Levels will not be returned after this date back to Sierra Chart.
- AutoClearOnExpiry: Optional - If set to true, then if the price level set expires it will be cleared.
Return Text: Refer to the API Result and Error Messages section.
Manage Reseller Billing
Introduction
The Manage Reseller Billing service, allows you to activate and deactivate a particular Sierra Chart user account to be active or inactive. If the account is active, it will be billed to your reseller account according to the terms previously agreed to.
You have the ability to choose what Sierra Chart package number you want the account to be set to. The packages you want to have access to need to be set on your reseller account by Sierra Chart management.
Specifications
The website script for managing Reseller Billing settings is https://www.sierrachart.com/API.php.
The method by which the parameters need to be given to the website script is through a POST or GET method.
The following are the list of the parameters:
- AdminUsername: This must be set to your Sierra Chart administrator Account Name that has been given access to this service.
- AdminPassword: This must be set to the Sierra Chart Password for your administrator account.
- UserSCUsername: This must be set to the Sierra Chart Account Name of the user you want to manage. This will be the Account Name that has been specified when creating the account.
- Service: This must be set to ResellerBilling.
- Action: This must be set to either:
- ACTIVATE: Activate account for billing.
- EXTEND: Extends an account by 31 days, this is only available if a Reseller is enabled for One Time Extensions.
- DEACTIVATE: Deactivate account from billing.
- REMOVE: Remove the account from your billing and disassociate it from your Admin Account. This will result in the account not being listed when you search for accounts on the control panel, and will also result in loosing access to the account.
- DENALI_ACTIVATE: Activate the Denali Data Feed for billing.
- DENALI_DEACTIVATE: Deactivate the Denali Data Feed from billing.
- ORDER_ROUTING_ACTIVATE: Activate Order Routing Billing for billing.
- ORDER_ROUTING_DEACTIVATE: Deactivate Order Routing Billing from billing.
- Package: If you are allowed for more than one Sierra Chart package, then you can specify a valid package for the user. Currently this can be 3 or 5. If you specify package number that your reseller account does not support, it will be replaced with the default package for your reseller account.
To change the Service Package requires that you first perform a web API call with the Service=ResellerBilling and Action=DEACTIVATE and then Action=ACTIVATE with the new Service Package specified.
Return Text: Refer to the API Result and Error Messages section.
Get Transactions
Introduction
The Get Transactions service, allows you to get the historical transactions for a particular Sierra Chart user account or for all Sierra Chart accounts being managed by particular multiuser manager.
Specifications
The website script for get historical transactions for a particular or all accounts managed by a multiuser manager is https://www.sierrachart.com/API.php.
The method by which the parameters need to be given to the website script is through a POST method.
The following are the list of the parameters:
- AdminUsername: This must be set to your Sierra Chart administrator Account Name that has been given access to this service.
- AdminPassword: This must be set to the Sierra Chart Password for your administrator account.
- UserSCUsername: This must be set to the Sierra Chart Account Name of the user you want to get transactions for. This will be the Account Name that has been specified when creating the account. Leave this blank to get transactions of all Sierra Chart accounts.
- Service: This must be set to ResellerBilling.
- Action: This must be set to GET_TRANSACTIONS
- Year: Transaction year in the format YYYY.
- Month: Transaction month in the format 1 (January) through 12 (December).
- ReturnFormat: This must be set to json.
Return Text (JSON):
- Total: Sum amount of all the transactions
- Data: An array of all the transactions within the time period
- Sample Data: {"Status":"SUCCESS","Message":{"Total":75.6,"Data":[ {"datetime":"2020-09-01 00:00:02","transaction_id":"1886199","Admin":"","IP":"","name":"Test Test","Username":"AC00000","description":"Internal Reseller Billing Time Adjustment - Affiliate Code: affiliate. Extending to 2020-09-30. User has Denali Data Feed active.","period":"29","BilledPrice":26,"ListPrice":26,"TransactionPurpose":"Usage Time","package":"3","AccountUsageEndDate":"2020-09-30","LastLoginDate":"2020-10-05","AccountCreationDate":"2014-04-25","BillingAffiliateID":"affiliate"}] } }
- Error with the Error Message. Refer to the API Result and Error Messages section.
- Sample Error: {"Status":"ERROR","Message":"INVALID_ADMIN"}
API Result and Error Messages
The result text returned after a call to the API.php script will begin with either SUCCESS: or ERROR: followed by a free-form text description or an error constant in text form.
If the request headers indicated JSON is supported, the response will be JSON formatted.
Common Result Messages
- ERROR: Unsecure connections not allowed. Use https.
- ERROR: INVALID_ACTION: This error indicates the Action parameter was not valid for the particular Service that has been specified.
- ERROR: Invalid Login Information.: This indicates the AdminUsername or AdminPassword is not valid.
- ERROR: Call not supported: This indicates that Service is not supported. Contact Sierra Chart support for help with this.
Create New Sierra Chart Accounts Specific Result Messages
- SUCCESS: USERNAME_AVAILABLE
- SUCCESS: ACCOUNT_CREATED_SUCCESSFULLY
- ERROR: ACCESS_DENIED_FOR_ACCOUNT_CREATION: This indicates you are not using the correct AdminUsername or the AdminUsername is not authorized for account creation. Contact Sierra Chart support for help with this.
- ERROR: USERNAME_ALREADY_EXISTS
- ERROR: FAILED_TO_CREATE_AN_ACCOUNT
- ERROR: USERNAME_TOO_SHORT
- ERROR: USERNAME_ILLEGAL_CHARACTERS
- ERROR: PASSWORD_ILLEGAL_CHARACTERS
- ERROR: PASSWORD_TOO_SHORT
- ERROR: INVALID_EMAIL
- ERROR: FIRST_NAME_ILLEGAL_CHARACTERS
- ERROR: LAST_NAME_ILLEGAL_CHARACTERS
- ERROR: LAST_NAME_TOO_SHORT
- ERROR: ADDRESS_NOT_SET
- ERROR: ADDRESS_ILLEGAL_CHARACTERS
- ERROR: POSTAL_CODE_NOT_SET
- ERROR: POSTAL_CODE_ILLEGAL_CHARACTERS
- ERROR: CITY_NOT_SET
- ERROR: CITY_ILLEGAL_CHARACTERS
- ERROR: STATE_NOT_SET
- ERROR: STATE_ILLEGAL_CHARACTERS
- ERROR: COUNTRY_NOT_SET
- ERROR: COUNTRY_ILLEGAL_CHARACTERS
- ERROR: TELEPHONE_NUMBER_NOT_SET
Manage Custom Studies Users Specific Result Messages
- SUCCESS: User Added.
- SUCCESS: User Removed.
- SUCCESS: User Is Authorized.
- SUCCESS: User Is Not Authorized.
- ERROR: Invalid Login Information.
- ERROR: SCDLLName not set.
- ERROR: Your account does not have administrative control over the set SCDLLName, contact support@sierrachart.com.
- ERROR: UserSCUsername is unset.
- ERROR: Account [UserSCUsername] does not exist.
- ERROR: The account name [UserSCUsername] cannot be added/removed.
- ERROR: Account [UserSCUsername] already added.
- ERROR: Failed to add user, contact support@sierrachart.com
- ERROR: Account [UserSCUsername] is not added to the study.
- ERROR: Failed to remove user, contact support@sierrachart.com
Manage Data/Trading Service Settings Specific Result Messages
- SUCCESS: [Message]
- ERROR: [Message]
- ERROR: Invalid Login Information.
- ERROR: Account [UserSCUsername] does not exist.
Manage Reseller Billing Specific Result Messages
- SUCCESS: RESELLER_BILLING_UPDATED
- ERROR: [Message]
- ERROR: ACCESS_DENIED
- ERROR: ACCESS_TO_USER_DENIED
- ERROR: Invalid Login Information.
- ERROR: FAILED_TO_UPDATE_PACKAGE
- ERROR: INVALID_ACCOUNT
- ERROR: FAILED_TO_UPDATE_RESELLER_BILLING
- ERROR: RESELLER_ONE_TIME_EXTENSIONS_NOT_ENABLED
- ERROR: FAILED_TO_EXTEND_ACCOUNT
Get User Transactions Specific Result Messages
- ERROR: ACCESS_DENIED
- ERROR: ACCESS_TO_USER_DENIED
- ERROR: Invalid Login Information.
- ERROR: INVALID_ACCOUNT
- ERROR: JSON only response is supported.
- ERROR: Invalid Year or Month provided.
- ERROR: Transaction prior to [CutOfDate] are not returned.
API and Messages for Sierra Chart Live and Simulated Trading Systems
This section documents the API and messages for Sierra Chart live order routing services and trade simulation systems.
The API for these is the DTC Protocol. There are several message encodings supported. Binary Encoding is not supported. Only Binary with Variable Length Strings encoding, and the other encodings.
Contact Sierra Chart support, for the particular server address and port number to use. You will log on using the DTC protocol standard logon procedure using your Sierra Chart username and password. Additional access rights may need to be granted.
The following list are the constants for the various supported messages. For the structure members, refer to the DTCProtocol_NonStandard.h file.
All of the below messages always operate on a single Trade Account and any of its subaccounts. There are no global operations supported.
There is also support for duplicating a Trade Account.
- TRADE_ACCOUNT_DATA_REQUEST: Requests a snapshot of all trade account data. This includes the following messages: TRADE_ACCOUNT_DATA_RESPONSE, TRADE_ACCOUNT_DATA_AUTHORIZED_USERNAME_RESPONSE (multiple), TRADE_ACCOUNT_DATA_SYMBOL_LIMITS_RESPONSE (multiple), TRADE_ACCOUNT_DATA_SYMBOL_COMMISSION_RESPONSE (multiple), TRADE_ACCOUNT_DATA_SUB_ACCOUNT_RESPONSE (multiple), TRADE_ACCOUNT_DATA_USERNAME_TO_SHARE_WITH_RESPONSE (multiple), TRADE_ACCOUNT_DATA_USERNAME_TO_SHARE_WITH_RESPONSE (multiple), TRADE_ACCOUNT_DATA_RESPONSE_TRAILER (the final message). Upon an error TRADE_ACCOUNT_DATA_UPDATE_OPERATION_COMPLETE is returned with the error message.
- TRADE_ACCOUNT_DATA_RESPONSE: The TRADE_ACCOUNT_DATA_RESPONSE is sent in response to a TRADE_ACCOUNT_DATA_REQUEST and contains all of the settings and variables for a single trade account.
- TRADE_ACCOUNT_DATA_UPDATE: To create a new trade account or modify the settings of a trade account requires sending a TRADE_ACCOUNT_DATA_UPDATE message. The following message members must be set: RequestID, TradeAccount. The following members are for new accounts: IsNewAccount, NewAccountAuthorizedUsername (optional). The other members can optionally be set depending upon what is required. Each member has a corresponding *IsSet member which must be set to 1 when the corresponding variable/member is set. This lets you change only particular variables you want when sending an update. On an error or a completed operation, a TRADE_ACCOUNT_DATA_UPDATE_OPERATION_COMPLETE message is sent.
- TRADE_ACCOUNT_DATA_DELETE: This message is for deleting a trade account.
- TRADE_ACCOUNT_DATA_SYMBOL_COMMISSION_RESPONSE: The TRADE_ACCOUNT_DATA_SYMBOL_COMMISSION_RESPONSE is sent in response to a TRADE_ACCOUNT_DATA_REQUEST and contains commission settings for a symbol.
- TRADE_ACCOUNT_DATA_SYMBOL_COMMISSION_UPDATE: The TRADE_ACCOUNT_DATA_SYMBOL_COMMISSION_UPDATE is for setting or updating the commission settings for a particular symbol. On an error or a completed operation, a TRADE_ACCOUNT_DATA_UPDATE_OPERATION_COMPLETE message is sent.
- TRADE_ACCOUNT_DATA_SYMBOL_LIMITS_RESPONSE: The TRADE_ACCOUNT_DATA_SYMBOL_LIMITS_RESPONSE is sent in response to a TRADE_ACCOUNT_DATA_REQUEST and contains various limit and margin settings for a symbol.
- TRADE_ACCOUNT_DATA_SYMBOL_LIMITS_UPDATE: The TRADE_ACCOUNT_DATA_SYMBOL_LIMITS_UPDATE message is for setting or updating the limit and margin settings for a particular symbol. On an error or a completed operation, a TRADE_ACCOUNT_DATA_UPDATE_OPERATION_COMPLETE message is sent.
- TRADE_ACCOUNT_DATA_AUTHORIZED_USERNAME_RESPONSE: The TRADE_ACCOUNT_DATA_AUTHORIZED_USERNAME_RESPONSE is sent in response to a TRADE_ACCOUNT_DATA_REQUEST and contains an authorized username for the trade account.
- TRADE_ACCOUNT_DATA_AUTHORIZED_USERNAME_ADD: The TRADE_ACCOUNT_DATA_AUTHORIZED_USERNAME_ADD message is for adding an authorized username to the trade account. On an error or a completed operation, a TRADE_ACCOUNT_DATA_AUTHORIZED_USERNAME_RESPONSE message is sent.
- TRADE_ACCOUNT_DATA_AUTHORIZED_USERNAME_REMOVE: The TRADE_ACCOUNT_DATA_AUTHORIZED_USERNAME_REMOVE message is for removing an authorized username from the trade account. On an error or a completed operation, a TRADE_ACCOUNT_DATA_AUTHORIZED_USERNAME_RESPONSE message is sent.
- TRADE_ACCOUNT_DATA_USERNAME_TO_SHARE_WITH_RESPONSE: The TRADE_ACCOUNT_DATA_USERNAME_TO_SHARE_WITH_RESPONSE is sent in response to a TRADE_ACCOUNT_DATA_REQUEST and contains a read/write or read-only username for the trade account.
- TRADE_ACCOUNT_DATA_USERNAME_TO_SHARE_WITH_ADD: The TRADE_ACCOUNT_DATA_USERNAME_TO_SHARE_WITH_ADD message is for adding a read/write or read-only username to the trade account. On an error or a completed operation, a TRADE_ACCOUNT_DATA_USERNAME_TO_SHARE_WITH_RESPONSE message is sent.
- TRADE_ACCOUNT_DATA_USERNAME_TO_SHARE_WITH_REMOVE: The TRADE_ACCOUNT_DATA_USERNAME_TO_SHARE_WITH_REMOVE message is for removing a read/write or read-only username from the trade account. On an error or a completed operation, a TRADE_ACCOUNT_DATA_USERNAME_TO_SHARE_WITH_RESPONSE message is sent.
- TRADE_ACCOUNT_DATA_RESPONSE_TRAILER: This is the final trailer message in response to a TRADE_ACCOUNT_DATA_REQUEST message.
- TRADE_ACCOUNT_DATA_UPDATE_OPERATION_COMPLETE: This is an operation complete message used in response to various other messages. Request messages which will provide this TRADE_ACCOUNT_DATA_UPDATE_OPERATION_COMPLETE message, document this in their description.
- MARGIN_DATA_REQUEST: The MARGIN_DATA_REQUEST is for requesting actual margin values for a particular symbol. The response is provided in the MARGIN_DATA_RESPONSE message.
- MARGIN_DATA_RESPONSE: The MARGIN_DATA_RESPONSE is in response to a MARGIN_DATA_REQUEST and contains the margin values for a particular symbol.
- TRADE_ACCOUNT_DATA_SUB_ACCOUNT_RESPONSE: The TRADE_ACCOUNT_DATA_SUB_ACCOUNT_RESPONSE message is sent in response to a TRADE_ACCOUNT_DATA_REQUEST and contains subaccount information.
- TRADE_ACCOUNT_DATA_SUB_ACCOUNT_UPDATE: The TRADE_ACCOUNT_DATA_SUB_ACCOUNT_UPDATE message is for setting or updating subaccount information for the main trade account. On an error or a completed operation, a TRADE_ACCOUNT_DATA_UPDATE_OPERATION_COMPLETE message is sent.
- TRADE_ACCOUNT_DATA_DUPLICATE: The TRADE_ACCOUNT_DATA_DUPLICATE message duplicates an existing Trade Account. Upon success or error, the TRADE_ACCOUNT_DATA_UPDATE_OPERATION_COMPLETE message is sent in response.
*Last modified Sunday, 24th November, 2024.