Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Perpetual]: add stop loss price #759

Merged
merged 14 commits into from
Sep 10, 2024
Merged

Conversation

cryptokage1996
Copy link
Contributor

@cryptokage1996 cryptokage1996 commented Aug 30, 2024

Add message to update the stop loss of a given position.

@cryptokage1996 cryptokage1996 marked this pull request as ready for review September 2, 2024 08:38
Copy link

codecov bot commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 47.36842% with 60 lines in your changes missing coverage. Please review.

Project coverage is 43.08%. Comparing base (3eca470) to head (b3e2e59).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #759      +/-   ##
==========================================
+ Coverage   43.06%   43.08%   +0.01%     
==========================================
  Files         637      640       +3     
  Lines       20900    21005     +105     
==========================================
+ Hits         9001     9049      +48     
- Misses      10830    10882      +52     
- Partials     1069     1074       +5     
Components Coverage Δ
leveragelp_transactions 93.13% <ø> (ø)
leveragelp_lifecycle 88.29% <ø> (ø)
leveragelp_keeper 86.58% <ø> (ø)
leveragelp_queries 19.28% <ø> (ø)
accountedpool_transactions 100.00% <ø> (ø)
accountedpool_lifecycle ∅ <ø> (∅)
accountedpool_queries 68.42% <ø> (ø)
amm_transactions 57.93% <ø> (ø)
amm_lifecycle 79.16% <ø> (ø)
amm_keeper 61.13% <ø> (ø)
amm_queries 29.94% <ø> (ø)
assetprofile_transactions 78.82% <ø> (ø)
assetprofile_lifecycle ∅ <ø> (∅)
assetprofile_keeper 83.33% <ø> (ø)
assetprofile_queries 47.41% <ø> (ø)
burner_transactions 0.00% <ø> (ø)
burner_lifecycle ∅ <ø> (∅)
burner_keeper 100.00% <ø> (ø)
burner_queries 63.54% <ø> (ø)
clock_transactions 30.00% <ø> (ø)
clock_lifecycle ∅ <ø> (∅)
clock_keeper 76.92% <ø> (ø)
clock_queries ∅ <ø> (∅)
commitment_transactions 48.95% <ø> (ø)
commitment_lifecycle ∅ <ø> (∅)
commitment_keeper 19.60% <ø> (ø)
commitment_queries 9.33% <ø> (ø)
epochs_transactions ∅ <ø> (∅)
epochs_lifecycle 100.00% <ø> (ø)
epochs_keeper 81.81% <ø> (ø)
epochs_queries 85.71% <ø> (ø)
estaking_transactions 48.64% <ø> (ø)
estaking_lifecycle 71.23% <ø> (ø)
estaking_keeper 63.05% <ø> (ø)
estaking_queries 55.31% <ø> (ø)
incentive_transactions 0.00% <ø> (ø)
incentive_lifecycle ∅ <ø> (∅)
incentive_keeper 0.00% <ø> (ø)
incentive_queries ∅ <ø> (∅)
masterchef_transactions 62.12% <ø> (ø)
masterchef_lifecycle 73.50% <ø> (ø)
masterchef_keeper 89.47% <ø> (ø)
masterchef_queries 45.97% <ø> (ø)
oracle_transactions 31.91% <ø> (ø)
oracle_lifecycle 0.00% <ø> (ø)
oracle_keeper 63.88% <ø> (ø)
oracle_queries 34.90% <ø> (ø)
parameter_transactions 15.11% <ø> (ø)
parameter_lifecycle ∅ <ø> (∅)
parameter_keeper 75.00% <ø> (ø)
parameter_queries 60.00% <ø> (ø)
stablestake_transactions 73.91% <ø> (ø)
stablestake_lifecycle 75.00% <ø> (ø)
stablestake_keeper 71.42% <ø> (ø)
stablestake_queries 13.04% <ø> (ø)
tier_transactions 28.57% <ø> (ø)
tier_lifecycle 100.00% <ø> (ø)
tier_keeper 90.47% <ø> (ø)
tier_queries 19.67% <ø> (ø)
tokenomics_transactions 72.32% <ø> (ø)
tokenomics_lifecycle ∅ <ø> (∅)
tokenomics_keeper 83.33% <ø> (ø)
tokenomics_queries 70.96% <ø> (ø)
transferhook_transactions ∅ <ø> (∅)
transferhook_lifecycle ∅ <ø> (∅)
transferhook_keeper 100.00% <ø> (ø)
transferhook_queries 60.00% <ø> (ø)

@cosmic-vagabond
Copy link
Contributor

@cryptokage1996 can you provide test results?

@amityadav0
Copy link
Contributor

I see we are only setting stop loss value, shouldn't we add logic for stop loss trigger ? when this will trigger ?

  • When custody amount hits stop loss or is there any other variable ?

@cryptokage1996
Copy link
Contributor Author

I see we are only setting stop loss value, shouldn't we add logic for stop loss trigger ? when this will trigger ?

  • When custody amount hits stop loss or is there any other variable ?

in the ticket it is not mentioned to close position when stop loss is hit, should i do it like we do for leveragelp @amityadav0

Copy link
Contributor

@amityadav0 amityadav0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cosmic-vagabond
Copy link
Contributor

@cryptokage1996 @amityadav0 I agree without the ABCI logic for trigger the stop loss (closing of the position) it will be useful at all, is there any reason we are ommiting that part?

@cryptokage1996
Copy link
Contributor Author

@cryptokage1996 @amityadav0 I agree without the ABCI logic for trigger the stop loss (closing of the position) it will be useful at all, is there any reason we are ommiting that part?

@cosmic-vagabond there is a new ticket to implement this

@cosmic-vagabond
Copy link
Contributor

@cryptokage1996 the software upgrade test is failing due to a module migration error see here https://github.com/elys-network/elys/actions/runs/10771967355/job/29870663829?pr=759

@cryptokage1996
Copy link
Contributor Author

cryptokage1996 commented Sep 10, 2024

@cryptokage1996 the software upgrade test is failing due to a module migration error see here https://github.com/elys-network/elys/actions/runs/10771967355/job/29870663829?pr=759

@cosmic-vagabond i dont know whats the issue here , code is fine i updated the registry and added migration from v6 to v7 it is still looking for v5 to v6 migration. i think this is issue bcoz the previous pr has migration in same module(perpetual) could be the reason , also iam not totally sure. @amityadav0 @avkr003 can your help here.is there anything iam missing? Thanks!

@avkr003
Copy link
Contributor

avkr003 commented Sep 10, 2024

@cryptokage1996 Multiple migrations are happening here, and your code is skipping one version.
err := cfg.RegisterMigration(types.ModuleName, 5, m.V6Migration) if err != nil { panic(err) }
Do not remove this. And add your code next to it:
err := cfg.RegisterMigration(types.ModuleName, 6, m.V7Migration) if err != nil { panic(err) }
Or,
You can add code in m.V7Migration to m.V6Migration at the end and remove .V7Migration and consensus version back to 6

image

@cosmic-vagabond cosmic-vagabond merged commit 36e81ad into main Sep 10, 2024
70 of 71 checks passed
@cosmic-vagabond cosmic-vagabond deleted the feat/update_stop_loss branch September 10, 2024 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants