feat(components): add Adanos market sentiment tool - #6645
feat(components): add Adanos market sentiment tool#6645alexander-schneider wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the Adanos API credential and the Adanos Market Sentiment tool, which fetches stock and crypto sentiment from various sources like Reddit, X, financial news, and Polymarket. The reviewer's feedback focuses on improving input validation by moving the symbol format validation from runtime checks inside normalizeSymbol into the Zod schema's superRefine block. This change allows for structured validation feedback for the agent and simplifies the normalizeSymbol function and its invocations.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| .superRefine((input, context) => { | ||
| if ((input.operation === 'stock_sentiment' || input.operation === 'crypto_sentiment') && !input.symbol?.trim()) { | ||
| context.addIssue({ | ||
| code: z.ZodIssueCode.custom, | ||
| message: `symbol is required for ${input.operation}`, | ||
| path: ['symbol'] | ||
| }) | ||
| } |
There was a problem hiding this comment.
Validating the symbol format during the Zod schema parsing phase is highly recommended over throwing a generic runtime error during execution. This ensures that the LLM/agent receives structured validation feedback directly from the schema, improving error handling and reliability.
.superRefine((input, context) => {
if (input.operation === 'stock_sentiment' || input.operation === 'crypto_sentiment') {
if (!input.symbol?.trim()) {
context.addIssue({
code: z.ZodIssueCode.custom,
message: `symbol is required for ${input.operation}`,
path: ['symbol']
})
} else {
const crypto = input.operation === 'crypto_sentiment'
const pattern = crypto ? CRYPTO_PATTERN : STOCK_PATTERN
if (!pattern.test(input.symbol.trim())) {
context.addIssue({
code: z.ZodIssueCode.custom,
message: `Invalid ${crypto ? 'crypto symbol' : 'stock ticker'}`,
path: ['symbol']
})
}
}
}| function normalizeSymbol(value: string, crypto: boolean): string { | ||
| const normalized = value.trim().toUpperCase() | ||
| const pattern = crypto ? CRYPTO_PATTERN : STOCK_PATTERN | ||
| if (!pattern.test(normalized)) { | ||
| throw new Error(`Invalid ${crypto ? 'crypto symbol' : 'stock ticker'}`) | ||
| } | ||
| return normalized.replace(/^\$/, '') | ||
| } |
There was a problem hiding this comment.
With the symbol format validation moved to the Zod schema's superRefine block, normalizeSymbol can be simplified to only handle normalization (trimming, casing, and stripping the leading $), removing the redundant pattern checks and runtime error throwing.
function normalizeSymbol(value: string): string {
return value.trim().toUpperCase().replace(/^\$/, '')
}| path: `/${input.source}/stocks/v1/stock/${normalizeSymbol(input.symbol ?? '', false)}`, | ||
| params | ||
| } | ||
| case 'crypto_sentiment': | ||
| return { | ||
| path: `/reddit/crypto/v1/token/${normalizeSymbol(input.symbol ?? '', true)}`, |
There was a problem hiding this comment.
Simplify the calls to normalizeSymbol since the second parameter (crypto) is no longer needed after moving the pattern validation to the Zod schema.
| path: `/${input.source}/stocks/v1/stock/${normalizeSymbol(input.symbol ?? '', false)}`, | |
| params | |
| } | |
| case 'crypto_sentiment': | |
| return { | |
| path: `/reddit/crypto/v1/token/${normalizeSymbol(input.symbol ?? '', true)}`, | |
| path: `/${input.source}/stocks/v1/stock/${normalizeSymbol(input.symbol ?? '')}`, | |
| params | |
| } | |
| case 'crypto_sentiment': | |
| return { | |
| path: `/reddit/crypto/v1/token/${normalizeSymbol(input.symbol ?? '')}`, |
Summary
Add an optional Adanos Market Sentiment tool for Flowise agents.
API keys can be created at https://adanos.org/register. Endpoint documentation is available at https://api.adanos.org/docs.
Testing
npx --yes --package node@24 --package pnpm@10.28.2 pnpm --filter flowise-components exec jest --runInBand(21 suites, 886 tests passed)npx --yes --package node@24 --package pnpm@10.28.2 pnpm exec eslint packages/components/credentials/AdanosApi.credential.ts packages/components/nodes/tools/AdanosMarketSentiment/AdanosMarketSentiment.ts packages/components/nodes/tools/AdanosMarketSentiment/AdanosMarketSentiment.test.tsnpx --yes --package node@24 --package pnpm@10.28.2 pnpm --filter flowise-components buildgit diff --check