TimelordUK / jspurefix

native typescript FIX engine
MIT License
58 stars 27 forks source link

Clean up mathjs dependency usage to fix scoping conflict with decimaljs #10

Closed NiklasZ closed 3 years ago

NiklasZ commented 3 years ago

Hi,

I'm currently using jspurefix for a FIX initiator implementation and created a class FixAdapter extends AsciiSession as shown in the example project. While using it I noticed a bug where the Decimal object used by mathjs (jspurefix dependency) seems to overwrite the Decimal object used by decimaljs (my project dependency). This came to light when another service was trying to deserialize this Decimal and threw the following error:

UnhandledPromiseRejectionWarning: Error: Error while trying to fetch. Original error message: [DecimalError] Invalid argument: [object Object]

where instead of a "1" it contained:

{
  "mathjs": "BigNumber",
  "value": "1"
}

It's a pretty niche case, but can be easily fixed by tweaking the mathjs import, as seen in the PR.

TimelordUK commented 3 years ago

thanks for the fix