Closed quazzuk closed 3 years ago
By running the data collectors (that are used to collect data in https://github.com/crypto-chassis/cryptochassis-data-api-docs, we've noticed that converting json numbers to strings impose a sizable performance penalty. So far each regex was tailored and optimized (to speed up regex matching) to cope with the specifics of each exchange. However indeed there's some commonality which can be refactored into base class.
Describe the bug FTX orderbook sporadically contains entries represented in scientific notation which the quoting regex doesn't handle.
To Reproduce subscribe to FTX market data feed with logging enabled and CCAPI_ENABLE_LOG_ERROR defined.
Expected behavior Numbers represented in scientific notation should be correctly escaped.
Additional context
A quick grep of the codebase shows that some of the exchanges handle this and other don't. Shouldn't this logic be exchange agnostic, as it's based on the json standard for number representation? Below is a link to Doug Crockford's regex for parsing numbers. Perhaps this could be added as a common utility which can then be used across the various exchanges?
https://github.com/douglascrockford/JSON-js/blob/594c8fa5f8e3fb38b0977f1ff8a87e9d709e7db1/json2.js#L166