Tool Tushare
AI-generatedOverview
This node implements a tool for interacting with the Tushare API, a financial data service. It allows users to specify an API name and provide detailed descriptions of the tool's functionality, input fields, output fields, use cases, parameter filling guides, and example calls. The node generates a structured description of the tool either from a template or a custom string and uses credentials to authenticate API requests. It is useful for fetching financial data such as stock or fund information, enabling scenarios like financial data analysis, report generation, and querying specific financial datasets.
Use Case Examples
- Fetching basic fund information from the 'fund_info' API, including fund code, name, and type.
- Querying stock company data using the 'stock_company' API with parameters like company name or code.
Properties
| Name | Meaning |
|---|---|
| API Name | The name of the Tushare API to call, e.g., 'stock_company'. This is a required string input. |
| Tool Description | Method to describe the tool: either generate from a template or provide a custom string. This controls how the tool's description is constructed. |
| Main Function | A one-sentence description of the tool's main function, required if using template description. |
| Detailed Description | Optional detailed explanation of the tool's function, shown if using template description. |
| Input Fields | A collection of input field descriptions including field name, description, type, and whether required, used to generate the tool description template. |
| Output Fields | A collection of output field descriptions including field name and description, used to generate the tool description template. |
| Use Cases | Optional description of application scenarios for the tool, used in the template description. |
| Parameter Filling Guide | Optional guidance on how to fill parameters, used in the template description. |
| Call Example | Optional example of how to call the API, used in the template description. |
| Custom Description | Directly input a custom tool description string, used if 'Custom String' is selected for tool description. |
| Timeout | Request timeout in milliseconds, defaulting to 30000 (30 seconds). |
Output
JSON
response- An instance of the TushareTool class configured with the API name, description, authentication token, timeout, and input fields. This object is used to perform the API call and fetch data.
Dependencies
- Tushare API token credential
Troubleshooting
- Ensure the tool name is a valid alphanumeric string with underscores and does not start with a number; otherwise, a NodeOperationError is thrown.
- If the API token credential is missing or invalid, the node will fail to authenticate with the Tushare API.
- Timeout errors may occur if the request takes longer than the specified timeout; increase the timeout if necessary.
Links
- Tushare Official Website - Official website for Tushare API documentation and information.
- Tushare API Documentation - Primary documentation for Tushare API endpoints and usage.