Polygon

Learn how to use Polygon with Composio

Overview

SLUG: POLYGON

Description

Polygon.io provides real-time and historical market data APIs for stocks, options, forex, and cryptocurrencies.

Authentication Details

generic_api_key
stringRequired

Connecting to Polygon

Create an auth config

Use the dashboard to create an auth config for the Polygon toolkit. This allows you to connect multiple Polygon accounts to Composio for agents to use.

1

Select App

Navigate to Polygon.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Polygon Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using API Key

1from composio import Composio
2
3# Replace these with your actual values
4polygon_auth_config_id = "ac_YOUR_POLYGON_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/app
6
7composio = Composio()
8
9def authenticate_toolkit(user_id: str, auth_config_id: str):
10 # Replace this with a method to retrieve an API key from the user.
11 # Or supply your own.
12 user_api_key = input("[!] Enter API key")
13
14 connection_request = composio.connected_accounts.initiate(
15 user_id=user_id,
16 auth_config_id=auth_config_id,
17 config={"auth_scheme": "API_KEY", "val": {"generic_api_key": user_api_key}}
18 )
19
20 # API Key authentication is immediate - no redirect needed
21 print(f"Successfully connected Polygon for user {user_id}")
22 print(f"Connection status: {connection_request.status}")
23
24 return connection_request.id
25
26
27connection_id = authenticate_toolkit(user_id, polygon_auth_config_id)
28
29# You can verify the connection using:
30connected_account = composio.connected_accounts.get(connection_id)
31print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Polygon toolkit’s playground

For code examples, see the Tool calling guide and Provider examples.

Tool List

Tool Name: Get Aggregates

Description

Tool to fetch custom aggregate OHLCV bars for a stock. Use when you need historical price and volume data aggregated by custom intervals over a date range.

Action Parameters

adjusted
Defaults to True
from_
stringRequired
limit
multiplier
integerRequired
sort
ticker
stringRequired
timespan
stringRequired
to
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get All Tickers

Description

Tool to retrieve all ticker symbols across asset classes. Use when you need to filter by market or exchange and paginate through results.

Action Parameters

active
Defaults to True
cursor
exchange
limit
Defaults to 10
market
order
Defaults to asc
search
sort
ticker

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Crypto Aggregates

Description

Tool to retrieve aggregate bars for a cryptocurrency over a time range. Use when you need to fetch historical bars aggregated by specific time intervals.

Action Parameters

adjusted
Defaults to True
crypto_ticker
stringRequired
from_date
stringRequired
limit
Defaults to 5000
multiplier
integerRequired
sort
timespan
stringRequired
to_date
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Crypto All Tickers Snapshot

Description

Tool to retrieve snapshots for all cryptocurrency tickers. Use when you need a full-market crypto snapshot of the latest values.

Action Parameters

tickers

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Crypto Exchanges

Description

Tool to retrieve a list of cryptocurrency exchanges supported by Polygon. Use after setting locale if needed.

Action Parameters

locale

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Crypto Grouped Daily

Description

Tool to retrieve daily grouped bars for all cryptocurrencies on a specified date. Use when you need a comprehensive end-of-day summary across all crypto tickers.

Action Parameters

adjusted
Defaults to True
date
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Crypto Exponential Moving Average (EMA)

Description

Tool to retrieve Exponential Moving Average (EMA) for a cryptocurrency ticker. Use when you need crypto EMA data for analysis after selecting the time window.

Action Parameters

adjusted
Defaults to True
crypto_ticker
stringRequired
expand_underlying
limit
Defaults to 50
order
Defaults to desc
series_type
stringRequired
timespan
stringRequired
window
integerRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Crypto MACD Indicator

Description

Tool to retrieve the MACD (Moving Average Convergence/Divergence) for a crypto ticker. Use when you need momentum analysis for a specific cryptocurrency after confirming ticker and parameters.

Action Parameters

adjusted
Defaults to True
expand_underlying
limit
Defaults to 50
order
stringDefaults to desc
series_type
Defaults to close
ticker
stringRequired
timespan
stringDefaults to day
window_long
Defaults to 26
window_short
Defaults to 12
window_signal
Defaults to 9

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Crypto RSI Indicator

Description

Tool to retrieve the Relative Strength Index (RSI) for a crypto ticker. Use when you need momentum analysis for crypto assets after specifying ticker, timeframe, and optional parameters.

Action Parameters

adjusted
Defaults to True
limit
Defaults to 100
order
Defaults to desc
series_type
Defaults to close
ticker
stringRequired
timeframe
stringRequired
timestamp
window
Defaults to 14

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Crypto Simple Moving Average (SMA)

Description

Tool to retrieve the Simple Moving Average (SMA) for a given crypto ticker. Use when you need SMA values for a crypto asset after confirming ticker, timespan, and window size.

Action Parameters

adjusted
Defaults to True
crypto_ticker
stringRequired
expand_underlying
limit
Defaults to 5000
order
Defaults to desc
series_type
Defaults to close
timespan
stringRequired
window
integerRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Crypto Last Trade

Description

Tool to retrieve the last trade for a specified cryptocurrency pair. Use when you need the most recent trade details after specifying both symbols.

Action Parameters

from_symbol
stringRequired
to_symbol
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Crypto Open/Close

Description

Tool to fetch daily open and close prices for a given crypto pair on a specified date. Use after specifying both currency symbols and the date.

Action Parameters

base
stringRequired
date
stringRequired
quote
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Crypto Previous Close

Description

Tool to retrieve previous day’s close for a crypto ticker. Use when you need the last closing price of a cryptocurrency before analysis or trading.

Action Parameters

adjusted
Defaults to True
crypto_ticker
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Crypto Ticker Book

Description

Tool to retrieve the full L2 order book for a crypto ticker. Use when you need a snapshot of combined bids and asks for market depth analysis.

Action Parameters

ticker
stringRequired

Action Response

data
objectRequired
error
status
stringRequired
successful
booleanRequired

Tool Name: Get Crypto Trades

Description

Tool to fetch historical trade data for a cryptocurrency ticker. Use when you need tick-level trades within a time range.

Action Parameters

crypto_ticker
stringRequired
limit
Defaults to 1000
order
sort
timestamp
timestamp.gt
timestamp.gte
timestamp.lt
timestamp.lte

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Dividends

Description

Tool to retrieve dividend data for stocks. Use when you need corporate dividend information for specific tickers.

Action Parameters

cash_amount
declaration_date
dividend_type
ex_dividend_date
frequency
limit
order
payment_date
record_date
skip
sort
ticker

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Forex Aggregates

Description

Tool to retrieve aggregate bars for a forex pair over a date range. Use when you need custom OHLC bars for forex currency pairs within specified time span.

Action Parameters

adjusted
Defaults to True
forex_ticker
stringRequired
from_
stringRequired
limit
multiplier
integerRequired
sort
timespan
stringRequired
to
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Forex Grouped Daily Bars

Description

Tool to retrieve daily grouped OHLC bars for all forex currency pairs on a specified date. Use when you need aggregated forex data after confirming the date parameter.

Action Parameters

adjusted
Defaults to True
date
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Forex Historical Quotes

Description

Tool to retrieve historical forex quotes for a currency pair over a time range. Use when you need bid/ask quotes for an FX ticker between timestamps or dates. Use after confirming the forex ticker symbol.

Action Parameters

fxTicker
stringRequired
limit
Defaults to 1000
order
sort
timestamp
timestamp.gt
timestamp.gte
timestamp.lt
timestamp.lte

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Forex Locales

Description

Tool to list locales supported by Polygon's forex asset class. Use when you need available locale codes for regional filtering in FX endpoints.

Action Parameters

asset_class

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Forex Market Holidays

Description

Tool to retrieve upcoming forex market holidays. Use when you need a forecast of future FX market closures and hours before scheduling trades.

Action Parameters

Action Response

data
arrayRequired
error
successful
booleanRequired

Tool Name: Get Forex Markets

Description

Tool to retrieve a list of exchanges available for the forex (FX) asset class. Uses the Polygon v3 reference exchanges endpoint.

Action Parameters

cursor
limit
locale

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Forex Market Status

Description

Tool to retrieve current forex market status. Use when you need to know if the forex market is open or closed.

Action Parameters

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Forex Previous Close

Description

Tool to retrieve previous day's close for a forex ticker. Use when you need the last closing price of a forex currency pair before analysis or trading.

Action Parameters

adjusted
Defaults to True
forexTicker
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Forex Snapshot Losers

Description

Tool to retrieve the current snapshot of the top losers in the forex market. Use when you need up-to-date information on the worst-performing forex pairs.

Action Parameters

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Forex Ticker Details

Description

Tool to retrieve detailed information for a forex ticker. Use when you need an overview of a currency pair including market and asset data.

Action Parameters

date
ticker
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Futures Aggregates

Description

Tool to retrieve historical OHLCV aggregates for a futures contract. Use when you need aggregated price and volume data for a futures contract over specified time windows.

Action Parameters

limit
resolution
sort
ticker
stringRequired
window_start.gte
window_start.lte

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Futures Products

Description

Tool to retrieve a comprehensive list of futures products with advanced filtering. Use when you need to filter futures listings by date, sector, exchange, or type.

Action Parameters

as_of
asset_class
asset_sub_class
limit
integerDefaults to 100
name
name_search
sector
sort
sub_sector
trading_venue
type
stringDefaults to all

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Futures Product Schedules

Description

Tool to retrieve trading schedules for a futures product. Use when you need daily trading session schedules for a given product code.

Action Parameters

limit
Defaults to 100
product_code
stringRequired
session_end_date
sort

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Futures Quotes

Description

Tool to retrieve real-time quote data for a specified futures contract ticker. Use after confirming the exact futures ticker identifier (e.g., 'GCJ5').

Action Parameters

limit
session_end_date
sort
ticker
stringRequired
timestamp

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Futures Schedules

Description

Tool to retrieve futures trading schedules. Use when you need trading schedules for all futures contracts on a specific date.

Action Parameters

limit
session_end_date
sort
trading_venue

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Futures Trades

Description

Tool to retrieve tick-level trade data for a specified futures contract. Use when you need detailed trade data over a time range.

Action Parameters

limit
Defaults to 1000
session_end_date
session_end_date.gt
session_end_date.gte
session_end_date.lt
session_end_date.lte
sort
ticker
stringRequired
timestamp
timestamp.gt
timestamp.gte
timestamp.lt
timestamp.lte

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Upcoming Market Holidays

Description

Tool to retrieve upcoming market holidays and half-day closures. Use when you need to look up upcoming exchange holidays and early closures.

Action Parameters

Action Response

data
arrayRequired
error
successful
booleanRequired

Tool Name: Get Market Status

Description

Tool to retrieve current market status. Use when you need to know if U.S. exchanges are open, closed, or on holiday.

Action Parameters

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get News

Description

Tool to retrieve recent news articles related to a ticker. Use when you need to fetch financial news after identifying a ticker symbol.

Action Parameters

cursor
limit
order
published_utc.gte
published_utc.lte
sort
ticker

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Stock Open/Close

Description

Tool to fetch daily open and close prices for a stock on a specific date. Use when you need daily OHLC with pre/post-market prices.

Action Parameters

adjusted
booleanDefaults to True
date
stringRequired
stocksTicker
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Option Aggregates

Description

Tool to fetch custom OHLCV bars for an options contract over a time range. Use when you need to analyze option price movements at regular intervals.

Action Parameters

adjusted
Defaults to True
from
stringRequired
limit
multiplier
integerRequired
option_ticker
stringRequired
sort
timespan
stringRequired
to
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Option Chain Snapshot

Description

Tool to fetch a real-time snapshot of all option contracts for an underlying asset. Use after selecting the underlying ticker to retrieve live option chain data.

Action Parameters

contract_type
expiration_date
limit
order
sort
strike_price
underlying_ticker
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Option Contract Details

Description

Tool to retrieve detailed information about a specific options contract. Use when you need a comprehensive overview of contract specifications by ticker, optionally as of a specific date.

Action Parameters

as_of
contract
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Option Contracts

Description

Tool to list option contracts with filters. Use when you need to discover or page through option contracts by ticker, expiration, strike, or point-in-time.

Action Parameters

as_of
contract_type
Required
expiration_date
expired
limit
Defaults to 10
order
sort
strike_price
ticker
underlying_ticker

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Option Snapshot

Description

Tool to retrieve a real-time snapshot for a single option contract. Use when you need up-to-the-minute quotes, trades, greeks, and metrics for a specified option contract.

Action Parameters

option_contract
stringRequired
underlying_asset
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Previous Close

Description

Tool to get previous trading day’s OHLC and volume for a stock. Use when you need the last day’s open, high, low, close, and volume for a given ticker.

Action Parameters

adjusted
Defaults to True
ticker
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get reference conditions

Description

Tool to retrieve market condition code mappings. Use when you need definitions of trade or quote condition codes after confirming asset class and data type.

Action Parameters

asset_class
data_type
id

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get reference exchanges

Description

Tool to retrieve supported exchanges and their details. Use when you need a list of exchanges filtered by asset class or locale.

Action Parameters

asset_class
locale

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get All Stock Tickers Snapshot

Description

Tool to retrieve the current market snapshot for all stock tickers. Use when you need real-time OHLCV, trades, and quotes across the entire US stock market in one call.

Action Parameters

include_otc
boolean
tickers

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Stock Snapshot Losers

Description

Tool to retrieve the current snapshot of the top losers in the U.S. stock market. Use when you need up-to-date information on the worst-performing stocks.

Action Parameters

include_otc

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Stock Snapshot Ticker

Description

Tool to retrieve the current snapshot of a specific stock ticker. Use when you need the most recent market snapshot after specifying the ticker symbol.

Action Parameters

ticker
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Stock Splits

Description

Tool to retrieve stock split events. Use when you need corporate stock split data filtered by ticker or date range. Example: "Get splits for AAPL between 2021-01-01 and 2021-12-31".

Action Parameters

execution_date.gte
execution_date.lte
limit
order
sort
ticker

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Exponential Moving Average (EMA)

Description

Tool to fetch Exponential Moving Average (EMA) for a given stock ticker. Use when you need historical EMA data after confirming ticker, timespan, and window size.

Action Parameters

adjusted
Defaults to True
expand_underlying
limit
Defaults to 50
order
Defaults to desc
series_type
Defaults to close
ticker
stringRequired
timespan
stringRequired
window
integerRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Simple Moving Average (SMA)

Description

Tool to fetch Simple Moving Average (SMA) for a given stock ticker. Use when you need historical SMA data after confirming ticker, timespan, and window size.

Action Parameters

adjusted
Defaults to True
expand_underlying
limit
Defaults to 50
order
Defaults to desc
series_type
Defaults to close
ticker
stringRequired
timespan
stringRequired
window
integerRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Ticker Details

Description

Tool to retrieve detailed information for a ticker. Use when you need an overview of a ticker including company info, market data, and identifiers.

Action Parameters

date
ticker
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Ticker Events

Description

Tool to retrieve corporate events for a specific ticker. Use when you need the timeline of corporate actions for a given ticker.

Action Parameters

ticker
stringRequired
types

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Ticker Types

Description

Tool to retrieve all ticker types supported by Polygon.io. Use after authenticating to explore ticker categories.

Action Parameters

asset_class
limit
offset
type

Action Response

data
objectRequired
error
successful
booleanRequired