From 0506cee2bc6d17348951ec5a397349bf13145427 Mon Sep 17 00:00:00 2001 From: liudecai Date: Sun, 28 Jun 2026 17:07:19 +0000 Subject: [PATCH] init --- .npmignore | 2 ++ .npmrc | 1 + README.md | 36 ++++++++++++++++++++++++++++++++++++ index.js | 29 +++++++++++++++++++++++++++++ package.json | 22 ++++++++++++++++++++++ 5 files changed, 90 insertions(+) create mode 100644 .npmignore create mode 100644 .npmrc create mode 100644 README.md create mode 100644 index.js create mode 100644 package.json diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..17f922e --- /dev/null +++ b/.npmignore @@ -0,0 +1,2 @@ +node_modules +.git diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..dfa51a3 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +//npm.pkg.github.com/:_authToken=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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..6e0bce4 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# Trading Calculators + +Free trading calculators for forex, gold, and crypto traders. + +## Installation +```bash +npm install @liudecai-one/trading-calculators-free +``` + +## Usage +```js +const { positionSize, pipValue, fibonacci } = require('@liudecai-one/trading-calculators-free'); + +// Position size: account=$10K, risk=1%, stop=20 pips +const size = positionSize(10000, 1, 20); +console.log({ size }); // 0.5 lots + +// Fibonacci retracement levels +const fib = fibonacci(1.1200, 1.1000); +console.log({ fib }); +``` + +## Free Web Tools +- [Position Size Calculator](https://blog.quant-view.xyz/tools/position-size-calculator.html) +- [Pip Value Calculator](https://blog.quant-view.xyz/tools/pip-calculator.html) +- [Margin Calculator](https://blog.quant-view.xyz/tools/margin-calculator.html) +- [Fibonacci Calculator](https://blog.quant-view.xyz/tools/fibonacci-calculator.html) +- [ATR Calculator](https://blog.quant-view.xyz/tools/atr-calculator.html) +- [Risk-Reward Calculator](https://blog.quant-view.xyz/tools/risk-reward-calculator.html) +- [Drawdown Calculator](https://blog.quant-view.xyz/tools/drawdown-calculator.html) + +## More Resources +- [Trading Blog](https://blog.quant-view.xyz) +- [GFIL Terminal](http://gfil-intel.xyz/) +- [Telegram Community](https://t.me/GFIL_Trading) +- [Discord Server](https://discord.gg/GMmMCD4MCr) diff --git a/index.js b/index.js new file mode 100644 index 0000000..4aa15c6 --- /dev/null +++ b/index.js @@ -0,0 +1,29 @@ +/** + * Free Trading Calculators + * Web versions: https://blog.quant-view.xyz/tools/ + * Telegram: https://t.me/GFIL_Trading + * Discord: https://discord.gg/GMmMCD4MCr + */ + +function positionSize(accountBalance, riskPercent, stopLossPips, pipValue = 10) { + const riskAmount = accountBalance * (riskPercent / 100); + return parseFloat((riskAmount / (stopLossPips * pipValue)).toFixed(2)); +} + +function pipValue(currencyPair, lotSize = 1) { + const rates = { "EURUSD": 10, "GBPUSD": 10, "USDJPY": 9.3, "XAUUSD": 10 }; + return rates[currencyPair] * lotSize || 10; +} + +function fibonacci(high, low) { + const diff = high - low; + return { + "0.236": high - diff * 0.236, + "0.382": high - diff * 0.382, + "0.500": high - diff * 0.500, + "0.618": high - diff * 0.618, + "0.786": high - diff * 0.786, + }; +} + +module.exports = { positionSize, pipValue, fibonacci }; diff --git a/package.json b/package.json new file mode 100644 index 0000000..c7fc81f --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "@liudecai-one/trading-calculators-free", + "version": "1.0.0", + "description": "Free trading calculators: position size, pip value, margin, Fibonacci, ATR. Web versions at blog.quant-view.xyz/tools/", + "main": "index.js", + "keywords": [ + "trading", + "forex", + "calculator", + "position-size", + "pip-calculator", + "margin-calculator", + "fibonacci", + "atr" + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://gitlab.com/liudecai110/gfil-trading-calculators.git" + }, + "homepage": "https://blog.quant-view.xyz/tools/" +} \ No newline at end of file