Stocks and Forex

Polygon.io is a data provider for Stocks, Forex and Options. TAAPI.IO is a proud partner of Polygon and can vouch for their data quality. With this integration, our customers will be able to get all our technical analysis indicators on forex and US stocks in real time.

Technical analysis on all US stocks and forex currency pairs via API, in real-time

To get started with stocks and forex, you’ll need to be signed up as a Polygon user and have a their API key. Please visit: https://polygon.io/pricing and select a plan based on your needs. Polygon offers a free key to help you test out the integration and make sure all is working well.

Get in touch with us if you need help selecting a plan or applying the discount

After signing up, you’ll receive your API Key in their backend console. Simply follow the email instructions sent to you.

Then use your newly acquired key with your TAAPI.IO queries. This will work with all direct integration methods described in the Direct Integration Method, including Bulk calls (see below).

We will then, on behalf of you, request the needed candles for your indicator calculation from Polygon, calculate your indicator(s), and return the result to you.

Use the partner coupon on Polygon.io during checkout to claim your discount

Query

Following the direction in the Direct Method, all you need to do is add a few parameters to your query:

ParameterTypeMandatoryDescription
typeStringYes[forex, stocks, options] – This tells our API which asset class you’re looking for.
providerStringYespolygon
providerSecretStringYesInsert your Polygon API Key.
adjustedStringNo[true,false] – defaults to true. By default, we show indicators or candles adjusted for splits. Set this to false if you want your data unadjusted.
intervalStringYesInterval or time frame: We support the following time frames: 1m5m15m30m1h2h4h12h1d1w. So if you’re interested in values on hourly candles, use interval=1h, for daily values use interval=1d, etc.

Note, some parameters are no longer needed:

  • exchange: This is irrelevant as data comes in aggregated from Polygon, from multiple exchanges.

Bulk

Bulk queries will work as well, essentially making these calls very efficient, as you can calculate up to 20 indicators, off of the same candle set. If you have multiple constructs included in your plan, this will work efficiently too, as we’re calling each dataset asynchronously from Polygon.

{
	"secret": "{{ secret }}",
	"construct": {
		"type": "stocks",
		"provider": "polygon",
		"providerSecret": "{{ polygon_secret }}",
		"symbol": "AAPL",
		"interval": "1d",
		"indicators": [
			{
				"indicator": "ema",
				"period": 20
			},
			{
				"indicator": "rsi",
				"period": 14
			},
			{
				"indicator": "macd"
			}
		]
	}
}

Endpoint

In order to get as physically close as possible to Polygons servers, we’ve created a new endpoint, that you’ll need to send your queries to: https://us-east.taapi.io.

It will not be possible to call our main endpoint (api.taapi.io)

Example

As a very simple example, please try this AAPL RSI query on the daily timeframe:

curl https://us-east.taapi.io/rsi?secret=MY_TAAPI_SECRET&type=stocks&provider=polygon&providerSecret=MY_POLYGON_SECRET&symbol=AAPL&interval=1d

Discover Symbols

To get an up-to-date list of symbols that can be traded, send a GET request to: /exchange-symbols

For this Polygon integration, a few extra parameters are required.

ParameterTypeMandatoryDescription
secretStringYesYour secret issued by TAAPI.IO.
typeStringNoDefaults to ‘crypto’. Other options include [stocks, forex].
exchangeStringDependsIf type is ‘forex’ then this parameter is not mandatory. But for ‘crypto’ and ‘stocks’, it is.
quoteAssetStringNoFor currencies, you may use this to filter for USD pairs for instance. This field is irrelevant for Stocks.
providerStringDependsFor this integration, use ‘polygon’. Mandatory for everything but ‘crypto’.
providerSecretStringDependsYour Polygon.io issued secret. Mandatory for everything but ‘crypto’.
curl https://us-east.taapi.io/exchange-symbols?secret=MY_TAAPI_SECRET&type=stocks&exchange=XNYS&provider=polygon&providerSecret=MY_POLYGON_SECRET

For a list of Stock Exchanges and their Market Identifier Codes, please visit:

https://www.iso20022.org/market-identifier-codes

  • XNYS: New York Stock Exchange
  • XNAS: Nasdaq

Conclusion

That’s it! Enjoy stocks, forex and options technical analysis! As always, comments and questions are welcome. Happy trading!