Skip to main content

Getting Started

Tickflow allows you to screen for stocks or crypto by API for free. This page walks through a simple example of making a screening request in python.

Note: Your feedback is valuable for making this service better. If you have any questions or feedback, reach out to support@tickflow.io.

Authentication and Rate Limits

Tickflow currently requires no API keys or authentication to use. It's free to use for everyone. There is currently a rate limit by IP of 15 requests per minute. If you desire a higher rate limit, reach out to support@tickflow.io.

Screening Stocks

Imagine we want to find some stocks that meet the following requirements:

  • below $50 in price
  • above $20 Billion in market capitalization.
  • above 30% annual revenue growth

We can also query for additional data. For the resulting stocks, let's say we want to query data for the following additional fields:

  • the sector the stock is in
  • the price-to-earnings growth ratio
  • the free cashflow from the latest quarterly filing

Using the Data Reference

The stock data reference contains all the fields we can filter by. If we check, we find that the fields we should use to filter are market_cap and day_close and revenue_growth.

And additionally, the fields we want to query data for are sector, peg_ratio and free_cashflow.

All these fields combined must go in the fields parameter in the body of our request.

The Request Schema

The endpoint for screening stocks is POST https://api.tickflow.io/v1/stocks/screener. The API reference contains information about this endpoint's request schema.

The request takes two required parameters: fields and filters. The fields parameter will contain all the stock data fields we need for our request. These are the fields we are screening by and the additional fields we want to query data for.

# try-tickflow.py

# the fields we want to query for each of the returned stocks
fields = [ "revenue_growth", "market_cap",
"day_close", "sector",
"peg_ratio", "free_cashflow"]

The filters parameter is an array of filter objects representing our screening logic. Each filter object takes a field, a comparator (<, >, =) and a threshold to compare the field to.

To learn more about the how the request schema works, read the Screening Requests Guide.

# try-tickflow.py

# the filters we want to apply for screening
filters = [
# day close less than $50
{
"field": "day_close",
"comparator": "<",
"threshold": 50
},
# market cap greater than 20 Billion
{
"field": "market_cap",
"comparator": ">",
"threshold": 2e10
},
# above 30% revenue growth
{
"field": "revenue_growth",
"comparator": ">",
"threshold": 0.30
}
]

Finally let's combine our fields and filters into one JSON request payload.

# try-tickflow.py

# putting everything together into a single dictionary
# this will be sent with the request
request_payload = {
"fields": fields,
"filters": filters,
}

Making The Request

With the requests library, we'll make post request to https://api.tickflow.io/v1/stocks/screener with the payload we prepared above. The payload must be supplied in the json parameter of the method.

# try-tickflow.py

# making the POST request with our request_payload
response = requests.post(
url="https://api.tickflow.io/v1/stocks/screener",
json=request_payload)

The response is a JSON containing two top-level properties: status and results. The status property contains the HTTP response code for the request. The results property contains the output of our screening.

We can print the output of the response. The pprint library lets us print the JSON in a neat format with indents.

# try-tickflow.py

result = response.json()

# pretty print
pprint.pprint(result, indent=4)

Looking At The Results

Below are the results of our screening. The data from our query is contained in the result field in the response. Each key in our result is a different stock that passed our screening. Furthermore, for each stock, we have data for the fields we queried.

{
"status": 200,
"result": {
"BAM": {
"sector": "financial_services",
"revenue_growth": 0.331,
"free_cashflow": 6069250048.0,
"peg_ratio": 2.25,
"market_cap": 60265922560.0,
"day_close": 38.43
},
"GMAB": {
"sector": "healthcare",
"revenue_growth": 0.34,
"free_cashflow": 937249984.0,
"peg_ratio": 0.19,
"market_cap": 23833853952.0,
"day_close": 36.24
},
"KMI": {
"sector": "energy",
"revenue_growth": 0.635,
"free_cashflow": 1014875008.0,
"peg_ratio": -5.74,
"market_cap": 38659678208.0,
"day_close": 17.05
},
"LI": {
"sector": "consumer_cyclical",
"revenue_growth": 1.675,
"free_cashflow": 3290083584.0,
"peg_ratio": -210.22,
"market_cap": 21060016128.0,
"day_close": 20.39
},
"MRVL": {
"sector": "technology",
"revenue_growth": 0.738,
"free_cashflow": 1515845120.0,
"peg_ratio": 0.55,
"market_cap": 32047523840.0,
"day_close": 37.98
},
"RBLX": {
"sector": "communication_services",
"revenue_growth": 0.388,
"free_cashflow": 665741120.0,
"peg_ratio": 1.8,
"market_cap": 21526908928.0,
"day_close": 37.19
},
"UBER": {
"sector": "technology",
"revenue_growth": 1.361,
"free_cashflow": -766625024.0,
"peg_ratio": -0.32,
"market_cap": 50404319232.0,
"day_close": 25.98
}
}
}