-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
program: scale initial asset weight for spot markets based on total d…
…eposits (#575) * initial logic to scale initial weight * add cargo test * add initial sdk logic * tweak field comments * program: add twap to initial asset weight calc * inital work for worst case to account for free collateral contribution * add strict oracle price * tests work * used cache values from calc worst case token amounts * rm comment * use free collateral contribution in place_spot_order * use strict quote in calculate_perp_position_value_and_pnl * remove w bounds from pnl calc * expand worst case tests * test the twap logic in worst case calc * some simplifications * add some tests for scaled asset weight using twap * make calc max spot order size work * tweak place_spot_order on how it checks if spot order is risk decreasing * always do margin check in place order * log margin type in meets_place_order_margin_requirement * fix a bug * better logic for deciding if trigger order is risk increasing * sdk: rework calculateWorstCaseTokenAmounts * place order params keep track of risk increasing * tweaks * tweak some tests * add some comments * tweak some tests * calculate_max_withdrawable_amount use spot_market.get_asset_weight * fix ts tests * get_asset_weight just takes oracle price * calculateAssetWeight doesn't look at twap * add strictOraclePrice * add strictOraclePrice * add some sdk tests for worst case token amount calc * add is riskier logic to OrderFillSimulation * tweak to sdk * add admin function to update scaleInitialAssetWeightStart * CHANGELOG
- Loading branch information
1 parent
8f835a5
commit 4ebd00b
Showing
32 changed files
with
1,893 additions
and
848 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.