Get started

API Endpoint: https://tornsy.com/api

Tornsy collects stock data from Torn once a minute. This API provides you with access to that data. Fresh data is normally available 5 - 10 seconds after every minute. No key is required.

Stocks watchlist

To get list of stocks, you need to make a GET call to the following url :
https://tornsy.com/api/stocks



 Result example :
 
 {
  "data": [
    {
      "stock": "ASS",
      "name": "Alcoholics Synonymous",
      "price": "310.82",
      "total_shares": 3375813655,
      "investors": 6432
    },
    {
      "stock": "TCSE",
      "name": "TCSE Market Index",
      "price": "12175.15",
      "total_shares": 633516950599,
      "marketcap": 182514132044190,
      "investors": 53212,
      "index": 1
    }
  ],
  "timestamp": 1640000820
}
                 

QUERY PARAMETERS

Field Type Description
interval String (optional) A list of intervals to add to the list. You can specify up to 5 comma separated intervals.
ohlc String (optional) A list of ohlc intervals to add to the list (will add info of last candle for each interval). You can specify up to 5 comma separated intervals.

{
  "data": [
    {
      "stock": "ASS",
      "name": "Alcoholics Synonymous",
      "price": "310.81",
      "total_shares": 3375814777,
      "investors": 6430,
      "interval": {
        "1640000820": {
          "price": "310.82",
          "total_shares": 3375813655,
          "investors": null
        },
        "m1": {
          "price": "310.86",
          "total_shares": 3375814777,
          "investors": 2103
        },
        "h12": {
          "price": "310.92",
          "total_shares": 3376709493,
          "investors": 6332
        },
        "w8": {
          "price": "306.95",
          "total_shares": 3158125378,
          "investors": null
        }
      }
    },
    {
      "stock": "TCSE",
      "name": "TCSE Market Index",
      "price": "12172.65",
      "total_shares": 633307470461,
      "marketcap": 182384766973010,
      "investors": 53313,
      "index": 1,
      "interval": {
        "1640000820": {
          "price": "12175.15",
          "total_shares": 633516950599,
          "marketcap": 182514132044190,
          "investors": null
        },
        "m1": {
          "price": "12171.81",
          "total_shares": 633307704732,
          "marketcap": 182357683506480,
          "investors": 53331
        },
        "h12": {
          "price": "12169.10",
          "total_shares": 638658826327,
          "marketcap": 182634136863500,
          "investors": 53456
        },
        "w8": {
          "price": "12042.14",
          "total_shares": 646328035829,
          "marketcap": 178770381450400,
          "investors": null
        }
      }
    }
  ],
  "timestamp": 1640002440,
  "intervals": {
    "1640000820": 1640000820,
    "m1": 1640002380,
    "h12": 1639958400,
    "w8": 1635120000
  }
}
          

SUPPORTED INTERVALS

Absolute - specify a timestamp for your interval, such as 1640000820 (will be rounded down to closest minute).
Relative - specify how long ago from current prices, such as m15. First character specifies interval type, followed by a number that specifies length. Supported types:

  • m - minute
  • h - hour
  • d - day
  • w - week
  • n - month
  • y - year

Examples if resolving on Dec 20th 2021 at 18:05 (any non-negative interval length is supported)

Interval Resolved datetime
m3 Dec 20th 2021 at 18:02
m60 Dec 20th 2021 at 17:05
h0 Dec 20th 2021 at 18:00
h2 Dec 20th 2021 at 16:00
d1 Dec 19th 2021 at 00:00
n0 Dec 1st 2021 at 00:00

When specified, API will return a list of intervals and their resolved timestamps in the results (check 2nd example).

EXAMPLES

Url Explanation
api/stocks Default watchlist without any intervals. Returns only list of current prices.
api/stocks?interval=m1,h12,w8,1640000820 Specify m1,h12,w8,1640000820 intervals, which will be included in the list.
api/stocks?ohlc=d1,w1,n1,y1 Specify d1,w1,n1,y1 OHLC intervals - will include information about the most recent candle for each interval.

"price_m1" field has been removed with version 1.1.0 (April 25th 2022).

"investors" field has been added with version 1.1.0 (April 25th 2022).

"ohlc" query parameter has been added with version 1.2.0 (October 18th 2022).

OHLC historic data

To get historic data, you need to make a GET call to the following url :
https://tornsy.com/api/:stock
*Replace :stock with actual stock acronym (3 - 4 letters, case insensitive)

Result example (default interval - m1):


{
  "data": [
    [
      1640004420, // timestamp
      "369.11",   // price
      9019577134  // total_shares
      // marketcap (optional, only for TCSE)
    ],
    [
      1640004480,
      "369.11",
      9019577134
    ],
    [
      1640004540,
      "369.11",
      9019577134
    ]
  ]
}
  Result example for any other interval:
  
  
  {
    "data": [
      [
        1639994400, // timestamp
        "369.38",   // open
        "369.78",   // high
        "369.16",   // low
        "369.16",   // close
        9029386949  // total_shares
        // marketcap (optional, only for TCSE)
      ],
      [
        1639998000,
        "369.05",
        "369.49",
        "369.05",
        "369.45",
        9020368964
      ],
      [
        1640001600,
        "369.47",
        "369.69",
        "369.08",
        "369.38",
        9019693742
      ]
    ]
  }
  
  

QUERY PARAMETERS

Field Type Description
interval String (optional) A single interval. One of (m1, m5, m15, m30, h1, h2, h4, h6, h12, d1, w1, n1, y1, all)
from Number (optional) Timestamp to filter results. Inclusive (>=)
to Number (optional) Timestamp to filter results. Exclusive (<)
limit Number (optional) [1-2000] Limits amount of returned rows (default 1000)

EXAMPLES

Url Explanation
api/lsc Most recent 1000 minutes of LSC data.
api/lsc?interval=h1 OHLC data for most recent 1000 hours of LSC data.
api/tcse?interval=n1&limit=1 OHLC for current month of TCSE.
api/lsc?interval=m5&to=1621447200 Get LSC data using m5 interval (1000 points just older than 1621447200).
api/lsc?interval=m30&from=1621438200&to=1621447200 Get LSC data using m30 interval between 1621438200 and 1621447200 timestamps.

TCSE additionally also returns a marketcap value (because unlike "normal" stocks, it is not a product of price and total_shares).

In the future, "investors" info might be added to this data.

About Tornsy

This API is public and free to use by anyone. If you have questions / suggestions, feel free to contact me on my Torn Profile.

NOTE

Stock data is collected while "live". In case of connection trouble or Torn's API being down, it can sometimes happen that there is data missing for a specific minute.

TORNSY IS OPEN SOURCE

Check it out on GitHub!