* estimate liquidation price
* make space for elp in margininfo
* display N/A if account won't be liq'd
ensure recalculation on market change
Co-authored-by: dboures <dboures@att.net>
* create calculator page
* page layout
* Link Input Fields and Formuals
Linked up the inputs and added the calculations.
State objects/functions are not optimized, as they were built one by one to make sure each was working. Once all components are working, this should be refined.
* Slider Fixes, Additional Details
Fixed slider to manipulate all prices equally instead of collateral.
Added additional information to scenario details: Min Collateral Ratio, Risk rating, and Percent move to liquidation.
* Negative number handling
Updated details to zero out negative equity or leverage, as neither should occur.
* Update liquidation-calculator.tsx
- Updated handling of state by asset instead of action (BTC.deposit instead of deposit.BTC)
- Fixed slider percentage lag (was one state change behind)
- Cleaned up handling of scenario liquidation
- Handling of some dust borrows/NaN calculations found in testing
* Handling User Input (decimal / sign first)
Delaying update of state until a number is present (allows decimal place or sign to be entered).
Convert user inputs into absolute values to avoid unwanted calculator output (such as a double negative).
* Added Calculator For Disconnected State
- Added ability to use liquidation calculator without requiring user to connect a wallet.
- Fixed rounding of prices during slider manipulation and out of focus.
- Reset slider position when price inputs are in focus (erroneous calculations when manually inputting price with slider at percentages other than 100%)
* responsive, layout tweaks and link from trade page
* Account Switching Reload & Leverage Rounding Fix
Switching margin accounts now triggers the Risk Calculator to reload balances.
Rounding method for calculations standardized to floorToDecimal to remove borrow rounding errors causing incorrect leverage calculations.
* fix typo
* Update Slider & Price Input Behavior
Updated slider & price input behavior after receiving some feedback from Sam and Dboures about price input field and slider interaction.
Originally clicking on the price input would reset the slider and return the prices in the input form back to the reference prices held in state, Now when the slider is in use, users can click on a price input and the price and slider will remain in the same position. If a change is made, the reference prices of all assets will be updated to their currently displayed value and the slider will be reset. If no changes are made, the reference prices remain unchanged and the slider remains at it's current setting.
* Update collateral ratio rounding & liquidation message criteria
Co-authored-by: ImpossiblePairs <47860274+ImpossiblePairs@users.noreply.github.com>
Co-authored-by: dboures <dboures@att.net>
* leaderboard layout
* hook up pnl endpoint
* api limits, offset and start_date
* pnl history charts
* support account names
* ui feedback updates
* play with leaderboard 🙈
* fix chart bug
Co-authored-by: Maximilian Schneider <mail@maximilianschneider.net>
* handle account names on account page
* handle name in new account form
* handle marginbalances, responsive
* Add account name uses smart contract
* remove localStorage account name references
* adjust name validation message and label name as public
* new accounts are initialized with names
Co-authored-by: saml33 <slam.uke@gmail.com>
Co-authored-by: Tyler Shipe <tjshipe@gmail.com>
* Make orderbook size change dynamically with layout
This change causes the depth value passed to the orderbook component to change in response to the height of the resizable container.
This allows users to show more or less of the depth of the orderbook depending on their preference.
Old behavior was to always show a depth of 8 rows regardless of the size of the container.
* revert changes to yarn.lock
* adjust depth formula, add assymetric depth in vertical mode
The depth of the orderbook now more closely matches the size of the container.
The scrollbar has also been disabled in the orderbook panel to enable the space to be used as efficiently as possible without the annoyance of the scrollbar appearing.
The vertical orientation of the orderbook now allows an odd number of ask rows and an even number of bid rows if it is able to use more of the available space.
* Make orderbook depth adjust on breakpoint change
Add orderbookDepth state which is managed by onBreakpointChange and onLayoutChange functions.
* Add orderbookDepth value to useMangoStore
* Simplify state management and move orderbook adjustments into useEffect
Remove orderbook state object from useMangoStore
This change solves the issue of the orderbook not adjusting on a new session, as well eliminates instances of repeated calls to adjustOrderBook()
* Fix lodash compile errors
* Updated Margin Info Tile Card
Minor UI update to provide more actionable information on Margin Collateral Information.
* Removed formula error
Removed division of collateral dollars by 100
* update margin info
* fix margin info height and connect wallet empty state
Co-authored-by: ImpossiblePairs <47860274+ImpossiblePairs@users.noreply.github.com>
Co-authored-by: Maximilian Schneider <mail@maximilianschneider.net>
* deposit/withdraw table
* liquidations table and details
* connect to api data
* move history data to store
* nicks feedback on liquidations
* update history endpoint url
* update history when account changes
* total deposit/borrow value charts, new chart styles
* responsive and bar chart
* reduce icon size to match trade page
* round large numbers
* use historic prices for total deposits/borrows
* fix lint errors
* use current price if no match from prices api
* fix data passed to borrow chart
* update prices endpoint url
Co-authored-by: Maximilian Schneider <mail@maximilianschneider.net>