Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cap input quantity, truncate rfq card qty #2344

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SHolleworth
Copy link
Contributor

No description provided.

Copy link

(auto-deploy) A deployment has been created for this Pull Request

Preview links

As part of the code review process, please ensure that you test against the following

Version URL
Web https://web.env.reactivetrader.com/pull/2344
OpenFin - FX fins://openfin.env.reactivetrader.com/pull/2344/config/rt-fx.json
OpenFin - Credit fins://openfin.env.reactivetrader.com/pull/2344/config/rt-credit.json
OpenFin - Launcher fins://openfin.env.reactivetrader.com/pull/2344/config/launcher.json
OpenFin - Workspace fins://openfin.env.reactivetrader.com/pull/2344/workspace/config/workspace.json

Performance

Please ensure that this PR does not degrade the performance of the UI. We should maintain a performance score of 95+.

https://developers.google.com/speed/pagespeed/insights/?url=https://web.env.reactivetrader.com/pull/2344

@@ -72,7 +76,7 @@ const quantity$ = prepareStream$(_quantity$, "").pipe(
const numValue = Math.trunc(Math.abs(parseQuantity(quantity)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion(/later): I would put this whole thing in the util function, or create a new one, and could perhaps simplify If parseQuantity() returns NaN, which it can, then we really catch it as early as possible.
Also, a near dup of code in formatNotional, but that has no Math.trunc() ..

@@ -216,8 +217,10 @@ export const [usePrice, price$] = bind(

const truncated = formatter(inputQuantityAsNumber)

const value = Number(
truncated.replace(filterRegExp, "").replace(decimalRegExp, "."),
const value = applyMaximum(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion re above: some could be extracted to util module (e.g. decimalRegExp is a dup)

@@ -230,3 +230,8 @@ export const parseQuantity = (rawValue: string): number =>
Number(rawValue.replace(filterRegExp, "").replace(decimalRegExp, "."))

export const adjustUserCreditQuantity = (value: number): number => value * 1000

const MAX_INPUT_VALUE = 100000000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: 100 mill, but hard to read, I always use underscores ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants