Blog Article

A New Ticker for the Stellar Community

Author

Alex Cordeiro

Publishing date

Ticker

API

Horizon

UPDATE:

When this post was written, SDF hosted an instance of the Stellar ticker. While the open-source code for the ticker remains available — and anyone is free to deploy it, amend it, or adapt it to their use case — the SDF-hosted instance was decommissioned January 3, 2024.


The SDF-hosted instance of the Stellar ticker was intended to allow for testing and developing proofs-of-concept, and was not meant for use in production. The instance was decommissioned because there was insufficient usage to justify the engineering and operational resources required to keep the service up to date, and we opted to devote those resources to higher-priority projects. If you have questions, comments, or suggestions about the ticker, testing infrastructure, or anything else, please share them in the Stellar Dev Discord!

We're very happy to announce that Stellar Development Foundation is releasing a new ticker API to provide the freshest data about Markets, Issuers and Assets on the Stellar Network.

SDF already had a long-running ticker, but its refresh rate wasn't fast enough to represent the dynamic and ever-growing network, and the data provided was only a subset of what's currently available through tools like Horizon.

The new ticker provides a backend API with the same functionality as the previous one, plus:

  • New data about Markets, such as OHLC (open-high-low-close) values and 7d stats
  • Orderbook statistics (number of bids, asks, spread, etc) per Market
  • A list of all reasonably active Assets within the network
  • A GraphQL interface to query data about specific Asset Pairs (e.g. XLM / EURT GAP5…OS2S) or aggregated ones (e.g. XLM_EUR) within an arbitrary time interval, as well as listing Assets and Issuers. If you're curious, try it out by pasting the following query here (and hit play):

{
 ticker(numHoursAgo: 24) {
 tradePair
 baseVolume
 counterVolume
 orderbookStats {
 bidMax
 askMin
 spread
 }
 }
}

What is a Ticker and why is it important?

According to Investopedia:

A stock ticker is a report of the price for certain securities, updated continuously throughout the trading session by the various stock exchanges. A “tick” is any change in price, whether that movement is up or down. A stock ticker automatically displays these ticks, along with other relevant information, like volume, that investors and traders use to stay informed about current market conditions.

In the context of the Stellar Network, a ticker provides the data associated with different trade Asset pairs (e.g. XLM and USDT), which we call Markets.

A ticker is important to give an accurate overview of the market activity at any given instant. Websites such as CoinMarketCap rely on ticker data to correctly display information about trade pairs.

How do I use the ticker?

As a backend project, the new ticker is UI-agnostic, i.e. it doesn't offer by itself a user-friendly interface for visualizing data–although we have some projects for building UIs for displaying ticker data in our roadmap.

In more technical terms, this is the new ticker's API root: https://ticker.stellar.org.

The new ticker offers two JSON endpoints:

  • /assets.json: displays information about all assets available:

// Example Response:

{
 "generated_at": 1555536150576,
 "assets": [
 {
 "code": "AngelXYZ",
 "issuer": "GANZBUS4726LBT2CBJ3BGF3TP4NJT5MHZMI423NHMXFRWGO2DCBQEXYZ",
 "type": "credit_alphanum12",
 "num_accounts": 282,
 "auth_required": false,
 "auth_revocable": false,
 "amount": 4999999999.999953,
 "asset_controlled_by_domain": true,
 "anchor_asset": "",
 "anchor_asset_type": "",
 "display_decimals": 0,
 "name": "",
 "desc": "",
 "conditions": "",
 "is_asset_anchored": false,
 "fixed_number": 0,
 "max_number": 0,
 "is_unlimited": false,
 "redemption_instructions": "",
 "collateral_addresses": [],
 "collateral_address_signatures": [],
 "countries": "",
 "status": "",
 "last_valid": 1555509989002
 },
 {
 "code": "PUSH",
 "issuer": "GBB5TTFQE5KT3TEBCR7Z3FZR3R3WTVD654XL2KHKVONRIOBEI5UGOFQQ",
 "type": "credit_alphanum4",
 "num_accounts": 15,
 "auth_required": false,
 "auth_revocable": false,
 "amount": 1000000000,
 "asset_controlled_by_domain": true,
 "anchor_asset": "",
 "anchor_asset_type": "",
 "display_decimals": 2,
 "name": "Push",
 "desc": "1 PUSH token entitles you to access the push API.",
 "conditions": "Token used to access the PUSH api to send a push request to the stellar network.",
 "is_asset_anchored": false,
 "fixed_number": 0,
 "max_number": 0,
 "is_unlimited": false,
 "redemption_instructions": "",
 "collateral_addresses": [],
 "collateral_address_signatures": [],
 "countries": "",
 "status": "",
 "last_valid": 1555509990457
 }
 ]
}
  • /markets.json: displays 24-hour, 7-day and orderbook information about markets that were active during these periods:

// Example Response:
{
 "generated_at": 1555529876427,
 "pairs": [
 {
 "name": "ABDT_DOP",
 "base_volume": 2936.8559372,
 "counter_volume": 67288.46914140001,
 "trade_count": 48,
 "open": 0.043734167043589976,
 "low": 0.04348452989055152,
 "high": 0.044444444444444446,
 "change": -0.0001736265897799502,
 "base_volume_7d": 93793.14427990005,
 "counter_volume_7d": 1939718.2717202017,
 "trade_count_7d": 399,
 "open_7d": 0.049850448654037885,
 "low_7d": 0.04348452989055152,
 "high_7d": 0.05100629529387713,
 "change_7d": 0.0059426550206679585,
 "price": 0.043907793633369926,
 "close": 0.043907793633369926,
 "close_time": 1555484876000
 },
 {
 "name": "BTC_ETH",
 "base_volume": 0,
 "counter_volume": 0,
 "trade_count": 0,
 "open": 0,
 "low": 0,
 "high": 0,
 "change": 0,
 "base_volume_7d": 0.00001,
 "counter_volume_7d": 0.00025,
 "trade_count_7d": 1,
 "open_7d": 0,
 "low_7d": 0.04,
 "high_7d": 0.04,
 "change_7d": 0,
 "price": 0.04,
 "close": 0.04,
 "close_time": 1554943803000
 }
 ]
}

The new ticker also speaks GraphQL:

  • /graphql: provides a GraphQL interface for querying data
  • /graphiql: provides a GraphiQL UI for exploring the GraphQL interface, so that you can try out queries from your browser You can find more detailed documentation about the ticker endpoints here.

Can I run / tweak my own Stellar Ticker?

Yes! The ticker is an open-source project hosted on SDFs Go monorepo. It consists of a series of routines that scrape data from Horizon, and that process and store that data in a way that enables easy querying.

The README.md contains Docker quick start instructions for any developer who is interested in running / tweaking their own ticker.

This project is under active development, so please feel free to send feedback, create issues and send Pull Requests directly on the monorepo.