Skip to content

Commit a779e5d

Browse files
committed
Comments
1 parent f6bb52f commit a779e5d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

packages/sources/dxfeed/src/transport/stock-quotes.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import { makeLogger } from '@chainlink/external-adapter-framework/util'
12
import { BaseEndpointTypes } from '../endpoint/stock-quotes'
23
import { buildWsTransport } from './ws'
34

5+
const logger = makeLogger('StockQuotesTransport')
6+
47
const eventSymbolIndex = 0
58
const bidTimeIndex = 4
69
const bidPriceIndex = 6
@@ -20,6 +23,7 @@ export const transport = buildWsTransport<BaseEndpointTypes>(
2023
const data = message[0].data[1]
2124

2225
if (data.length != dataLength) {
26+
logger.warn(`${JSON.stringify(data)} is invalid since it doesn't have ${dataLength} fields.`)
2327
return []
2428
}
2529

packages/sources/dxfeed/test/integration/fixtures.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const mockWebSocketServer = (URL: string): MockWebsocketServer => {
6363
},
6464
]
6565

66-
const quoteReponse2 = [
66+
const noBidQuoteReponse = [
6767
{
6868
data: [
6969
'Quote',
@@ -72,7 +72,7 @@ export const mockWebSocketServer = (URL: string): MockWebsocketServer => {
7272
channel: '/service/data',
7373
},
7474
]
75-
const quoteReponse3 = [
75+
const noAskQuoteReponse = [
7676
{
7777
data: [
7878
'Quote',
@@ -81,7 +81,7 @@ export const mockWebSocketServer = (URL: string): MockWebsocketServer => {
8181
channel: '/service/data',
8282
},
8383
]
84-
const quoteReponse4 = [
84+
const invalidQuoteReponse = [
8585
{
8686
data: [
8787
'Quote',
@@ -125,9 +125,9 @@ export const mockWebSocketServer = (URL: string): MockWebsocketServer => {
125125
)
126126
socket.on('message', () => {
127127
socket.send(JSON.stringify(quoteReponse))
128-
socket.send(JSON.stringify(quoteReponse2))
129-
socket.send(JSON.stringify(quoteReponse3))
130-
socket.send(JSON.stringify(quoteReponse4))
128+
socket.send(JSON.stringify(noBidQuoteReponse))
129+
socket.send(JSON.stringify(noAskQuoteReponse))
130+
socket.send(JSON.stringify(invalidQuoteReponse))
131131
socket.send(JSON.stringify(tradeResponse))
132132
})
133133
})

0 commit comments

Comments
 (0)