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

Price Impact - ABA - create POC to validate approach #545

Draft
wants to merge 16 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
96 changes: 96 additions & 0 deletions balancer-js/50COIL50USDC_COIL.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
action,test,spot price,ABA,error abs,error rel,
swap,1,0.005180401494361384,0.005154892916551773,-0.00002550857780961053,-0.004924054214210111
Swap Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,500,228129.25829022804482744,0.00219173990985363
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0,309823.996679,0

swap,2,0.00735131326953675,0.0072956017158904846,-0.00005571155364626507,-0.007578449129236441
Swap Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,1000,228129.25829022804482744,0.00438347981970726
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0,309823.996679,0

swap,3,0.013807740067306559,0.013608023132505878,-0.0001997169348006804,-0.014464129091882497
Swap Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,2500,228129.25829022804482744,0.010958699549268152
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0,309823.996679,0

swap,4,0.02438436345452488,0.023776803559383917,-0.0006075598951409619,-0.024915962898683756
Swap Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,5000,228129.25829022804482744,0.021917399098536305
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0,309823.996679,0

swap,5,0.054799363778260224,0.05188257766712566,-0.0029167861111345644,-0.05322664188104497
Swap Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,12500,228129.25829022804482744,0.05479349774634076
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0,309823.996679,0

swap,6,0.10149666302499849,0.09201353427353802,-0.00948312875146047,-0.09343291167242404
Swap Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,25000,228129.25829022804482744,0.10958699549268151
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0,309823.996679,0

swap,7,0.18232992665973258,0.1539875217105615,-0.02834240494917109,-0.15544571024845638
Swap Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,50000,228129.25829022804482744,0.21917399098536303
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0,309823.996679,0

single token join,1,0.00204569547258822,0.0020437519202469046,-0.0000019435523413153903,-0.0009500692392188766
Single-Sided Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,500,228129.25829022804482744,0.00219173990985363
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0,309823.996679,0

single token join,2,0.002590200271126884,0.002587439966144075,-0.0000027603049828090614,-0.0010656724167541578
Single-Sided Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,1000,228129.25829022804482744,0.00438347981970726
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0,309823.996679,0

single token join,3,0.004216619270245104,0.0042114193394972065,-0.000005199930747897159,-0.0012331990190793056
Single-Sided Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,2500,228129.25829022804482744,0.010958699549268152
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0,309823.996679,0

single token join,4,0.006903952605003489,0.006894721675164783,-0.00000923092983870586,-0.0013370500011856898
Single-Sided Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,5000,228129.25829022804482744,0.021917399098536305
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0,309823.996679,0

single token join,5,0.014796010721897204,0.014774941705429883,-0.00002106901646732086,-0.0014239660178226273
Single-Sided Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,12500,228129.25829022804482744,0.05479349774634076
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0,309823.996679,0

single token join,6,0.027415167135464238,0.02737516938455883,-0.00003999775090540725,-0.0014589643283139497
Single-Sided Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,25000,228129.25829022804482744,0.10958699549268151
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0,309823.996679,0

single token join,7,0.05086148518701672,0.05078631795912515,-0.00007516722789156771,-0.0014778811042418293
Single-Sided Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,50000,228129.25829022804482744,0.21917399098536303
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0,309823.996679,0

unbalanced join,1,0.001381564085214109,0.001481891915669705,0.00010032783045559588,0.07261902037649415
Unbalanced Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,100,228129.25829022804482744,0.0004383479819707261
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,10,309823.996679,0.00003227638952176039

unbalanced join,2,0.002544407598200952,0.0025568674917006875,0.000012459893499735392,0.004896972288773733
Unbalanced Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,1000,228129.25829022804482744,0.00438347981970726
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,10,309823.996679,0.00003227638952176039

unbalanced join,3,0.01216711270349539,0.012023079736120917,-0.00014403296737447273,-0.011837892101804456
Unbalanced Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,10000,228129.25829022804482744,0.04383479819707261
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,10,309823.996679,0.00003227638952176039

unbalanced join,4,0.050838482362310984,0.048356686935959695,-0.0024817954263512895,-0.04881726029239543
Unbalanced Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,50000,228129.25829022804482744,0.21917399098536303
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,10,309823.996679,0.00003227638952176039

unbalanced join,5,0.1268080243492715,0.11248693006189495,-0.014321094287376546,-0.1129352370314633
Unbalanced Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,150000,228129.25829022804482744,0.6575219729560892
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,10,309823.996679,0.00003227638952176039

96 changes: 96 additions & 0 deletions balancer-js/50COIL50USDC_USDC.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
action,test,spot price,ABA,error abs,error rel,
swap,1,0.004606393366046621,0.004587325000000021,-0.00001906836604659984,-0.004139543571582777
Swap Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,0,228129.25829022804482744,0
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,500,309823.996679,0.0016138194760880193

swap,2,0.006207634010097937,0.006168986000000018,-0.00003864801009791953,-0.006225884134768728
Swap Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,0,228129.25829022804482744,0
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,1000,309823.996679,0.0032276389521760387

swap,3,0.010980686343833753,0.010853947200000038,-0.00012673914383371475,-0.011542005651120853
Swap Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,0,228129.25829022804482744,0
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,2500,309823.996679,0.008069097380440097

swap,4,0.018834998531135124,0.018467752800000018,-0.000367245731135106,-0.019498049364221177
Swap Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,0,228129.25829022804482744,0
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,5000,309823.996679,0.016138194760880194

swap,5,0.041669010735540635,0.03995046384000001,-0.0017185468955406222,-0.041242805269548356
Swap Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,0,228129.25829022804482744,0
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,12500,309823.996679,0.04034548690220049

swap,6,0.07745877432726511,0.07179017286000001,-0.005668601467265097,-0.07318217356906688
Swap Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,0,228129.25829022804482744,0
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,25000,309823.996679,0.08069097380440098

swap,7,0.14159773144648513,0.12385556351999999,-0.017742167926485142,-0.12529980350137562
Swap Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,0,228129.25829022804482744,0
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,50000,309823.996679,0.16138194760880195

single token join,1,0.001901921674153756,0.0019001939999999991,-0.000001727674153756886,-0.0009083834404093428
Single-Sided Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,0,228129.25829022804482744,0
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,500,309823.996679,0.0016138194760880193

single token join,2,0.002303197086591944,0.0023008674999999814,-0.0000023295865919626367,-0.001011457771253845
Single-Sided Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,0,228129.25829022804482744,0
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,1000,309823.996679,0.0032276389521760387

single token join,3,0.003503165415001174,0.0034990358000000013,-0.000004129615001172669,-0.0011788238669772565
Single-Sided Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,0,228129.25829022804482744,0
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,2500,309823.996679,0.008069097380440097

single token join,4,0.005490367996722705,0.005483257500000036,-0.0000071104967226684815,-0.0012950856348632478
Single-Sided Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,0,228129.25829022804482744,0
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,5000,309823.996679,0.016138194760880194

single token join,5,0.011358540118500423,0.01134262732000003,-0.00001591279850039415,-0.001400954553523643
Single-Sided Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,0,228129.25829022804482744,0
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,12500,309823.996679,0.04034548690220049

single token join,6,0.02084067786135113,0.02081054186000001,-0.000030136001351120656,-0.0014460182894054337
Single-Sided Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,0,228129.25829022804482744,0
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,25000,309823.996679,0.08069097380440098

single token join,7,0.03877718442910252,0.03872014366000003,-0.000057040769102484346,-0.0014709879002889879
Single-Sided Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,0,228129.25829022804482744,0
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,50000,309823.996679,0.16138194760880195

unbalanced join,1,0.001537020102404201,0.001556495,0.000019474897595798913,0.012670554903827446
Unbalanced Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,1,228129.25829022804482744,0.000004383479819707261
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,100,309823.996679,0.0003227638952176039

unbalanced join,2,0.002295859970807763,0.0022942195,-0.0000016404708077632363,-0.0007145343481841629
Unbalanced Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,1,228129.25829022804482744,0.000004383479819707261
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,1000,309823.996679,0.0032276389521760387

unbalanced join,3,0.009414176353483334,0.0093229879,-0.00009118845348333494,-0.00968629119100731
Unbalanced Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,1,228129.25829022804482744,0.000004383479819707261
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,10000,309823.996679,0.03227638952176039

unbalanced join,4,0.038773986715493355,0.03730464448,-0.0014693422354933525,-0.037895051810760305
Unbalanced Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,1,228129.25829022804482744,0.000004383479819707261
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,50000,309823.996679,0.16138194760880195

unbalanced join,5,0.09961903442349677,0.09054620707333333,-0.009072827350163445,-0.09107523881021949
Unbalanced Join Summary
0x823e1b82ce1dc147bbdb25a203f046afab1ce918,1,228129.25829022804482744,0.000004383479819707261
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,150000,309823.996679,0.4841458428264058

96 changes: 96 additions & 0 deletions balancer-js/80BAL20WETH_BAL.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
action,test,spot price,ABA,error abs,error rel,
swap,1,0.01074482635644113,0.010675712248904255,-0.00006911410753687557,-0.006432314980636628
Swap Summary
0xba100000625a3754423978a60c9317c58a424e3d,10000,33209420.429177837538000946,0.0003011193772961478
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0,16591.168598583701574685,0

swap,2,0.01148876540472076,0.011399280768069911,-0.00008948463665084914,-0.007788881877079647
Swap Summary
0xba100000625a3754423978a60c9317c58a424e3d,20000,33209420.429177837538000946,0.0006022387545922956
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0,16591.168598583701574685,0

swap,3,0.013715272641710788,0.01355722241299991,-0.00015805022871087822,-0.011523666560606095
Swap Summary
0xba100000625a3754423978a60c9317c58a424e3d,50000,33209420.429177837538000946,0.001505596886480739
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0,16591.168598583701574685,0

swap,4,0.01740850105233393,0.017111825651934122,-0.0002966754003998068,-0.017041984229884743
Swap Summary
0xba100000625a3754423978a60c9317c58a424e3d,100000,33209420.429177837538000946,0.003011193772961478
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0,16591.168598583701574685,0

swap,5,0.02835762674090258,0.027471602416982526,-0.0008860243239200531,-0.031244657108137546
Swap Summary
0xba100000625a3754423978a60c9317c58a424e3d,250000,33209420.429177837538000946,0.007527984432403695
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0,16591.168598583701574685,0

swap,6,0.046180967002858446,0.043789387204565926,-0.00239157979829252,-0.05178713122539182
Swap Summary
0xba100000625a3754423978a60c9317c58a424e3d,500000,33209420.429177837538000946,0.01505596886480739
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0,16591.168598583701574685,0

swap,7,0.08030484767005251,0.07329181779319048,-0.007013029876862031,-0.08733009376565132
Swap Summary
0xba100000625a3754423978a60c9317c58a424e3d,1000000,33209420.429177837538000946,0.03011193772961478
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0,16591.168598583701574685,0

single token join,1,0.002029988088886347,0.0020279299891613847,-0.0000020580997249623235,-0.0010138481778439394
Single-Sided Join Summary
0xba100000625a3754423978a60c9317c58a424e3d,10000,33209420.429177837538000946,0.0003011193772961478
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0,16591.168598583701574685,0

single token join,2,0.002059968846368026,0.0020578562958809016,-0.0000021125504871244948,-0.0010255254543529513
Single-Sided Join Summary
0xba100000625a3754423978a60c9317c58a424e3d,20000,33209420.429177837538000946,0.0006022387545922956
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0,16591.168598583701574685,0

single token join,3,0.00214986801324604,0.002147613739076842,-0.00000225427416919834,-0.0010485639840720543
Single-Sided Join Summary
0xba100000625a3754423978a60c9317c58a424e3d,50000,33209420.429177837538000946,0.001505596886480739
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0,16591.168598583701574685,0

single token join,4,0.002299556187610588,0.002297137834273162,-0.0000024183533374258492,-0.0010516609032887778
Single-Sided Join Summary
0xba100000625a3754423978a60c9317c58a424e3d,100000,33209420.429177837538000946,0.003011193772961478
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0,16591.168598583701574685,0

single token join,5,0.002747546281903586,0.0027451755993971603,-0.000002370682506425744,-0.0008628362412091057
Single-Sided Join Summary
0xba100000625a3754423978a60c9317c58a424e3d,250000,33209420.429177837538000946,0.007527984432403695
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0,16591.168598583701574685,0

single token join,6,0.003490641306584725,0.003490142634904769,-4.98671679956264e-7,-0.0001428596169464828
Single-Sided Join Summary
0xba100000625a3754423978a60c9317c58a424e3d,500000,33209420.429177837538000946,0.01505596886480739
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0,16591.168598583701574685,0

single token join,7,0.004963693729814437,0.004973609079042508,0.000009915349228071038,0.0019975747432833075
Single-Sided Join Summary
0xba100000625a3754423978a60c9317c58a424e3d,1000000,33209420.429177837538000946,0.03011193772961478
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0,16591.168598583701574685,0

unbalanced join,1,0.001337128450564294,0.00399376732611911,0.0026566388755548155,1.986823984213082
Unbalanced Join Summary
0xba100000625a3754423978a60c9317c58a424e3d,1000,33209420.429177837538000946,0.00003011193772961478
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,1,16591.168598583701574685,0.00006027302983861935

unbalanced join,2,0.001541709034511661,0.0016167781702511766,0.00007506913573951564,0.048692155302374494
Unbalanced Join Summary
0xba100000625a3754423978a60c9317c58a424e3d,10000,33209420.429177837538000946,0.0003011193772961478
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,1,16591.168598583701574685,0.00006027302983861935

unbalanced join,3,0.002236449744451255,0.0022420464754017862,0.000005596730950531079,0.0025025069149963467
Unbalanced Join Summary
0xba100000625a3754423978a60c9317c58a424e3d,100000,33209420.429177837538000946,0.003011193772961478
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,1,16591.168598583701574685,0.00006027302983861935

unbalanced join,4,0.02887389817541518,0.02728338766874008,-0.001590510506675101,-0.05508471689594545
Unbalanced Join Summary
0xba100000625a3754423978a60c9317c58a424e3d,10000000,33209420.429177837538000946,0.3011193772961478
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,1,16591.168598583701574685,0.00006027302983861935

unbalanced join,5,0.040431008786043,0,-0.040431008786043,-1
Unbalanced Join Summary
0xba100000625a3754423978a60c9317c58a424e3d,15000000,33209420.429177837538000946,0.4516790659442217
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,1,16591.168598583701574685,0.00006027302983861935

Loading
Loading