Skip to content

Get subscriber transaction stream#

About#

Returns transaction stream for a CopyFactory subscriber. If there are no new records yet, the response will not be sent until a timeout expires or new record arrives. It is recommended to invoke this API in an infinite cycle constantly polling for new records to receive records in real time

GET /users/current/subscribers/:subscriberId/transactions/stream

For more information see Swagger documentation

Headers#

Name Type Required Description
auth-token string Yes authorization token. See Authentication & authorization

Path parameters#

Name Type Required Description
subscriberId string Yes subscriber id

Query parameters#

Name Type Required Description
startTime string(datetime) start of time range, inclusive (in ISO format). This time will be compared to updatedAt transaction field
limit integer pagination limit, default: 1000, min: 1, max: 1000

Response#

Responses:

  • 200 - Transactions returned successfully. Response schema: Array<Transaction>
  • 401 - Authorization failed. Response schema: Error
  • 404 - Subscriber not found. Response schema: Error

Examples#

Example request:

curl -X GET --header 'Accept: application/json' --header 'auth-token: token' 'https://copyfactory-api-v1.vint-hill.agiliumtrade.ai/users/current/subscribers/105646d8-8c97-4d4d-9b74-413bd66cd4ed/transactions/stream?startTime="2020-04-20T04:00:00.000Z"&limit=50'

Example response:

[
  {
    "id": "2235076744:close",
    "type": "DEAL_TYPE_BUY",
    "time": "2021-02-26T05:56:29.238Z",
    "subscriberId": "105646d8-8c97-4d4d-9b74-413bd66cd4ed",
    "symbol": "EURUSD",
    "subscriberUser": {
      "id": "5013f1322ae00d69167803d959e9f7dc",
      "name": "Bruce Wayne"
    },
    "demo": true,
    "providerUser": {
      "id": "5013f1322ae00d69167803d959e9f7dc",
      "name": "Clark Kent"
    },
    "strategy": {
      "id": "StMF",
      "name": "Test strategy",
    },
    "positionId": "+apNW3",
    "slavePositionId": "+apBW3",
    "improvement": 0,
    "providerCommission": 0.01,
    "platformCommission": 0.05,
    "incomingProviderCommission": 0,
    "incomingPlatformCommission": 0,
    "quantity": 1.99,
    "lotPrice": 121569.99999999999,
    "tickPrice": 1.2157,
    "amount": 241924.29999999996,
    "commission": -3.98,
    "swap": 0.06,
    "profit": -55.72,
    "metrics": {
      "tradeCopyingLatency": 261,
      "tradeCopyingSlippageInBasisPoints": -0.24676531795690237,
      "tradeCopyingSlippageInAccountCurrency": -5.969852681100103,
      "mtAndBrokerSignalLatency": 72,
      "tradeAlgorithmLatency": 35,
      "mtAndBrokerTradeLatency": 176,
    }
  }
]