Skip to main content

How monitors work

A monitor is a condition on Tako data, such as “AAPL moves up 3% in a day” or “the 49ers win.” Tako evaluates the condition when new data arrives. When the condition occurs, Tako posts a signed request to your endpoint. You don’t poll, and you don’t schedule anything. You work with four objects:

Supported monitor types

Tako supports four domains of monitor types. For the current list and each type’s parameters, call List monitor types.

Stocks

A stock moves by a percentage over a day, a week, or a month. A stock’s price crosses a level you set. A stock sets a new 52-week high or low.

Crypto

A crypto asset’s price in US dollars reaches a level you set. You name the asset by its ticker or its CoinMarketCap id.

Forex

A currency pair’s rate reaches a level you set, such as EUR/USD above 1.15.

Sports

A game starts, a game ends, a team scores, or a betting line reaches a level you set. You can watch one game, or follow one team across its games.

What to know before you start

  • A monitor fires only for what happens after you create it. You can’t use a monitor to search history.
  • Most monitors fire once. By default, Tako pauses a monitor after its first firing. To fire on every new occurrence, set fire_once to false. The crypto and forex level types always fire once.
  • A firing reports when the condition occurred, not the current value. Each source reports new data on its own schedule. Each type’s description in List monitor types says how far its source runs behind.
  • By default, you can hold 1 active monitor and 2 notification channels. Tako counts these limits per user. A LIMIT_REACHED response’s limit gives your cap. To free a monitor slot, pause or delete a monitor. For higher limits, contact support@tako.com.
  • The monitors endpoints allow 120 calls per minute, and 20,000 per day. Each call takes the X-API-Key header that every Tako endpoint uses.

Examples

To build parameters for another type, read its parameters_schema in List monitor types.

Monitor AAPL for a 3% daily rise

1

Create a notification channel

CHANNEL_ID holds the channel’s id, and tako-webhook-secret.txt holds its signing secret. Store the secret now, because no later request returns it.
2

Create the monitor

fire_once: false keeps the monitor active after it fires, so it fires again on the next day that AAPL rises 3%. subject in the response names the listing that Tako matched: AAPL on XNAS, Apple Inc.
3

Receive the firing

On a day that AAPL rises 3% or more from the prior session’s close, Tako posts a monitor.fired event to your channel. This excerpt shows the body’s summary and payload:
Verify the signature before you trust the body. For the full body and the verification code, see Webhook deliveries.

Monitor every 49ers win

This example posts to the channel you created in the preceding example. By default, you can hold 1 active monitor, so this example pauses the AAPL monitor before it creates a new one.
1

Find the 49ers' team id

Each game in the response names its home and away teams, with an id for each. The list covers one day back to seven days ahead. The NFL plays every week from September to February, so the 49ers appear in most weeks of the season. If TEAM_ID is empty, the 49ers have no game in that window. A team’s id doesn’t change, so you can store it and reuse it when the team has no game in the window.
2

Pause the AAPL monitor

A paused monitor doesn’t count toward your limit.
3

Create the monitor

A team_id without a game_id follows the team from game to game. fire_once: false keeps the monitor active for the whole season.
4

Receive the firing

When a 49ers game ends in a win, Tako posts a monitor.fired event to your channel. This excerpt shows the body’s summary and part of its payload:
To fire only on a win by 10 points or more, add "margin": 10 to parameters.
To post each 49ers win to a Slack channel, register a slack_workflow notification channel, and attach it to the monitor. See Send monitor firings to Slack.

Next steps