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

3-coin crypto pool #159

Merged
merged 121 commits into from
Jul 26, 2023
Merged

3-coin crypto pool #159

merged 121 commits into from
Jul 26, 2023

Conversation

chanhosuh
Copy link
Member

@chanhosuh chanhosuh commented Jul 11, 2023

Closes #91

The goal is to do only what is required to get reliable crypto sims going, as we expect there will be a lot of work to tune the sims to reflect accurate repegging and other timing issues.

This means that cryptopools only need:

  • exchange
  • tweak_price
  • dydx

The SimPool wrapper will only need these to do crypto sims.

Some further work remains:

  • cleanup code, including branching on n_coins (if possible)
  • fully testing exchange under more conditions, especially swap sequences, and checking repegs
  • Speedup calcs using gmpy2
  • increase coverage
  • changelog entry

Bonus!

  • Parallelized pytest (shaving 5 minutes off(!) to go from around 16 minutes total CI time to around 11)
    (Cherry-picked into main)

@github-actions
Copy link
Contributor

github-actions bot commented Jul 11, 2023

Coverage report

The coverage rate went from 74.67% to 75.29% ⬆️
The branch rate is 63%.

84.57% of new lines are covered.

Diff Coverage details (click to unfold)

curvesim/pool/cryptoswap/pool.py

85.55% of new lines are covered (83.93% of the complete file).
Missing lines: 157, 178, 189, 201, 202, 203, 205, 322, 449, 589, 695, 715, 716, 717, 719, 721, 722, 723, 725, 726, 728, 928, 1009, 1026, 1038, 1060

curvesim/pool/cryptoswap/calcs/factory_2_coin.py

76.05% of new lines are covered (70.2% of the complete file).
Missing lines: 40, 47, 48, 50, 51, 52, 54, 55, 56, 57, 58, 60, 67, 68, 88, 90, 111, 112, 113, 114, 115, 116, 138, 139, 152, 162, 181, 183, 203, 204, 205, 230, 239, 242

curvesim/pool/cryptoswap/calcs/tricrypto_ng.py

87.94% of new lines are covered (84% of the complete file).
Missing lines: 107, 109, 111, 113, 115, 127, 129, 130, 131, 132, 133, 141, 146, 152, 158, 166, 172, 178, 182, 224, 226, 243, 244, 245, 274, 275, 288, 298, 310, 324, 417, 421, 501, 512, 519, 556, 608

@chanhosuh
Copy link
Member Author

Looks like the _newton_D will need to be updated with an optional starting guess argument. This will make the price tweak match the Tricrypto-NG more precisely. Otherwise there starts to be a drift in the price scale which shows up in slight changes in tolerance required for swap comparisons.

@chanhosuh chanhosuh requested a review from nagakingg July 18, 2023 22:01
@chanhosuh chanhosuh force-pushed the tricrypto branch 2 times, most recently from f85c903 to 20bf041 Compare July 22, 2023 15:37
@chanhosuh chanhosuh merged commit a6e0e28 into main Jul 26, 2023
11 checks passed
@chanhosuh chanhosuh deleted the tricrypto branch July 26, 2023 19:12
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.

Handle multiple coins (at least 3 because of tricrypto)
1 participant