Our plans and pricing are changing on 1st November. Learn more...

Automated Trading Trading Groups

Trading Group API

The Trading Group API provides programmatic access to your trading groups, clients and trading events.

Introduction

The API uses REST style requests over HTTPS. All responses are JSON encoded.

The endpoint for the API is:-

https://alertatron.com/pa

Authentication

You will need an access token to use the API. You can generate a key to access your trading groups from the Trading Groups menu here.

All requests are sent over HTTPS and include a Bearer Token authorisation header. For example:

curl --request GET \
  --url https://alertatron.com/pa/trading-groups \
  --header 'authorization: Bearer your-API-token-here' \
  --header 'accept: application/json' \
  --header 'content-type: application/json'

Rate Limits

The API imposes rate limits on the number of requests made. Details of your usage and limits can be seen in the response headers for each request where you can see your limit and number of requests remaining...

X-RateLimit-Limit      30
X-RateLimit-Remaining  29

Once you have been rate limited, you will also see 2 additional headers (see below) showing how long you need to wait before you can safely make further requests, and the unix timestamp of the time at which the temp ban will be lifted.

Retry-After        43
X-RateLimit-Reset  1554210731

Response

The response will always be in the following format...

{
  "success": true,
  "response": {}
}

On success, the API will return a status code of 200 and success will be true. The response property will either be an object or an array, containing the requested data.

On error the API will return a suitable status code and success will be false. Common error status codes you might see include:-

Status Code Meaning
200 Everything is great.
404 Unknown address, or attempt to access an unknown entity.
403 Permission denied - there was a problem with your API access token
422 One of the arguments passed to the API is unacceptable for some reason.
429 Rate limited. Wait at least Retry-After seconds before trying again.

GET /trading-groups

Gets a list of your trading groups

Example Response

  "success": true,
  "response": [
    {
      "id": "423e27e7-73f1-3ebe-96db-126626d0cdc4",
      "name": "Consequuntur quidem.",
      "description": "Quis sed enim quo qui minima repellendus voluptas.",
      "exchange": "deribit",
      "isTestnet": false,
      "createdAt": "2020-07-08T14:03:25.000000Z"
    },
    {
      "id": "48199bb0-180a-3fa9-8938-55e8b8c91e07",
      "name": "Reprehenderit.",
      "description": "Nam fuga iste velit voluptates rerum ipsam.",
      "exchange": "bitmex",
      "isTestnet": false,
      "createdAt": "2020-07-08T14:03:25.000000Z"
    }
  ]
}

GET /clients

Gets details on the clients in a trading group, or on an individual client.

Request Parameters

Parameter Type Comments
id string The id of the client to look up. A single client will be returned, as an object.
trading_group_id string The id of a trading group. All clients in the groups will be returned as an array.

You should pass either id or trading_group_id, but not both. Parameters should be passed as a query string.

Example Response

{
  "success": true,
  "response": [
    {
      "id": "401fceb9-8526-3312-bd79-98cbd2d0e330",
      "name": "Dr. Ava Mante",
      "contact": "ilemke@miller.com",
      "notes": "Aliquam consequuntur nemo incidunt.",
      "validKeys": false,
      "isActive": true,
      "isPaid": true,
      "isOnGracePeriod": false,
      "canTrade": false,
      "isAutoRenew": false,
      "subscriptionExpiresAt": "2020-08-24T10:09:42.000000Z",
      "createdAt": "2020-07-08T14:54:50.000000Z"
    },
    {
      "id": "b2b06f37-e25c-33e0-a1e3-2c9ad26a323f",
      "name": "Elyse Johnston",
      "contact": "golden20@walsh.com",
      "notes": "Aliquid sunt beatae veritatis.",
      "validKeys": true,
      "isActive": true,
      "isPaid": true,
      "isOnGracePeriod": false,
      "canTrade": true,
      "isAutoRenew": false,
      "subscriptionExpiresAt": "2020-07-30T02:25:37.000000Z",
      "createdAt": "2020-07-08T14:54:50.000000Z"
    },
    {
      "id": "0429d983-3e94-3e87-ba36-ea4794fb01c9",
      "name": "Maurine Donnelly",
      "contact": "becker.selena@hotmail.com",
      "notes": "Dolores qui quos quidem tempore iusto.",
      "validKeys": true,
      "isActive": true,
      "isPaid": true,
      "isOnGracePeriod": false,
      "canTrade": true,
      "isAutoRenew": false,
      "subscriptionExpiresAt": "2020-08-15T10:14:50.000000Z",
      "createdAt": "2020-07-08T14:54:50.000000Z"
    }
  ]
}

The following properties found in the response have the following meaning:-

Propery Meaning
validKeys true if API keys have been added for this client and they are valid and ready to use
isActive If the client is paused, this will be false.
isOnGracePeriod True if the client's subscription has recently expired and they are on their grace period.
canTrade true if the client can trade. This implies the client is active, has valid API keys and is paid for (or on grace period).
isPaid true if the client is paid for at the moment.
isAutoRenew true if the clients subscription will try to auto-renew when their subscription expires
subscriptionExpiresAt The time and date that the client's subscription will expire at. If this date is in the past, the subscription has already expired.

GET /sessions

Gets a list of recent sessions

Request Parameters

Parameter Type Required Comments
client_id string Yes The id of the client that generated the events.
symbol string No The name of the symbol to filter the results to
before int No Only return results that occured before the sequence id given (use this to request additional pages of sessions)

Example Response

{
  "success": true,
  "response": [
    {
      "session": "7fe3a7ee",
      "exchangeId": "deribit",
      "exchangeName": "Deribit",
      "exchangeLogo": "\/images\/logos\/deribit.svg",
      "symbol": "ETH-PERPETUAL",
      "keys": "deribittest",
      "sequence": 1602090369526,
      "date": "2020-10-07T17:06:10.471000Z"
    }
  ]
}

GET /commands

Gets the commands used in a single session

Request Parameters

Parameter Type Required Comments
client_id string Yes The id of the client that generated the events.
session string Yes The session id to fetch the commands from

Example Response

{
  "success": true,
  "response": [
    {
      "command": "begin",
      "arguments": null,
      "sequence": 1602090369526,
      "date": "2020-10-07T17:06:10.471000Z"
    },
    {
      "command": "limit",
      "arguments": "side=buy, amount=200, offset=100",
      "sequence": 1602090369528,
      "date": "2020-10-07T17:06:10.471000Z"
    },
    {
      "command": "end",
      "arguments": null,
      "sequence": 1602090373213,
      "date": "2020-10-07T17:06:22.147000Z"
    }
  ]
}

GET /trades

Gets the trades executed in a single session

Request Parameters

Parameter Type Required Comments
client_id string Yes The id of the client that generated the events.
session string Yes The session id to fetch the commands from

Example Response

{
  "success": true,
  "response": [
    {
      "orderType": "limit",
      "orderId": "ETH-123456",
      "side": "buy",
      "amount": 200,
      "price": 238.5,
      "stopLimitPrice": null,
      "sequence": 1602090369536,
      "date": "2020-10-07T17:06:10.613000Z"
    },
    {
      "orderType": "limit",
      "orderId": "ETH-125678",
      "side": "buy",
      "amount": 135,
      "price": 288.5,
      "stopLimitPrice": null,
      "sequence": 1602090369556,
      "date": "2020-10-07T17:06:10.802000Z"
    },
    {
      "orderType": "cancel",
      "orderId": "ETH-876543",
      "side": null,
      "amount": null,
      "price": null,
      "stopLimitPrice": null,
      "sequence": 1602090373198,
      "date": "2020-10-07T17:06:21.737000Z"
    },
  ]
}

GET /errors

Gets the errors that occured during a session.

Request Parameters

Parameter Type Required Comments
client_id string Yes The id of the client that generated the events.
session string Yes The session id to fetch the commands from

Example Response

{
  "success": true,
  "response": [
    {
      "orderType": "stop",
      "method": "post",
      "path": "\/open-api\/stop-order\/create",
      "statusCode": 30033,
      "message": "already had 10 working normal stop orders",
      "sequence": 1603470409698,
      "date": "2020-10-23T16:27:01.815000Z"
    },
    {
      "orderType": "stoplimit",
      "method": "post",
      "path": "\/open-api\/stop-order\/create",
      "statusCode": 30033,
      "message": "already had 10 working normal stop orders",
      "sequence": 1603470409710,
      "date": "2020-10-23T16:27:02.380000Z"
    }
  ]
}

GET /events

Deprecated: Note that the data returned by this endpoint is no longer collected. Use sessions, trades, commands and errors instead.

Gets a list of events from a client. The results are paginated.

Request Parameters

Parameter Type Required Comments
since ISO8601 date Yes The time and date from which to return events
client_id string Yes The id of the client that generated the events.
per_page int No A number from 1 to 100. Defaults to 100
page int No The page number of results to fetch. Defaults to 1
api_only bool No true to only get details of events relating to API calls. Defaults to true.

Example Response

{
  "success": true,
  "response": {
    "events": [
      {
        "exchange": "bitmex",
        "symbol": "BTCUSD",
        "eventType": "market",
        "value": "123",
        "meta": {
          "test": "value"
        },
        "botVersion": "106",
        "createdAt": "2020-07-06T15:15:30.000000Z"
      },
      {
        "exchange": "bybit",
        "symbol": "BTCUSD",
        "eventType": "block",
        "value": "123",
        "meta": {
          "test": "value"
        },
        "botVersion": "112",
        "createdAt": "2020-07-06T15:32:12.000000Z"
      },
      {
        "exchange": "bitmex",
        "symbol": "BTCUSD",
        "eventType": "market",
        "value": "123",
        "meta": {
          "test": "value"
        },
        "botVersion": "127",
        "createdAt": "2020-07-06T15:51:38.000000Z"
      }
    ],
    "perPage": 3,
    "currentPage": 1,
    "pages": 17,
    "totalEvents": 50,
    "since": "2020-07-05T14:30:24.833310Z"
  }
}

Some images from Unsplash

About Alertatron.com

Your TradingView alerts, with charts, PM'd to you.

Get all your alerts from TradingView, sent to Telegram, Discord, Slack, Email or webhooks, with a chart snapshot attached.

Capture Charts

See a high quality chart with every alert, captured at the moment the alert was triggered. See exactly what the market was doing and make informed decisions.

Automate Trading

Trigger orders on popular cryptocurrency exchanges and trade 24/7. Access powerful algorithmic orders to maximise your profits.

Integrations

Connect your alerts to Telegram (channels, groups and private chats), Discord, Slack, email or send push notifications to other services with webhooks.

Easy To Setup

Nothing to install and no browser extensions. Captures alerts 24/7, even with your computer switched off. Be up and running in seconds.