2. Accounts and TIs - adharapayments/REST-API GitHub Wiki

General Information

  • These services provides global information about available prime broker accounts in the system, as well all available trading interfaces (TIs) which can be used for trading purposes.
  • Rest of web-services objects in the API will refer to these accounts and TIs, therefore these services will be typically called at the beginning of the execution.

Examples

Account list request:

$ curl -i --data '{"getAccount":{"user":"demo","token":"E79133C6902B63D2E5F5D9E9F1E658019F143675"}}' http://actfx.adhara.io:81/fcgi-bin/IHFTRestAPI/getAccount --header 'Content-Type: application/json'

Date: Wed, 01 Jul 2015 00:00:00 GMT
Server: Apache/2.4.7 (Ubuntu)
Transfer-Encoding: chunked
Content-Type: application/json;charset=iso-8859-1

{ "getAccountResponse": {
   "account": [
      { "name": "AC1",
        "description": "",
        "style": "treasury",
        "leverage": 40,
        "rollover": "daily",
        "settlement": "single swap" },

      { "name": "AC2",
        "description": "",
        "style": "treasury",
        "leverage": 40,
        "rollover": "daily",
        "settlement": "single swap" } ],

   "timestamp": "1445918265.729631" }
}

Trading interface (TI) list request:

$ curl -i --data '{"getInterface":{"user":"demo","token":"E79133C6902B63D2E5F5D9E9F1E658019F143675"}}' http://actfx.adhara.io:81/fcgi-bin/IHFTRestAPI/getInterface --header 'Content-Type: application/json'

HTTP/1.1 200 OK
Date: Wed, 01 Jul 2015 00:00:00 GMT
Server: Apache/2.4.7 (Ubuntu)
Transfer-Encoding: chunked
Content-Type: application/json;charset=iso-8859-1

{ "getInterfaceResponse": {
   "tinterface": [
      { "name": "TI1",
        "description": "",
        "account": "AC1",
        "commissions": "charged in USD" },

      { "name": "TI2",
        "description": "",
        "account": "AC2",
        "commissions": "charged in USD" } ],

   "timestamp": "1445946191.976977" }
}

getAccount()

Request: getAccount object

  • user: Required. Strategy login assigned by the backend administrator.
  • token: Required. Token obtained during the authentication procedure.
  • account: Optional. List of accounts to ask for. Default value: All

Response: getAccountResponse object

  • account: Object that includes a list of accounts with following fields:

    • name: Account name. This name will be used by other web-services.
    • description: Account description (usually a null string).
    • style: Style of accounting used by this account. It can be "treasury" or "margin".
    • leverage: Global leverage that is used for margin calculation.
    • settlement: Settlement mode used when orders are executed. It can be "spot" or "single swap".
    • rollover: When settlement mode is "single swap", this field defines the rollover period for each swap. It can be "no rollover", "daily", "weekly" or "monthly".
  • timestamp: Epoch time of the response. Decimals define the number of micro-seconds. Integer part represents the seconds from "epoch" time.

getInterface()

Request: getInterface object

  • user: Required. Strategy login assigned by the backend administrator.
  • token: Required. Token obtained during the authentication procedure.
  • tinterface: Optional. List of trading interfaces (TIs) to ask for. Default value: All.

Response: getInterfaceResponse object

  • tinterface: Object that includes a list of trading interfaces with following fields:

    • name: Trading interface name. This name will be used by other web-services.
    • description: Trading interface description (usually a null string).
    • commissions: Method applied to calculate commissions. It can be "charged at denomination currency", "charged at base asset on each trade", "charged at term asset on each trade", "charged in USD" or "no commissions are calculated".
  • timestamp: Epoch time of the response. Decimals define the number of micro-seconds. Integer part represents the seconds from "epoch" time.