Skip to content

feat(components): add Adanos market sentiment tool - #6645

Open
alexander-schneider wants to merge 2 commits into
FlowiseAI:mainfrom
adanos-software:feature/adanos-market-sentiment
Open

feat(components): add Adanos market sentiment tool#6645
alexander-schneider wants to merge 2 commits into
FlowiseAI:mainfrom
adanos-software:feature/adanos-market-sentiment

Conversation

@alexander-schneider

Copy link
Copy Markdown

Summary

Add an optional Adanos Market Sentiment tool for Flowise agents.

  • adds a password-protected Adanos API credential
  • exposes one structured, read-only agent tool for stock sentiment, crypto sentiment, trending assets, and aggregate market sentiment
  • supports Reddit, X / FinTwit, financial news, and Polymarket for stocks; crypto uses the currently available Reddit endpoints
  • keeps the API host fixed, validates symbols, dates, date ranges, and result limits, and sanitizes upstream errors
  • uses the caller's own Adanos API key and associated plan limits

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.ts
  • npx --yes --package node@24 --package pnpm@10.28.2 pnpm --filter flowise-components build
  • git diff --check

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +33 to +40
.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']
})
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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']
                    })
                }
            }
        }

Comment on lines +52 to +59
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(/^\$/, '')
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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(/^\$/, '')
}

Comment on lines +69 to +74
path: `/${input.source}/stocks/v1/stock/${normalizeSymbol(input.symbol ?? '', false)}`,
params
}
case 'crypto_sentiment':
return {
path: `/reddit/crypto/v1/token/${normalizeSymbol(input.symbol ?? '', true)}`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Simplify the calls to normalizeSymbol since the second parameter (crypto) is no longer needed after moving the pattern validation to the Zod schema.

Suggested change
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 ?? '')}`,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant