mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -08:00
⚡ Small fixes on CoinGecko-Node
This commit is contained in:
parent
6cede362e4
commit
4fdf255dc5
|
@ -113,6 +113,50 @@ export const coinFields = [
|
|||
placeholder: 'bitcoin',
|
||||
description: 'Coin ID',
|
||||
},
|
||||
{
|
||||
displayName: 'Base Currency',
|
||||
name: 'baseCurrency',
|
||||
required: true,
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCoins',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
|
||||
operation: [
|
||||
'candlestick',
|
||||
],
|
||||
resource: [
|
||||
'coin',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The first currency in the pair. For BTC:ETH this is BTC.',
|
||||
},
|
||||
{
|
||||
displayName: 'Base Currency',
|
||||
name: 'baseCurrency',
|
||||
required: true,
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCurrencies',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
|
||||
operation: [
|
||||
'market',
|
||||
],
|
||||
resource: [
|
||||
'coin',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The first currency in the pair. For BTC:ETH this is BTC.',
|
||||
},
|
||||
{
|
||||
displayName: 'Coin ID',
|
||||
name: 'coinId',
|
||||
|
@ -126,7 +170,6 @@ export const coinFields = [
|
|||
operation: [
|
||||
'ticker',
|
||||
'history',
|
||||
'candlestick',
|
||||
],
|
||||
resource: [
|
||||
'coin',
|
||||
|
@ -138,8 +181,8 @@ export const coinFields = [
|
|||
description: 'Coin ID',
|
||||
},
|
||||
{
|
||||
displayName: 'Coin IDs',
|
||||
name: 'coinIds',
|
||||
displayName: 'Base Currencies',
|
||||
name: 'baseCurrencies',
|
||||
required: true,
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
|
@ -160,7 +203,7 @@ export const coinFields = [
|
|||
},
|
||||
default: [],
|
||||
placeholder: 'bitcoin',
|
||||
description: 'ID of coins, comma-separated. Refers to Coin / GetAll.',
|
||||
description: 'The first currency in the pair. For BTC:ETH this is BTC.',
|
||||
},
|
||||
{
|
||||
displayName: 'Platform ID',
|
||||
|
@ -272,9 +315,8 @@ export const coinFields = [
|
|||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'market',
|
||||
'marketChart',
|
||||
'candlestick',
|
||||
'marketChart',
|
||||
],
|
||||
resource: [
|
||||
'coin',
|
||||
|
@ -285,8 +327,8 @@ export const coinFields = [
|
|||
description: 'The second currency in the pair. For BTC:ETH this is ETH.',
|
||||
},
|
||||
{
|
||||
displayName: 'Currencies',
|
||||
name: 'currencies',
|
||||
displayName: 'Quote Currencies',
|
||||
name: 'quoteCurrencies',
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCurrencies',
|
||||
|
@ -303,10 +345,10 @@ export const coinFields = [
|
|||
},
|
||||
},
|
||||
default: [],
|
||||
description: 'Currencies of coin.',
|
||||
description: 'The second currency in the pair. For BTC:ETH this is ETH.',
|
||||
},
|
||||
{
|
||||
displayName: 'Historical Range (days)',
|
||||
displayName: 'Range (days)',
|
||||
name: 'days',
|
||||
required: true,
|
||||
type: 'options',
|
||||
|
|
|
@ -238,10 +238,10 @@ export class CoinGecko implements INodeType {
|
|||
if (operation === 'market') {
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
const quoteCurrency = this.getNodeParameter('quoteCurrency', i) as string;
|
||||
const baseCurrency = this.getNodeParameter('baseCurrency', i) as string;
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
|
||||
qs.vs_currency = quoteCurrency;
|
||||
qs.vs_currency = baseCurrency;
|
||||
|
||||
Object.assign(qs, options);
|
||||
|
||||
|
@ -278,17 +278,17 @@ export class CoinGecko implements INodeType {
|
|||
if (operation === 'price') {
|
||||
|
||||
const searchBy = this.getNodeParameter('searchBy', i) as string;
|
||||
const currencies = this.getNodeParameter('currencies', i) as string[];
|
||||
const quoteCurrencies = this.getNodeParameter('quoteCurrencies', i) as string[];
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
|
||||
qs.vs_currencies = currencies.join(',');
|
||||
qs.vs_currencies = quoteCurrencies.join(',');
|
||||
|
||||
Object.assign(qs, options);
|
||||
|
||||
if (searchBy === 'coinId') {
|
||||
const coinIds = this.getNodeParameter('coinIds', i) as string[];
|
||||
const baseCurrencies = this.getNodeParameter('baseCurrencies', i) as string[];
|
||||
|
||||
qs.ids = coinIds.join(',');
|
||||
qs.ids = baseCurrencies.join(',');
|
||||
|
||||
responseData = await coinGeckoApiRequest.call(
|
||||
this,
|
||||
|
@ -424,7 +424,7 @@ export class CoinGecko implements INodeType {
|
|||
//https://www.coingecko.com/api/documentations/v3#/coins/get_coins__id__ohlc
|
||||
if (operation === 'candlestick') {
|
||||
|
||||
const coinId = this.getNodeParameter('coinId', i) as string;
|
||||
const baseCurrency = this.getNodeParameter('baseCurrency', i) as string;
|
||||
const quoteCurrency = this.getNodeParameter('quoteCurrency', i) as string;
|
||||
const days = this.getNodeParameter('days', i) as string;
|
||||
|
||||
|
@ -434,7 +434,7 @@ export class CoinGecko implements INodeType {
|
|||
responseData = await coinGeckoApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/coins/${coinId}/ohlc`,
|
||||
`/coins/${baseCurrency}/ohlc`,
|
||||
{},
|
||||
qs
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue