Fix Rates getTicker endpoint - resolve 404 error

The Strike API /rates/ticker endpoint returns all currency pairs in a single response, not individual pairs. Updated the implementation to:

- Remove incorrect currency pair parameter from endpoint URL
- Fetch all tickers and filter to requested pair client-side
- Add "All Currency Pairs" option to get all rates at once
- Add BTC/AUD and BTC/USDT currency pair options
- Improve error handling when requested pair not found

Fixes 404 "Resource not found" error when using Rates > Get Ticker operation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-10 17:16:30 +01:00
parent a62daa58d0
commit 4ee845e6cd
2 changed files with 25 additions and 2 deletions

View File

@ -503,7 +503,27 @@ export class Strike implements INodeType {
if (resource === 'rates') {
if (operation === 'getTicker') {
const currencyPair = this.getNodeParameter('currencyPair', i) as string;
responseData = await strikeApiRequest.call(this, 'GET', `/rates/ticker/${currencyPair}`);
// The Strike API returns all currency pairs
const allTickers = await strikeApiRequest.call(this, 'GET', '/rates/ticker');
// Filter to the requested currency pair
if (currencyPair && currencyPair !== 'all') {
// Extract source and target currencies (e.g., 'BTCUSD' -> 'BTC' and 'USD')
const sourceCurrency = currencyPair.slice(0, 3);
const targetCurrency = currencyPair.slice(3);
responseData = allTickers.find((ticker: any) =>
ticker.sourceCurrency === sourceCurrency &&
ticker.targetCurrency === targetCurrency
);
if (!responseData) {
responseData = { error: `Currency pair ${currencyPair} not found in available tickers` };
}
} else {
// Return all tickers if 'all' is selected
responseData = allTickers;
}
}
}

View File

@ -32,12 +32,15 @@ export const ratesFields: INodeProperties[] = [
name: 'currencyPair',
type: 'options',
options: [
{ name: 'All Currency Pairs', value: 'all' },
{ name: 'BTC/USD', value: 'BTCUSD' },
{ name: 'BTC/EUR', value: 'BTCEUR' },
{ name: 'BTC/GBP', value: 'BTCGBP' },
{ name: 'BTC/AUD', value: 'BTCAUD' },
{ name: 'BTC/USDT', value: 'BTCUSDT' },
],
default: 'BTCUSD',
description: 'Currency pair for the ticker',
description: 'Currency pair for the ticker. Select "All Currency Pairs" to get rates for all available pairs.',
displayOptions: {
show: {
resource: ['rates'],