Skip to content

Commit 2291a6c

Browse files
committed
Rename input
1 parent 0028b70 commit 2291a6c

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

packages/sources/nyfed/src/endpoint/rate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import { httpTransport } from '../transport/rate'
66

77
export const inputParameters = new InputParameters(
88
{
9-
rate: {
9+
symbol: {
1010
required: true,
1111
type: 'string',
1212
description: 'Symbol of the rate you are looking for',
1313
},
1414
},
1515
[
1616
{
17-
rate: 'SOFR',
17+
symbol: 'SOFR',
1818
},
1919
],
2020
)

packages/sources/nyfed/src/transport/rate.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ export const httpTransport = new HttpTransport<HttpTransportTypes>({
4141

4242
return params.map((param) => {
4343
const result = response.data.refRates.find(
44-
(d) => d.type.toUpperCase() == param.rate.toUpperCase(),
44+
(d) => d.type.toUpperCase() == param.symbol.toUpperCase(),
4545
)
46-
if (result == undefined || result.percentRate == undefined) {
46+
if (result?.percentRate == undefined) {
4747
return {
4848
params: param,
4949
response: {
50-
errorMessage: `The data provider didn't return any value for ${param.rate}`,
50+
errorMessage: `The data provider didn't return any value for ${param.symbol}`,
5151
statusCode: 502,
5252
},
5353
}
@@ -60,7 +60,9 @@ export const httpTransport = new HttpTransport<HttpTransportTypes>({
6060
result: result.percentRate,
6161
},
6262
timestamps: {
63-
providerIndicatedTimeUnixMs: new Date(result.effectiveDate).getTime(),
63+
providerIndicatedTimeUnixMs: result.effectiveDate
64+
? new Date(result.effectiveDate).getTime()
65+
: undefined,
6466
},
6567
},
6668
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"requests": [{
3-
"rate": "SOFR"
3+
"symbol": "SOFR"
44
}]
55
}

packages/sources/nyfed/test/integration/adapter.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('execute', () => {
3636
it('should return success', async () => {
3737
mockResponseSuccess()
3838
const response = await testAdapter.request({
39-
rate: 'SOFR',
39+
symbol: 'SOFR',
4040
})
4141
expect(response.statusCode).toBe(200)
4242
expect(response.json()).toMatchSnapshot()

0 commit comments

Comments
 (0)