DeFiPy 0.0.17__tar.gz → 0.0.19__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/DeFiPy.egg-info/PKG-INFO +61 -13
  2. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/DeFiPy.egg-info/SOURCES.txt +3 -1
  3. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/DeFiPy.egg-info/requires.txt +2 -1
  4. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/PKG-INFO +61 -13
  5. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/README.md +60 -12
  6. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/__init__.py +2 -0
  7. DeFiPy-0.0.19/python/prod/utils/client/__init__.py +1 -0
  8. DeFiPy-0.0.19/python/prod/utils/tools/v3/__init__.py +1 -0
  9. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/setup.py +6 -3
  10. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/DeFiPy.egg-info/dependency_links.txt +0 -0
  11. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/DeFiPy.egg-info/not-zip-safe +0 -0
  12. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/DeFiPy.egg-info/top_level.txt +0 -0
  13. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/LICENSE.txt +0 -0
  14. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/erc/__init__.py +0 -0
  15. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/math/basic/__init__.py +0 -0
  16. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/math/interest/__init__.py +0 -0
  17. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/math/interest/ips/__init__.py +0 -0
  18. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/math/interest/ips/aggregate/__init__.py +0 -0
  19. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/math/model/__init__.py +0 -0
  20. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/math/risk/__init__.py +0 -0
  21. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/process/__init__.py +0 -0
  22. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/process/burn/__init__.py +0 -0
  23. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/process/deposit/__init__.py +0 -0
  24. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/process/liquidity/__init__.py +0 -0
  25. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/process/mint/__init__.py +0 -0
  26. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/process/swap/__init__.py +0 -0
  27. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/simulate/__init__.py +0 -0
  28. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/utils/data/__init__.py +0 -0
  29. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/python/prod/utils/interfaces/__init__.py +0 -0
  30. {DeFiPy-0.0.17 → DeFiPy-0.0.19}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: DeFiPy
3
- Version: 0.0.17
3
+ Version: 0.0.19
4
4
  Summary: DeFi Analytics with Python
5
5
  Home-page: http://github.com/defipy-devs/defipy
6
6
  Author: icmoore
@@ -10,7 +10,7 @@ Platform: UNKNOWN
10
10
  Description-Content-Type: text/markdown
11
11
  License-File: LICENSE.txt
12
12
 
13
- # DeFiPy: DeFi Analytics with Python (v 0.0.17)
13
+ # DeFiPy: DeFi Analytics with Python (v 0.0.19)
14
14
 
15
15
  Welcome to the worlds first DeFi Python package with all major protocols intergrated into one package! Implement your analytics in one package with DeFiPy. Since DeFiPy is built with a modular design in mind, your can also silo your analytics by protocol
16
16
  using:
@@ -36,7 +36,7 @@ or
36
36
  > pip install defipy
37
37
  ```
38
38
 
39
- Uniswap Example
39
+ Uniswap V2 Example
40
40
  --------------------------
41
41
 
42
42
  To setup a liquidity pool, you must first create the tokens in the pair using the `ERC20` object. Next, create a liquidity pool (LP) factory using `IFactory` object. Once this is setup, an unlimited amount of LPs can be created; the procedures for such are as follows:
@@ -45,23 +45,54 @@ To setup a liquidity pool, you must first create the tokens in the pair using th
45
45
  from defipy import *
46
46
 
47
47
  user_nm = 'user_intro'
48
- eth_amount = 1000
49
- dai_amount = 1000000
50
-
51
- dai = ERC20("DAI", "0x01")
52
- eth = ERC20("ETH", "0x02")
48
+ eth_amount = 3162.277660168379
49
+ dai_amount = 316227.7660168379
50
+
51
+ dai = ERC20("DAI", "0x111")
52
+ eth = ERC20("ETH", "0x09")
53
+ exchg_data = UniswapExchangeData(tkn0 = eth, tkn1 = dai, symbol="LP",
54
+ address="0x011")
53
55
 
54
- factory = UniswapFactory("ETH pool factory", "0x")
55
- exchg_data = UniswapExchangeData(tkn0 = eth, tkn1 = dai, symbol="LP", address="0x11")
56
+ factory = UniswapFactory("ETH pool factory", "0x2")
56
57
  lp = factory.deploy(exchg_data)
57
58
  lp.add_liquidity("user0", eth_amount, dai_amount, eth_amount, dai_amount)
58
59
  lp.summary()
59
60
 
60
61
 
61
62
  #OUTPUT:
62
- Exchange ETH-DAI (LP)
63
- Reserves: ETH = 1000, DAI = 1000000
63
+ Exchange ETH-DAI (LP)
64
+ Reserves: ETH = 3162.277660168379, DAI = 316227.7660168379
64
65
  Liquidity: 31622.776601683792
66
+
67
+ Uniswap V3 Example
68
+ --------------------------
69
+
70
+ from defipy import *
71
+
72
+ user = 'user_intro'
73
+ fee = UniV3Utils.FeeAmount.MEDIUM
74
+ tick_spacing = UniV3Utils.TICK_SPACINGS[fee]
75
+ lwr_tick = UniV3Utils.getMinTick(tick_spacing)
76
+ upr_tick = UniV3Utils.getMaxTick(tick_spacing)
77
+ init_price = UniV3Utils.encodePriceSqrt(100, 1)
78
+
79
+ dai = ERC20("DAI", "0x09")
80
+ eth = ERC20("ETH", "0x111")
81
+
82
+ exchg_data = UniswapExchangeData(tkn0 = eth, tkn1 = dai, symbol="LP",
83
+ address="0x011", version = 'V3',
84
+ tick_spacing = tick_spacing,
85
+ fee = fee)
86
+
87
+ factory = UniswapFactory("ETH pool factory", "0x2")
88
+ lp = factory.deploy(exchg_data)
89
+ lp.initialize(init_price)
90
+ out = lp.mint(user, lwr_tick, upr_tick, 31622.776601683792)
91
+ lp.summary()
92
+
93
+ Exchange ETH-DAI (LP)
94
+ Reserves: ETH = 3162.277660168379, DAI = 316227.7660168379
95
+ Liquidity: 31622.776601683792
65
96
 
66
97
  Balancer Example
67
98
  --------------------------
@@ -143,6 +174,23 @@ StableSwap Example
143
174
  #OUTPUT:
144
175
  Stableswap Exchange: DAI-USDC-USDT (LP)
145
176
  Reserves: DAI = 79566307.55982581, USDC = 81345068.187939, USDT = 55663250.772939
146
- Liquidity: 216573027.91811988
177
+ Liquidity: 216573027.91811988
178
+
179
+ ## 0x Quant Terminal
180
+
181
+ This application utilizes the 0x API to produce a mock Uniswap pool which allows end-users to stress test
182
+ the limitations of a Uniswap pool setup using live price feeds from [0x API](https://0x.org); for backend setup, see
183
+ [notebook](https://github.com/defipy-devs/defipy/blob/main/notebooks/quant_terminal.ipynb)
184
+
185
+ Click [dashboard.defipy.org](https://dashboard.defipy.org/) for live link; for more detail see
186
+ [README](https://github.com/defipy-devs/defipy/tree/main/python/application/quant_terminal#readme)
187
+
188
+ ![plot](./doc/quant_terminal/screenshot.png)
189
+
190
+ ### Run application locally
191
+
192
+ ```
193
+ > bokeh serve --show python/application/quant_terminal/bokeh_server.py
194
+ ```
147
195
 
148
196
 
@@ -29,5 +29,7 @@ python/prod/process/liquidity/__init__.py
29
29
  python/prod/process/mint/__init__.py
30
30
  python/prod/process/swap/__init__.py
31
31
  python/prod/simulate/__init__.py
32
+ python/prod/utils/client/__init__.py
32
33
  python/prod/utils/data/__init__.py
33
- python/prod/utils/interfaces/__init__.py
34
+ python/prod/utils/interfaces/__init__.py
35
+ python/prod/utils/tools/v3/__init__.py
@@ -1,4 +1,5 @@
1
1
  scipy>=1.7.3
2
- uniswappy==1.2.0
2
+ bokeh==3.3.4
3
+ uniswappy==1.3.0
3
4
  stableswappy==0.0.11
4
5
  balancerpy==0.0.9
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: DeFiPy
3
- Version: 0.0.17
3
+ Version: 0.0.19
4
4
  Summary: DeFi Analytics with Python
5
5
  Home-page: http://github.com/defipy-devs/defipy
6
6
  Author: icmoore
@@ -10,7 +10,7 @@ Platform: UNKNOWN
10
10
  Description-Content-Type: text/markdown
11
11
  License-File: LICENSE.txt
12
12
 
13
- # DeFiPy: DeFi Analytics with Python (v 0.0.17)
13
+ # DeFiPy: DeFi Analytics with Python (v 0.0.19)
14
14
 
15
15
  Welcome to the worlds first DeFi Python package with all major protocols intergrated into one package! Implement your analytics in one package with DeFiPy. Since DeFiPy is built with a modular design in mind, your can also silo your analytics by protocol
16
16
  using:
@@ -36,7 +36,7 @@ or
36
36
  > pip install defipy
37
37
  ```
38
38
 
39
- Uniswap Example
39
+ Uniswap V2 Example
40
40
  --------------------------
41
41
 
42
42
  To setup a liquidity pool, you must first create the tokens in the pair using the `ERC20` object. Next, create a liquidity pool (LP) factory using `IFactory` object. Once this is setup, an unlimited amount of LPs can be created; the procedures for such are as follows:
@@ -45,23 +45,54 @@ To setup a liquidity pool, you must first create the tokens in the pair using th
45
45
  from defipy import *
46
46
 
47
47
  user_nm = 'user_intro'
48
- eth_amount = 1000
49
- dai_amount = 1000000
50
-
51
- dai = ERC20("DAI", "0x01")
52
- eth = ERC20("ETH", "0x02")
48
+ eth_amount = 3162.277660168379
49
+ dai_amount = 316227.7660168379
50
+
51
+ dai = ERC20("DAI", "0x111")
52
+ eth = ERC20("ETH", "0x09")
53
+ exchg_data = UniswapExchangeData(tkn0 = eth, tkn1 = dai, symbol="LP",
54
+ address="0x011")
53
55
 
54
- factory = UniswapFactory("ETH pool factory", "0x")
55
- exchg_data = UniswapExchangeData(tkn0 = eth, tkn1 = dai, symbol="LP", address="0x11")
56
+ factory = UniswapFactory("ETH pool factory", "0x2")
56
57
  lp = factory.deploy(exchg_data)
57
58
  lp.add_liquidity("user0", eth_amount, dai_amount, eth_amount, dai_amount)
58
59
  lp.summary()
59
60
 
60
61
 
61
62
  #OUTPUT:
62
- Exchange ETH-DAI (LP)
63
- Reserves: ETH = 1000, DAI = 1000000
63
+ Exchange ETH-DAI (LP)
64
+ Reserves: ETH = 3162.277660168379, DAI = 316227.7660168379
64
65
  Liquidity: 31622.776601683792
66
+
67
+ Uniswap V3 Example
68
+ --------------------------
69
+
70
+ from defipy import *
71
+
72
+ user = 'user_intro'
73
+ fee = UniV3Utils.FeeAmount.MEDIUM
74
+ tick_spacing = UniV3Utils.TICK_SPACINGS[fee]
75
+ lwr_tick = UniV3Utils.getMinTick(tick_spacing)
76
+ upr_tick = UniV3Utils.getMaxTick(tick_spacing)
77
+ init_price = UniV3Utils.encodePriceSqrt(100, 1)
78
+
79
+ dai = ERC20("DAI", "0x09")
80
+ eth = ERC20("ETH", "0x111")
81
+
82
+ exchg_data = UniswapExchangeData(tkn0 = eth, tkn1 = dai, symbol="LP",
83
+ address="0x011", version = 'V3',
84
+ tick_spacing = tick_spacing,
85
+ fee = fee)
86
+
87
+ factory = UniswapFactory("ETH pool factory", "0x2")
88
+ lp = factory.deploy(exchg_data)
89
+ lp.initialize(init_price)
90
+ out = lp.mint(user, lwr_tick, upr_tick, 31622.776601683792)
91
+ lp.summary()
92
+
93
+ Exchange ETH-DAI (LP)
94
+ Reserves: ETH = 3162.277660168379, DAI = 316227.7660168379
95
+ Liquidity: 31622.776601683792
65
96
 
66
97
  Balancer Example
67
98
  --------------------------
@@ -143,6 +174,23 @@ StableSwap Example
143
174
  #OUTPUT:
144
175
  Stableswap Exchange: DAI-USDC-USDT (LP)
145
176
  Reserves: DAI = 79566307.55982581, USDC = 81345068.187939, USDT = 55663250.772939
146
- Liquidity: 216573027.91811988
177
+ Liquidity: 216573027.91811988
178
+
179
+ ## 0x Quant Terminal
180
+
181
+ This application utilizes the 0x API to produce a mock Uniswap pool which allows end-users to stress test
182
+ the limitations of a Uniswap pool setup using live price feeds from [0x API](https://0x.org); for backend setup, see
183
+ [notebook](https://github.com/defipy-devs/defipy/blob/main/notebooks/quant_terminal.ipynb)
184
+
185
+ Click [dashboard.defipy.org](https://dashboard.defipy.org/) for live link; for more detail see
186
+ [README](https://github.com/defipy-devs/defipy/tree/main/python/application/quant_terminal#readme)
187
+
188
+ ![plot](./doc/quant_terminal/screenshot.png)
189
+
190
+ ### Run application locally
191
+
192
+ ```
193
+ > bokeh serve --show python/application/quant_terminal/bokeh_server.py
194
+ ```
147
195
 
148
196
 
@@ -1,4 +1,4 @@
1
- # DeFiPy: DeFi Analytics with Python (v 0.0.17)
1
+ # DeFiPy: DeFi Analytics with Python (v 0.0.19)
2
2
 
3
3
  Welcome to the worlds first DeFi Python package with all major protocols intergrated into one package! Implement your analytics in one package with DeFiPy. Since DeFiPy is built with a modular design in mind, your can also silo your analytics by protocol
4
4
  using:
@@ -24,7 +24,7 @@ or
24
24
  > pip install defipy
25
25
  ```
26
26
 
27
- Uniswap Example
27
+ Uniswap V2 Example
28
28
  --------------------------
29
29
 
30
30
  To setup a liquidity pool, you must first create the tokens in the pair using the `ERC20` object. Next, create a liquidity pool (LP) factory using `IFactory` object. Once this is setup, an unlimited amount of LPs can be created; the procedures for such are as follows:
@@ -33,23 +33,54 @@ To setup a liquidity pool, you must first create the tokens in the pair using th
33
33
  from defipy import *
34
34
 
35
35
  user_nm = 'user_intro'
36
- eth_amount = 1000
37
- dai_amount = 1000000
38
-
39
- dai = ERC20("DAI", "0x01")
40
- eth = ERC20("ETH", "0x02")
36
+ eth_amount = 3162.277660168379
37
+ dai_amount = 316227.7660168379
38
+
39
+ dai = ERC20("DAI", "0x111")
40
+ eth = ERC20("ETH", "0x09")
41
+ exchg_data = UniswapExchangeData(tkn0 = eth, tkn1 = dai, symbol="LP",
42
+ address="0x011")
41
43
 
42
- factory = UniswapFactory("ETH pool factory", "0x")
43
- exchg_data = UniswapExchangeData(tkn0 = eth, tkn1 = dai, symbol="LP", address="0x11")
44
+ factory = UniswapFactory("ETH pool factory", "0x2")
44
45
  lp = factory.deploy(exchg_data)
45
46
  lp.add_liquidity("user0", eth_amount, dai_amount, eth_amount, dai_amount)
46
47
  lp.summary()
47
48
 
48
49
 
49
50
  #OUTPUT:
50
- Exchange ETH-DAI (LP)
51
- Reserves: ETH = 1000, DAI = 1000000
51
+ Exchange ETH-DAI (LP)
52
+ Reserves: ETH = 3162.277660168379, DAI = 316227.7660168379
52
53
  Liquidity: 31622.776601683792
54
+
55
+ Uniswap V3 Example
56
+ --------------------------
57
+
58
+ from defipy import *
59
+
60
+ user = 'user_intro'
61
+ fee = UniV3Utils.FeeAmount.MEDIUM
62
+ tick_spacing = UniV3Utils.TICK_SPACINGS[fee]
63
+ lwr_tick = UniV3Utils.getMinTick(tick_spacing)
64
+ upr_tick = UniV3Utils.getMaxTick(tick_spacing)
65
+ init_price = UniV3Utils.encodePriceSqrt(100, 1)
66
+
67
+ dai = ERC20("DAI", "0x09")
68
+ eth = ERC20("ETH", "0x111")
69
+
70
+ exchg_data = UniswapExchangeData(tkn0 = eth, tkn1 = dai, symbol="LP",
71
+ address="0x011", version = 'V3',
72
+ tick_spacing = tick_spacing,
73
+ fee = fee)
74
+
75
+ factory = UniswapFactory("ETH pool factory", "0x2")
76
+ lp = factory.deploy(exchg_data)
77
+ lp.initialize(init_price)
78
+ out = lp.mint(user, lwr_tick, upr_tick, 31622.776601683792)
79
+ lp.summary()
80
+
81
+ Exchange ETH-DAI (LP)
82
+ Reserves: ETH = 3162.277660168379, DAI = 316227.7660168379
83
+ Liquidity: 31622.776601683792
53
84
 
54
85
  Balancer Example
55
86
  --------------------------
@@ -131,4 +162,21 @@ StableSwap Example
131
162
  #OUTPUT:
132
163
  Stableswap Exchange: DAI-USDC-USDT (LP)
133
164
  Reserves: DAI = 79566307.55982581, USDC = 81345068.187939, USDT = 55663250.772939
134
- Liquidity: 216573027.91811988
165
+ Liquidity: 216573027.91811988
166
+
167
+ ## 0x Quant Terminal
168
+
169
+ This application utilizes the 0x API to produce a mock Uniswap pool which allows end-users to stress test
170
+ the limitations of a Uniswap pool setup using live price feeds from [0x API](https://0x.org); for backend setup, see
171
+ [notebook](https://github.com/defipy-devs/defipy/blob/main/notebooks/quant_terminal.ipynb)
172
+
173
+ Click [dashboard.defipy.org](https://dashboard.defipy.org/) for live link; for more detail see
174
+ [README](https://github.com/defipy-devs/defipy/tree/main/python/application/quant_terminal#readme)
175
+
176
+ ![plot](./doc/quant_terminal/screenshot.png)
177
+
178
+ ### Run application locally
179
+
180
+ ```
181
+ > bokeh serve --show python/application/quant_terminal/bokeh_server.py
182
+ ```
@@ -14,6 +14,8 @@ from defipy.process.swap import *
14
14
  from defipy.simulate import *
15
15
  from defipy.utils.interfaces import *
16
16
  from defipy.utils.data import *
17
+ from defipy.utils.client import *
18
+ from defipy.utils.tools.v3 import *
17
19
 
18
20
  from uniswappy.cpt.exchg import *
19
21
  from uniswappy.cpt.factory import *
@@ -0,0 +1 @@
1
+ from uniswappy.utils.client import *
@@ -0,0 +1 @@
1
+ from uniswappy.utils.tools.v3 import *
@@ -4,7 +4,7 @@ with open('README.md') as f:
4
4
  long_description = f.read()
5
5
 
6
6
  setup(name='DeFiPy',
7
- version='0.0.17',
7
+ version='0.0.19',
8
8
  description='DeFi Analytics with Python',
9
9
  long_description=long_description,
10
10
  long_description_content_type="text/markdown",
@@ -30,11 +30,14 @@ setup(name='DeFiPy',
30
30
  'defipy.process.swap',
31
31
  'defipy.simulate',
32
32
  'defipy.utils.interfaces',
33
- 'defipy.utils.data'
33
+ 'defipy.utils.data',
34
+ 'defipy.utils.client',
35
+ 'defipy.utils.tools.v3'
34
36
  ],
35
37
  install_requires=[
36
38
  'scipy >= 1.7.3',
37
- 'uniswappy == 1.2.0',
39
+ 'bokeh == 3.3.4',
40
+ 'uniswappy == 1.3.0',
38
41
  'stableswappy == 0.0.11',
39
42
  'balancerpy == 0.0.9'
40
43
  ],
File without changes
File without changes