Title: Support for ES Module Import in @quantlib/ql
Description:
I encountered an error while predicting the next price using the @quantlib/ql library. The error message indicates that the ES Module is not supported with the require() function. Below are the details of the error:
Error predicting next price: Error [ERR_REQUIRE_ESM]: require() of ES Module ..\node_modules\@quantlib\ql\ql.mjs not supported.
Instead change the require of ..\node_modules\@quantlib\ql\ql.mjs to a dynamic import() which is available in all CommonJS modules.
at ..\dist\src\modules\quant_trading\test.service.js:70:103
at async TestBinanceService.predictNextPrice (..\dist\src\modules\quant_trading\test.service.js:70:30)
at async QuantTradingController.tbinancePredictNextPrice (..\dist\src\modules\quant_trading\quant_trading.controller.js:40:16) {
code: 'ERR_REQUIRE_ESM'
}
Steps to Reproduce:
Attempt to use the @quantlib/ql library in a CommonJS module.
Call the predictNextPrice function.
Observe the error.
Expected Behavior:
The library should support dynamic import for ES Modules when used in CommonJS modules.
Actual Behavior:
The library throws an error indicating that require() of ES Module is not supported.
Suggested Solution:
Update the library to support dynamic import for ES Modules. This can be done by replacing the require() statements with dynamic import() statements.
Environment:
Node.js version: [v21.7.3]
@quantlib/ql version: [0.3.6]
Additional Context:
Here is the stack trace for reference:
❌ [ExceptionFilter][error] - [2024-09-18 04:31:58]: Body: {}
❌ [ExceptionFilter][error] - [2024-09-18 04:31:58]: Query: {"symbol":"BTCUSDT","interval":"5m","predictionInterval":"1440","predictionCount":"100"}
❌ [ExceptionFilter][error] - [2024-09-18 04:31:58]: Params: {}
❌ [ExceptionFilter][Error] - [2024-09-18 04:31:58]: [Error] require() of ES Module ..\node_modules\@quantlib\ql\ql.mjs not supported.
Instead change the require of ..\node_modules\@quantlib\ql\ql.mjs to a dynamic import() which is available in all CommonJS modules.{ code: 'ERR_REQUIRE_ESM', [Symbol(level)]: 'error' }
Stack Trace:
Error [ERR_REQUIRE_ESM]: require() of ES Module ..\node_modules\@quantlib\ql\ql.mjs not supported.
Instead change the require of ..\node_modules\@quantlib\ql\ql.mjs to a dynamic import() which is available in all CommonJS modules.
at ..\dist\src\modules\quant_trading\test.service.js:70:103
at async TestBinanceService.predictNextPrice (..\dist\src\modules\quant_trading\test.service.js:70:30)
at async QuantTradingController.tbinancePredictNextPrice (..\dist\src\modules\quant_trading\quant_trading.controller.js:40:16)
Title: Support for ES Module Import in
@quantlib/ql
Description:
I encountered an error while predicting the next price using the
@quantlib/ql
library. The error message indicates that the ES Module is not supported with therequire()
function. Below are the details of the error:Steps to Reproduce:
@quantlib/ql
library in a CommonJS module.predictNextPrice
function.Expected Behavior: The library should support dynamic import for ES Modules when used in CommonJS modules.
Actual Behavior: The library throws an error indicating that
require()
of ES Module is not supported.Suggested Solution: Update the library to support dynamic import for ES Modules. This can be done by replacing the
require()
statements with dynamicimport()
statements.Environment:
@quantlib/ql
version: [0.3.6]Additional Context: Here is the stack trace for reference: