first commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Niolla
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is proprietary and confidential.
|
||||
* Unauthorized copying, modification, distribution, or use
|
||||
* of this file, via any medium, is strictly prohibited.
|
||||
*/
|
||||
|
||||
// app/utils/basis.util.js
|
||||
|
||||
const calculateBasis = (marginPercent, usdRate) => {
|
||||
if (!usdRate || usdRate <= 0) {
|
||||
throw new Error("Invalid USD rate");
|
||||
}
|
||||
|
||||
const multiplier = (100 + marginPercent) / 100; // e.g. 25% -> 1.25
|
||||
const basis = multiplier / usdRate;
|
||||
|
||||
return Number(basis).toFixed(10);
|
||||
};
|
||||
|
||||
module.exports = { calculateBasis };
|
||||
Reference in New Issue
Block a user