Skip to content

wikicrafter/bpnlcalc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โšก B-PNL Calculator

Binance Futures Profit & Loss Calculator - A professional-grade tool for calculating futures trading P&L with accurate formulas and a stunning UI.

Live Demo License

๐Ÿš€ Try it Live


โœจ Features

๐Ÿ“Š Comprehensive Calculations

  • โœ… Long & Short Positions - Support for both position types
  • โœ… Liquidation Price - Know your risk level
  • โœ… Net P&L - Profit after all costs deducted
  • โœ… ROI Percentage - Return on investment display
  • โœ… Accurate Funding - 8-hour interval calculations (matches Binance)
  • โœ… Separate Fees - Entry and exit fees calculated independently

๐ŸŽจ Modern UI/UX

  • ๐ŸŒ‘ Binance-Inspired Dark Theme with golden accents
  • โœจ Glassmorphism Effects and smooth animations
  • ๐ŸŽฏ Color-Coded Results (Green for profit, Red for loss)
  • ๐Ÿ“ฑ Fully Responsive - Works on all devices
  • โšก Fast & Lightweight - No dependencies, runs entirely in browser

๐Ÿ›ก๏ธ Reliability

  • โœ… Input Validation - Prevents calculation errors
  • โœ… Error Handling - User-friendly error messages
  • โœ… Accurate Formulas - Mathematically verified calculations

๐Ÿš€ Quick Start

Simply open index.html in your browser or visit the live demo.

No installation, no dependencies, no build process required!


๐Ÿ“– How to Use

  1. Select Position Type - Choose Long (Buy) or Short (Sell)
  2. Enter Investment - Your initial capital
  3. Set Entry Price - Price at which you enter the position
  4. Set Exit Price - Price at which you exit (or target price)
  5. Choose Leverage - 1x to 125x
  6. Set Duration - Hours you plan to hold the position
  7. Adjust Rates - Funding rate and trading fees (defaults provided)
  8. Calculate - Click the button to see your P&L breakdown

๐Ÿงฎ Calculation Details

Position Size

Position Size = (Initial Investment ร— Leverage) / Entry Price

Profit/Loss

Long Position:

P&L = Position Size ร— (Exit Price - Entry Price)

Short Position:

P&L = Position Size ร— (Entry Price - Exit Price)

Funding Cost

Funding Intervals = floor(Hours Held / 8)
Funding Cost = Position Value ร— (Funding Rate / 100) ร— Intervals

Trading Fees

Entry Fee = Position Value ร— (Trading Fee / 100)
Exit Fee = Exit Value ร— (Trading Fee / 100)
Total Fees = Entry Fee + Exit Fee

Net P&L & ROI

Net P&L = Raw P&L - Total Costs
ROI = (Net P&L / Initial Investment) ร— 100

Liquidation Price

Long Position:

Liquidation = Entry Price ร— (1 - (1/Leverage) + Maintenance Margin Rate)

Short Position:

Liquidation = Entry Price ร— (1 + (1/Leverage) - Maintenance Margin Rate)

Maintenance Margin Rate: 0.4% (standard for most Binance pairs)


๐Ÿ”ง Recent Updates

v2.0 - Major Enhancement (December 2025)

๐Ÿ› Critical Bug Fix

  • Fixed leverage calculation that was using 1 + (leverage/100) instead of direct leverage
  • This bug made all position sizes and P&L calculations incorrect

โœจ New Features

  • Long/Short position support
  • Liquidation price calculator
  • Net P&L after costs
  • ROI percentage display
  • 8-hour funding intervals (previously daily)
  • Input validation and error handling
  • Position size display in contracts

๐ŸŽจ UI Overhaul

  • Complete redesign with Binance-inspired dark theme
  • Golden gradient accents (#f0b90b)
  • Glassmorphism effects with backdrop blur
  • Smooth animations and transitions
  • Color-coded profit/loss indicators
  • Responsive design for mobile
  • Professional typography (Inter font)

๐Ÿ“ Code Quality

  • Separated calculation and display logic
  • Added comprehensive comments
  • Improved code organization
  • Better variable naming

โš ๏ธ Disclaimer

This calculator is for educational and informational purposes only. It provides simplified estimates and may not fully replicate Binance's exact calculations. Always verify results independently before making trading decisions.

NFA & DYOR - Not Financial Advice. Do Your Own Research.


๐Ÿ› ๏ธ Technology Stack

  • HTML5 - Semantic structure
  • CSS3 - Modern styling with animations
  • Vanilla JavaScript - No frameworks, pure JS
  • Google Fonts - Inter font family

๐Ÿ“„ License

MIT License - See LICENSE file for details


๐Ÿค Contributing

Contributions, issues, and feature requests are welcome!


๐Ÿ“ง Contact

Created by @wikicrafter


๐ŸŒŸ Show Your Support

Give a โญ๏ธ if this project helped you!


Happy Trading! ๐Ÿ“ˆ

About

PNL calculation for Futures trading

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages