File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,7 @@ export class CcxtFeed implements BaseDataFeed {
233233
234234 for ( const source of config . sources ) {
235235 const exchange : Exchange = this . exchangeByName . get ( source . exchange ) ;
236+ if ( exchange == undefined ) continue ;
236237 const market = exchange . markets [ source . symbol ] ;
237238 if ( market == undefined ) continue ;
238239 this . logger . log ( `Fetching last price for ${ market . id } on ${ source . exchange } ` ) ;
@@ -268,6 +269,12 @@ export class CcxtFeed implements BaseDataFeed {
268269
269270 // Normalize weights to sum to 1
270271 const weightSum = weights . reduce ( ( sum , weight ) => sum + weight , 0 ) ;
272+
273+ if ( weightSum === 0 ) {
274+ // All prices extremely stale, return any
275+ return prices [ 0 ] . value ;
276+ }
277+
271278 const normalizedWeights = weights . map ( weight => weight / weightSum ) ;
272279
273280 // Combine prices and weights
You can’t perform that action at this time.
0 commit comments