Commit Graph

69 Commits

Author SHA1 Message Date
Nicholas Clarke 0abc758cfd Remove expensive historic prices API call 2022-04-14 11:45:24 -07:00
Tyler Shipe 54c5cb10e9 change refresh intervals of v2 2021-09-10 13:00:54 -04:00
Tyler Shipe 63b02b3313 node updates 2021-08-05 17:33:50 -04:00
saml33 ecd9ac4033
Account health calculator (#47)
* 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>
2021-07-19 12:04:04 +02:00
saml33 cfc09fb3c4
User account history (#33)
* 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
2021-06-22 19:50:40 +02:00
saml33 8a59b00347
Stats page alignment (#28)
* 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>
2021-06-22 13:49:52 +02:00
Maximilian Schneider 0d8a6a4143
fix balance calculations (#35) 2021-06-16 16:52:18 -04:00
Maximilian Schneider 3dbbe87ded
fix data issues when switching markets (#31) 2021-06-12 22:03:05 -04:00
Tyler Shipe 3c65fc267e fix bug showing fee rebate in wrong balances col 2021-06-12 17:55:27 -04:00
Tyler Shipe 69bb0e02d3 add back US to countries list 2021-06-12 17:26:56 -04:00
Tyler Shipe 82678a3447 fix net balances 2021-06-12 16:57:09 -04:00
Tyler Shipe 09df840c6a use correct quote net balance 2021-06-12 15:23:15 -04:00
Tyler Shipe f6101964f2 clean up quote balance logic 2021-06-12 14:04:30 -04:00
Tyler Shipe 4476a2254e rebate gui hoster fees to users 2021-06-12 13:46:06 -04:00
Tyler Shipe 821c24fa45 add additional blocked countries 2021-06-10 11:18:13 -04:00
Tyler Shipe f3a86a5a0c combine quote currency balances now that we're showing all markets 2021-06-09 11:52:32 -04:00
Tyler Shipe aa5355e70c fix pnl on accounts page 2021-06-07 13:28:54 -04:00
Tyler Shipe c86ee0157f add 20 sec interval to oracle price updates 2021-06-05 15:38:17 -04:00
Tyler Shipe b67f676383 add useOraclePrice hook and show in market header 2021-06-05 14:40:56 -04:00
Tyler Shipe a1d572048b removed leverage indicator on deposit and withdraw modals 2021-06-05 14:01:00 -04:00
Tyler Shipe eac4adc18f add main action buttons below balances 2021-06-05 12:14:34 -04:00
saml33 3b5f22b815
User account page (#22)
* layout, overview, start on assets, borrows and open orders

* trade history, sortable data hook for tables, borrow page

* handle deposit and withdraw buttons

* borrow modal ui and integration + settle borrow for individual assets

* in orders balance to asset table and totals, responsive css, new connected wallet button + small tweaks

* account switch/creation flow

* accounts modal, update to usebalances hook

* handle settle, deposit before settle, save last account

* disable borrow/withdraw button when no account
2021-06-05 10:11:44 -04:00
Maximilian Schneider 935129c45e
simulate withdraw operation so we can preview equity & coll (#10)
* show margin details in withdraw ui

Co-authored-by: saml33 <slam.uke@gmail.com>
2021-05-18 19:27:09 +03:00
saml33 8e4bd926a7
improve alert modal buttons and fix alerts not loading on connect wallet (#8) 2021-05-10 23:32:21 +03:00
saml33 806b527502
Bring alert details and notifications into the UI (#5)
* hook to get alerts, add triggered alerts to alerts list
* alerts page, count unseen alerts, clear alerts from nav view
* consolidate components, add custom value to alert modal dropdown, sort margin accounts alphanumerically
* ring bell when count increments and ping animation on count
* create/fetch alerts from store, filter by account, populate modal state from triggered alert
* fix alert sorting
* enable MA selection also for re-activate
2021-05-07 22:41:26 +03:00
Tyler Shipe 4f7e1b4990 format srm balances correctly when multiple mango srm accounts exist 2021-05-04 20:00:37 -04:00
Tyler Shipe 02b2fed058 better handle latency from wallet providers 2021-05-04 19:19:48 -04:00
Tyler Shipe 9755aef1be load orderbook for market 2021-05-01 16:30:05 -04:00
Tyler Shipe a0ef8f1e8e better handling of rounding issues in borrow and withdraw 2021-04-29 17:27:13 -04:00
Tyler Shipe 6fbd949b9f Use the vip-api endpoint 2021-04-29 13:42:53 -04:00
Tyler Shipe 3a5040f515 reduce call to rpc endpoint 2021-04-29 11:08:36 -04:00
Tyler Shipe 3ff07f452e combine market state keys 2021-04-29 10:38:28 -04:00
dd 8f07e6b8dd Put fetchMangoGroup on a 20s interval so interest rate changes are reflected in Margin Account summary 2021-04-26 15:17:57 -04:00
Tyler Shipe 16003fd8cf fix recent trades and add update delays after srm deposit and withdraw 2021-04-25 18:57:16 -04:00
Tyler Shipe 526236e46f fix console error with localstorage hook 2021-04-25 13:08:11 -04:00
Tyler Shipe 2d489b29c4 add Lagzda's alerts 2021-04-24 22:10:28 -04:00
Tyler Shipe d9eee98f5e increase refresh intervals 2021-04-21 11:21:00 -04:00
Tyler Shipe 404794575b fetch trade history after margin account is loaded 2021-04-20 17:52:13 -04:00
Tyler Shipe 7c4e913b50 use separate connections for websockets and one off transactions 2021-04-20 17:00:45 -04:00
Tyler Shipe 74d9f70dbf implement withdraw max with borrow 2021-04-20 10:09:25 -04:00
Tyler Shipe ea015a4dc9 fix saved grid layout and add formatting for some large nums 2021-04-17 20:04:18 -04:00
Tyler Shipe 22435a7185 Fix deposit and withdraw modals 2021-04-16 17:09:17 -04:00
Tyler Shipe 8d0019de47 fix for updating after cancel order 2021-04-15 18:45:26 -04:00
Tyler Shipe 50dd3b618e add small ux fixes from alpha feedback 2021-04-15 17:36:55 -04:00
Tyler Shipe efe5698af4 Fix pnl display and better err handling on fetching fills 2021-04-15 15:05:48 -04:00
Tyler Shipe 3160dacb92 fix trade history table 2021-04-15 13:20:24 -04:00
Tyler Shipe faa466ca17 prevent extra rerenders 2021-04-15 02:16:36 -04:00
Tyler Shipe a674ff74d3 texting fixes 2021-04-14 18:46:36 -04:00
Tyler Shipe 96ee9ce664 fix margin balance borrows typo 2021-04-14 14:40:28 -04:00
Tyler Shipe da3072b867 support multiple wallets 2021-04-14 01:23:50 -04:00