eth-portfolio 1.1.0__py3-none-any.whl
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.
Potentially problematic release.
This version of eth-portfolio might be problematic. Click here for more details.
- eth_portfolio/__init__.py +16 -0
- eth_portfolio/_argspec.py +42 -0
- eth_portfolio/_cache.py +116 -0
- eth_portfolio/_config.py +3 -0
- eth_portfolio/_db/__init__.py +0 -0
- eth_portfolio/_db/decorators.py +147 -0
- eth_portfolio/_db/entities.py +204 -0
- eth_portfolio/_db/utils.py +595 -0
- eth_portfolio/_decimal.py +122 -0
- eth_portfolio/_decorators.py +71 -0
- eth_portfolio/_exceptions.py +67 -0
- eth_portfolio/_ledgers/__init__.py +0 -0
- eth_portfolio/_ledgers/address.py +892 -0
- eth_portfolio/_ledgers/portfolio.py +327 -0
- eth_portfolio/_loaders/__init__.py +33 -0
- eth_portfolio/_loaders/balances.py +78 -0
- eth_portfolio/_loaders/token_transfer.py +214 -0
- eth_portfolio/_loaders/transaction.py +379 -0
- eth_portfolio/_loaders/utils.py +59 -0
- eth_portfolio/_shitcoins.py +212 -0
- eth_portfolio/_utils.py +286 -0
- eth_portfolio/_ydb/__init__.py +0 -0
- eth_portfolio/_ydb/token_transfers.py +136 -0
- eth_portfolio/address.py +382 -0
- eth_portfolio/buckets.py +181 -0
- eth_portfolio/constants.py +58 -0
- eth_portfolio/portfolio.py +629 -0
- eth_portfolio/protocols/__init__.py +66 -0
- eth_portfolio/protocols/_base.py +107 -0
- eth_portfolio/protocols/convex.py +17 -0
- eth_portfolio/protocols/dsr.py +31 -0
- eth_portfolio/protocols/lending/__init__.py +49 -0
- eth_portfolio/protocols/lending/_base.py +57 -0
- eth_portfolio/protocols/lending/compound.py +185 -0
- eth_portfolio/protocols/lending/liquity.py +110 -0
- eth_portfolio/protocols/lending/maker.py +105 -0
- eth_portfolio/protocols/lending/unit.py +47 -0
- eth_portfolio/protocols/liquity.py +16 -0
- eth_portfolio/py.typed +0 -0
- eth_portfolio/structs/__init__.py +43 -0
- eth_portfolio/structs/modified.py +69 -0
- eth_portfolio/structs/structs.py +637 -0
- eth_portfolio/typing.py +1460 -0
- eth_portfolio-1.1.0.dist-info/METADATA +174 -0
- eth_portfolio-1.1.0.dist-info/RECORD +47 -0
- eth_portfolio-1.1.0.dist-info/WHEEL +5 -0
- eth_portfolio-1.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: eth-portfolio
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: eth-portfolio makes it easy to analyze your portfolio.
|
|
5
|
+
Home-page: https://github.com/BobTheBuidler/eth-portfolio
|
|
6
|
+
Author: BobTheBuidler
|
|
7
|
+
Author-email: bobthebuidlerdefi@gmail.com
|
|
8
|
+
Project-URL: Homepage, https://github.com/BobTheBuidler/eth-portfolio
|
|
9
|
+
Project-URL: Documentation, https://bobthebuidler.github.io/eth-portfolio
|
|
10
|
+
Project-URL: Source Code, https://github.com/BobTheBuidler/eth-portfolio
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: checksum_dict>=1.1.2
|
|
13
|
+
Requires-Dist: dank_mids>=4.20.109
|
|
14
|
+
Requires-Dist: eth-brownie<1.21,>=1.19.3
|
|
15
|
+
Requires-Dist: eth_retry<1,>=0.1.15
|
|
16
|
+
Requires-Dist: evmspec>=0.2.0
|
|
17
|
+
Requires-Dist: ez-a-sync>=0.24.43
|
|
18
|
+
Requires-Dist: numpy<2
|
|
19
|
+
Requires-Dist: pandas<1.6,>=1.4.3
|
|
20
|
+
Requires-Dist: ypricemagic<5,>=4.0.57
|
|
21
|
+
Dynamic: author
|
|
22
|
+
Dynamic: author-email
|
|
23
|
+
Dynamic: description
|
|
24
|
+
Dynamic: description-content-type
|
|
25
|
+
Dynamic: home-page
|
|
26
|
+
Dynamic: project-url
|
|
27
|
+
Dynamic: requires-dist
|
|
28
|
+
Dynamic: summary
|
|
29
|
+
|
|
30
|
+
# eth-portfolio
|
|
31
|
+
Use `eth-portfolio` to output information about your portfolio in a streamlined, speed-optimized way.
|
|
32
|
+
|
|
33
|
+
### NOTES:
|
|
34
|
+
- This lib is still a WIP and the provided API is subject to change without notice.
|
|
35
|
+
|
|
36
|
+
### INSTALLATION:
|
|
37
|
+
- You should start with a fresh virtual environment, and then just...
|
|
38
|
+
```
|
|
39
|
+
pip install git+https://github.com/BobTheBuidler/eth-portfolio
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Known Issues**
|
|
43
|
+
Make sure you are using Python >= 3.8 and < 3.13
|
|
44
|
+
If you have a PyYaml Issue with 3.4.1 not installing due to an issue with cython, try the following:
|
|
45
|
+
```
|
|
46
|
+
pip install wheel
|
|
47
|
+
pip install --no-build-isolation "Cython<3" "pyyaml==5.4.1"
|
|
48
|
+
```
|
|
49
|
+
then try again
|
|
50
|
+
`
|
|
51
|
+
pip install git+https://github.com/BobTheBuidler/eth-portfolio
|
|
52
|
+
`
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### USE:
|
|
56
|
+
For basic use, input each of your addresses as environment variables using the following pattern:
|
|
57
|
+
```
|
|
58
|
+
PORTFOLIO_ADDRESS_0=0x123...
|
|
59
|
+
PORTFOLIO_ADDRESS_1=0x234...
|
|
60
|
+
PORTFOLIO_ADDRESS_2=0x345...
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Then do...
|
|
64
|
+
```
|
|
65
|
+
from eth_portfolio import portfolio
|
|
66
|
+
portfolio.eth_balance(block)
|
|
67
|
+
|
|
68
|
+
>>> {
|
|
69
|
+
0xaddress0: _BalanceItem(balance=1234, usd_value=5678)
|
|
70
|
+
0xaddress1: _BalanceItem(balance=1234, usd_value=5678)
|
|
71
|
+
0xaddress2: _BalanceItem(balance=1234, usd_value=5678)
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Getting token transfers:
|
|
76
|
+
```
|
|
77
|
+
from eth_portfolio import portfolio
|
|
78
|
+
token_transfers = portfolio.token_transfers.get(start_block, end_block)
|
|
79
|
+
token_transfers.df()
|
|
80
|
+
|
|
81
|
+
>>> {
|
|
82
|
+
0xaddress0: AddressTokenTransfersLedger(...) # Each of these contains the token transfers for the specified address
|
|
83
|
+
0xaddress1: AddressTokenTransfersLedger(...)
|
|
84
|
+
0xaddress2: AddressTokenTransfersLedger(...)
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Getting transactions as a DataFrame:
|
|
89
|
+
```
|
|
90
|
+
from eth_portfolio import portfolio
|
|
91
|
+
txs = portfolio.transactions.get(start_block, end_block)
|
|
92
|
+
txs.df()
|
|
93
|
+
|
|
94
|
+
>>> [I am a pretend DataFrame]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Getting assets:
|
|
98
|
+
```
|
|
99
|
+
from eth_portfolio import portfolio
|
|
100
|
+
portfolio.describe(start_block, end_block)
|
|
101
|
+
|
|
102
|
+
>>> {
|
|
103
|
+
'assets': {
|
|
104
|
+
'wallet0_address': {
|
|
105
|
+
'token0': {
|
|
106
|
+
'amount': 123,
|
|
107
|
+
'value usd: 456,
|
|
108
|
+
},
|
|
109
|
+
'token1': {
|
|
110
|
+
'amount': 123,
|
|
111
|
+
'value usd: 456,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
'wallet0_address': {
|
|
115
|
+
'token0': {
|
|
116
|
+
'amount': 123,
|
|
117
|
+
'value usd: 456,
|
|
118
|
+
},
|
|
119
|
+
'token1': {
|
|
120
|
+
'amount': 123,
|
|
121
|
+
'value usd: 456,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
'debt': {
|
|
126
|
+
'wallet0_address': {
|
|
127
|
+
'token0': {
|
|
128
|
+
'amount': 123,
|
|
129
|
+
'value usd: 456,
|
|
130
|
+
},
|
|
131
|
+
'token1': {
|
|
132
|
+
'amount': 123,
|
|
133
|
+
'value usd: 456,
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
'wallet1_address': {
|
|
137
|
+
'token0': {
|
|
138
|
+
'amount': 123,
|
|
139
|
+
'value usd: 456,
|
|
140
|
+
},
|
|
141
|
+
'token1': {
|
|
142
|
+
'amount': 123,
|
|
143
|
+
'value usd: 456,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Getting net worth:
|
|
151
|
+
```
|
|
152
|
+
from eth_portfolio import portfolio
|
|
153
|
+
desc = portfolio.describe(block)
|
|
154
|
+
assets = desc['assets'] # OR you can do `assets = portfolio.assets(block)`
|
|
155
|
+
debt = desc['debt'] # OR you can do `debt = portfolio.debt(block)`
|
|
156
|
+
assets = sum(assets.values())
|
|
157
|
+
debt = sum(debt.values())
|
|
158
|
+
net = assets - debt
|
|
159
|
+
net.sum_usd()
|
|
160
|
+
|
|
161
|
+
>>> Decimal("123456.78900")
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### ADVANCED:
|
|
165
|
+
You also have more granular control available using the Portfolio object:
|
|
166
|
+
```
|
|
167
|
+
from eth_portfolio import Portfolio
|
|
168
|
+
port = Portfolio([0xaddress0, 0xaddress1, 0xaddress2])
|
|
169
|
+
port.describe(chain.height)
|
|
170
|
+
|
|
171
|
+
# Or for async code
|
|
172
|
+
async_port = Portfolio([0xaddress0, 0xaddress1, 0xaddress2], asynchronous=True)
|
|
173
|
+
await port.describe(chain.height)
|
|
174
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
eth_portfolio/__init__.py,sha256=KTtWGBCaebcToNLEok9DsE1t1o1TWOs3OL1Z9fl4dYg,335
|
|
2
|
+
eth_portfolio/_argspec.py,sha256=VzUZkbDkmOSgNUZBGbGblqtxBfDcmBAB89dY2OX0j-U,1595
|
|
3
|
+
eth_portfolio/_cache.py,sha256=K58BsK82QhOVi6dfmCsMDz7WeqmhATI3kx3Refm0Svg,4511
|
|
4
|
+
eth_portfolio/_config.py,sha256=viSW-IzNZPSe4xZQ2iUNdaEdITY0Xzgh_APO6VbzCH0,66
|
|
5
|
+
eth_portfolio/_decimal.py,sha256=v8GoB35Wk-JTMqFGvjQoLM_UuXtVjzz2oBwm-VMFvRA,3524
|
|
6
|
+
eth_portfolio/_decorators.py,sha256=si7kePGSl1Nfkia9up0IuJa2BxuRVxM_3BzVCk8P-yY,2281
|
|
7
|
+
eth_portfolio/_exceptions.py,sha256=_nSv-dIdny3d0fwMTodZyZ6JOzJZM2-8rIXjB7h37_Q,2421
|
|
8
|
+
eth_portfolio/_shitcoins.py,sha256=KGWUwrmS0S8ouIZhq_OhtottXjwV2wQYbnWKz2ubDHM,10892
|
|
9
|
+
eth_portfolio/_utils.py,sha256=HmeZhhkIMR_ghvJTpqVAJwnBv7239BMDQBDun8WpWwM,9117
|
|
10
|
+
eth_portfolio/address.py,sha256=xu7ZVvc96K9yaE3QJOvM7s530t3ax6wHU9RCPca8JSM,13599
|
|
11
|
+
eth_portfolio/buckets.py,sha256=ZqWyNvniQOfAw6JnRx8jljVAhemSv7xvfFGq4AG2tLk,5907
|
|
12
|
+
eth_portfolio/constants.py,sha256=L_iiL3QGz2VeFCgg5333Q66l-t7uDKftdel8CNnVP90,2356
|
|
13
|
+
eth_portfolio/portfolio.py,sha256=Rb3tKzICkWof1su31wlIoKpsgPICfiZJzCmGB2D9OoA,23045
|
|
14
|
+
eth_portfolio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
+
eth_portfolio/typing.py,sha256=q4O0dc4R0u2hIJMh7yZx0C-uaJ6VW-GexXZ4fcDRToU,58389
|
|
16
|
+
eth_portfolio/_db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
+
eth_portfolio/_db/decorators.py,sha256=QJooL70iW7VEfz4D1LEdzq9CacwjJ0BNFsg9d3sM87Q,5126
|
|
18
|
+
eth_portfolio/_db/entities.py,sha256=IscZejsWrWu0LmKvWOSsjqdgL3_JRMvRatu6TFg37zk,6867
|
|
19
|
+
eth_portfolio/_db/utils.py,sha256=LmglwyPQjPi0O46gaxsu38BLaz0qw1XuRbSs4P_6Z80,20706
|
|
20
|
+
eth_portfolio/_ledgers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
+
eth_portfolio/_ledgers/address.py,sha256=pAhZeveT_tOvE93V05yEFjCaBtBZJs6IRUji4OTnmMA,31339
|
|
22
|
+
eth_portfolio/_ledgers/portfolio.py,sha256=XZ9eVPpgEWuDCEXmIKdsnIB-wLPNQ_dWbm554d05KkE,13056
|
|
23
|
+
eth_portfolio/_loaders/__init__.py,sha256=lb45_0ak32Z7N3-Nx1CAoRKiZ1_w-_YGbmSCNuunro8,1702
|
|
24
|
+
eth_portfolio/_loaders/balances.py,sha256=SPWFSUMCO6Ex74BlpbEvvPKavtsAirkZRVsG2LhKysM,2754
|
|
25
|
+
eth_portfolio/_loaders/token_transfer.py,sha256=c9NGtkBENBIVKhukec__T4iWgf0835VcR10_W3aFKqE,8349
|
|
26
|
+
eth_portfolio/_loaders/transaction.py,sha256=o_taK8LEruxmiwWzetGOvSzQJWyyiKUgjzwWtqQxghY,13691
|
|
27
|
+
eth_portfolio/_loaders/utils.py,sha256=Za7o0c8sIFZtrV4Z1yWgLGr49ZONLtZ45xifWXblBVY,2003
|
|
28
|
+
eth_portfolio/_ydb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
|
+
eth_portfolio/_ydb/token_transfers.py,sha256=Vln7JN3WXabkZo9XBCHYlraKcdmcRYF1Zb95bwCBnAk,4937
|
|
30
|
+
eth_portfolio/protocols/__init__.py,sha256=lBCuoYnHqm415O3FYIk1yPc-Mt2AVeqAN75Jrqg7d4U,2582
|
|
31
|
+
eth_portfolio/protocols/_base.py,sha256=tJ8tJgLR6BtGov7ire3bXxWzmJOSI9LvdZMMen_v8Xg,3660
|
|
32
|
+
eth_portfolio/protocols/convex.py,sha256=uNbXxEmhcpXulNkbxoqWl9eAJTZjPJlzXFtrBGvRXLo,518
|
|
33
|
+
eth_portfolio/protocols/dsr.py,sha256=QpUhn3Ds_w8FWxURr60IMmd38FtFWcQsUhjdlUadZHw,1198
|
|
34
|
+
eth_portfolio/protocols/liquity.py,sha256=sTUoVtFYj-OWUamwCnJyqna-eAa5Ww7-qGA0St1OTMQ,640
|
|
35
|
+
eth_portfolio/protocols/lending/__init__.py,sha256=CZinbKLUXfzMhxr-nOygVoF6GsvK-R70HOouB1_AnY0,1669
|
|
36
|
+
eth_portfolio/protocols/lending/_base.py,sha256=UBdJ5eV2baewEvppjES72eOJzKTK2XHGYnySQNBcack,2254
|
|
37
|
+
eth_portfolio/protocols/lending/compound.py,sha256=IE3kXla6_4rjxES5HIUaktWM0KJeJpi0Y7x4i5VuiU4,7202
|
|
38
|
+
eth_portfolio/protocols/lending/liquity.py,sha256=Cpa7TcxZjOqcNIIqfKrx1bLRtKtVgNv13zeUR8ndDI0,4177
|
|
39
|
+
eth_portfolio/protocols/lending/maker.py,sha256=Oy9LDz71o6Dx-36pdLleBfHQPhJqvClK69Xi2rNRB3U,4008
|
|
40
|
+
eth_portfolio/protocols/lending/unit.py,sha256=kRCTHXj7TBH6qP4Uo-38AgPu_G85STA-dJGFrRQ99sE,1973
|
|
41
|
+
eth_portfolio/structs/__init__.py,sha256=3EmfKoJGszobO7fCkERLXSN50V6dX3nfhvbiKIvJUZI,1443
|
|
42
|
+
eth_portfolio/structs/modified.py,sha256=z75XDNXOfm3hDr7pj0PbmUvfPeQSFH9BJ9m0L2V_LFw,1784
|
|
43
|
+
eth_portfolio/structs/structs.py,sha256=UYBVPcar3uIid77p0sFzhlCHi7_Ftv-L8_CGBbhCnF0,19800
|
|
44
|
+
eth_portfolio-1.1.0.dist-info/METADATA,sha256=yS1jO6e0JbfFgVo1OCSKMq6Kmpqw8yV3OBJLyNs8v10,4990
|
|
45
|
+
eth_portfolio-1.1.0.dist-info/WHEEL,sha256=nn6H5-ilmfVryoAQl3ZQ2l8SH5imPWFpm1A5FgEuFV4,91
|
|
46
|
+
eth_portfolio-1.1.0.dist-info/top_level.txt,sha256=TErEJr45v_N_UfMO8_NWlZoYHn_M8dt7nw-ejsXJkMU,14
|
|
47
|
+
eth_portfolio-1.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
eth_portfolio
|