Finage

Learn how to use Finage with Composio

Overview

SLUG: FINAGE

Description

Finage provides secure RESTful APIs for real-time and historical financial market data covering stocks, forex, cryptocurrencies, indices, ETFs, and commodities.

Authentication Details

generic_api_key
stringRequired
generic_api_key
stringRequired

Connecting to Finage

Create an auth config

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

1

Select App

Navigate to Finage.

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 Finage 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
4finage_auth_config_id = "ac_YOUR_FINAGE_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": user_api_key}
18 )
19
20 # API Key authentication is immediate - no redirect needed
21 print(f"Successfully connected Finage 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, finage_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 Finage toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["FINAGE"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Get Stock End-of-Day Data

Description

This tool retrieves the end-of-day data for a specific stock symbol. it provides the opening price, highest price, lowest price, closing price, trading volume, and timestamp for the most recent completed trading day, making it essential for investors and analysts seeking daily summary data without intraday details.

Action Parameters

date
string
symbol
stringRequired
unadjusted
booleanDefaults to True

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Stock Historical Data

Description

This tool will fetch historical daily stock data for a given stock symbol between specified dates. it provides ohlcv data (open, high, low, close, volume) and is independent, requiring only the stock symbol, date range inputs, and authentication.

Action Parameters

from_date
stringRequired
limit
integer
multiplier
integerDefaults to 1
sort
string
symbol
stringRequired
time_unit
stringDefaults to day
to_date
stringRequired
unadjusted
boolean

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Stock Last Quote

Description

This tool fetches the latest quote information for a specific stock symbol, providing real-time bid and ask prices, along with their respective sizes and a timestamp. it is essential for trading and market analysis, fetching a json object with details like symbol, ask, bid, asize, bsize, and timestamp.

Action Parameters

symbol
stringRequired
timestamp_type
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Stock Market Aggregates

Description

This tool retrieves aggregated ohlcv (open, high, low, close, volume) data for stocks over specified time periods. it allows users to provide parameters such as stock symbol, time multiplier, aggregation period, start date, and end date to obtain market aggregates.

Action Parameters

dbt_filter
boolean
end_time
string
from_date
stringRequired
limit
integerDefaults to 100
multiply
integerRequired
sort
stringDefaults to asc
start_time
string
symbol
stringRequired
time
stringRequired
to_date
stringRequired
unadjusted
booleanDefaults to True

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Stock Market Snapshot

Description

This tool provides a comprehensive snapshot of the us stock market data, allowing users to get the latest quotes and trades for multiple stocks in a single api request. it is ideal as the first tool because it offers broad market coverage, does not require resource ids or external dependencies, and can be used independently with just api authentication.

Action Parameters

include_quotes
booleanDefaults to True
include_trades
boolean
symbols
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Stock Market Status

Description

This tool retrieves the current market status for various stock exchanges by determining if markets are open or closed. it requires an api key and returns details such as the market type, server time, and next open/close times, which are essential for trade planning and automation.

Action Parameters

country
string
currencies
boolean
extended_hours
boolean
holidays
boolean
trading_hours
boolean

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Stock Previous Close Data

Description

This tool retrieves the previous day's closing data for a specific stock symbol. it provides essential trading information including the opening price, highest price, lowest price, closing price, trading volume, and timestamp for the previous trading day. it complements other finage tools by offering detailed previous day data, which is useful for computing day-over-day change and informing daily trading analysis.

Action Parameters

date
string
symbol
stringRequired
unadjusted
booleanDefaults to True

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Stock Quote

Description

This tool retrieves real-time stock quote information for a given stock symbol. it provides current price, price changes, trading volume, and other key market data.

Action Parameters

symbol
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Stock Market News

Description

This tool retrieves the latest market news from finage's api. it provides comprehensive market news and updates, including news filtering by specific stock symbols, thereby supporting real-time market insights, investment decisions, and research on market trends.

Action Parameters

limit
integerDefaults to 10
symbol
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Stock Tick Data

Description

The stock tick data api provides detailed tick-by-tick trading data for a specific stock symbol. this endpoint is crucial for precise market analysis and high-frequency trading applications.

Action Parameters

dbt_filter
boolean
end_time
string
from_date
stringRequired
limit
integerDefaults to 100
multiply
integerDefaults to 1
sort
stringDefaults to asc
start_time
string
symbol
stringRequired
time
stringRequired
to_date
stringRequired
unadjusted
booleanDefaults to True

Action Response

data
objectRequired
error
string
successful
booleanRequired