eth-portfolio-temp 0.0.24.dev0__tar.gz → 0.0.26.dev0__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.
Potentially problematic release.
This version of eth-portfolio-temp might be problematic. Click here for more details.
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/.github/workflows/mypy.yaml +2 -9
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/PKG-INFO +1 -1
- eth_portfolio_temp-0.0.26.dev0/docs/caching.rst +93 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/index.rst +1 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_db/entities.py +2 -2
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/dsr.py +11 -7
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/balances.py +11 -3
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/docker/docker_compose.py +10 -7
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_temp.egg-info/PKG-INFO +1 -1
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_temp.egg-info/SOURCES.txt +1 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_temp.egg-info/top_level.txt +1 -1
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/setup.py +2 -1
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/.env.sample +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/.github/workflows/black.yaml +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/.github/workflows/compile.yaml +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/.github/workflows/deploy_docs.yaml +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/.github/workflows/release.yaml +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/.gitignore +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/Makefile +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/README.md +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/brownie-config.yaml +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/Makefile +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/alabaster.css +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/basic.css +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/custom.css +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/doctools.js +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/documentation_options.js +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/file.png +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/language_data.js +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/minus.png +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/plus.png +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/pygments.css +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/searchtools.js +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/sphinx_highlight.js +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/conf.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/exporter.rst +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/make.bat +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/new-protocols.rst +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/__init__.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_argspec.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_cache.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_config.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_db/__init__.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_db/decorators.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_db/utils.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_decimal.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_decorators.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_exceptions.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_ledgers/__init__.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_ledgers/address.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_ledgers/portfolio.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_loaders/__init__.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_loaders/_nonce.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_loaders/balances.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_loaders/token_transfer.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_loaders/transaction.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_loaders/utils.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_shitcoins.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_submodules.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_utils.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_ydb/__init__.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_ydb/token_transfers.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/address.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/buckets.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/constants.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/portfolio.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/__init__.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/_base.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/convex.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/lending/README.md +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/lending/__init__.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/lending/_base.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/lending/compound.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/lending/liquity.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/lending/maker.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/lending/unit.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/liquity.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/py.typed +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/structs/__init__.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/structs/modified.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/structs/structs.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/typing/__init__.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/typing/balance/single.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/__init__.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/_args.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/_logging.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/_portfolio.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/_utils.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/docker/.grafana/dashboards/dashboards.yaml +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/docker/.grafana/dashboards/portfolio/Balances.json +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/docker/.grafana/datasources/datasources.yml +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/docker/__init__.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/docker/check.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/docker/docker-compose.yaml +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/main.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/py.typed +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/victoria/__init__.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/victoria/types.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_temp.egg-info/dependency_links.txt +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_temp.egg-info/entry_points.txt +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_temp.egg-info/not-zip-safe +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_temp.egg-info/requires.txt +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/pyproject.toml +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/requirements.txt +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/setup.cfg +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/tests/_test_completeness.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/tests/conftest.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/tests/fixtures.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/tests/protocols/test_external.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/tests/scripts/test_utils.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/tests/test_portfolio.py +0 -0
- {eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/tests/test_typing.py +0 -0
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/.github/workflows/mypy.yaml
RENAMED
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
fail-fast: false
|
|
17
17
|
matrix:
|
|
18
18
|
os: [ ubuntu-latest, macos-latest, windows-latest ]
|
|
19
|
-
pyversion: [ "3.
|
|
19
|
+
pyversion: [ "3.9", "3.10", "3.11", "3.12" ]
|
|
20
20
|
|
|
21
21
|
steps:
|
|
22
22
|
- name: Checkout
|
|
@@ -30,15 +30,8 @@ jobs:
|
|
|
30
30
|
with:
|
|
31
31
|
python-version: ${{ matrix.pyversion }}
|
|
32
32
|
|
|
33
|
-
- name: Install Poetry
|
|
34
|
-
uses: snok/install-poetry@v1
|
|
35
|
-
|
|
36
|
-
- name: Add Poetry to PATH on Windows
|
|
37
|
-
if: runner.os == 'Windows'
|
|
38
|
-
run: $env:Path += ";$env:USERPROFILE\.poetry\bin"
|
|
39
|
-
|
|
40
33
|
- name: Install Dependencies
|
|
41
|
-
run:
|
|
34
|
+
run: pip install -r requirements.txt
|
|
42
35
|
|
|
43
36
|
- name: Run MyPy
|
|
44
37
|
run: make mypy
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Caching in eth-portfolio
|
|
2
|
+
========================
|
|
3
|
+
|
|
4
|
+
Overview
|
|
5
|
+
--------
|
|
6
|
+
|
|
7
|
+
eth-portfolio uses multiple caching strategies to maximize performance, minimize redundant RPC/database calls, and provide fast access to frequently used data. These strategies closely mirror those in ypricemagic, with some eth_portfolio-specific extensions and customizations. For a detailed overview of the canonical caching system, see ypricemagic's [caching documentation](https://bobthebuidler.github.io/ypricemagic/caching.html).
|
|
8
|
+
|
|
9
|
+
Disk Caches
|
|
10
|
+
-----------
|
|
11
|
+
|
|
12
|
+
Local SQL Cache
|
|
13
|
+
~~~~~~~~~~~~~~~
|
|
14
|
+
|
|
15
|
+
- **Backend:** Pony ORM with SQLite (default, configurable via environment variables)
|
|
16
|
+
- **Location:** ``~/.ypricemagic/ypricemagic.sqlite``
|
|
17
|
+
- **Purpose:** Persistent storage for blockchain data, portfolio data, and cache metadata.
|
|
18
|
+
- **What is cached:**
|
|
19
|
+
- Blockchain data: chains, blocks, addresses, contracts, tokens, prices
|
|
20
|
+
- Portfolio data: transactions, internal transfers, token transfers, etc.
|
|
21
|
+
- Cache metadata
|
|
22
|
+
- **Implementation:** Entities defined in ``eth_portfolio/_db/entities.py``
|
|
23
|
+
- **Integration:** If ypricemagic is installed, eth_portfolio will automatically extend and share the same persistent SQL database, unifying cached data and utility functions.
|
|
24
|
+
|
|
25
|
+
Disk Function Result Cache
|
|
26
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
27
|
+
|
|
28
|
+
- **Backend:** Custom ``cache_to_disk`` decorator (see ``eth_portfolio/_cache.py``)
|
|
29
|
+
- **Location:** ``./cache/{chain.id}/...`` (per-chain)
|
|
30
|
+
- **Purpose:** Disk-based function result caching for expensive or slow-to-compute results.
|
|
31
|
+
- **Usage:** Decorate functions with ``@cache_to_disk`` to persist results to disk.
|
|
32
|
+
- **Note:** While ypricemagic uses ``joblib.Memory`` for this purpose, eth_portfolio implements a functionally similar in-house solution.
|
|
33
|
+
|
|
34
|
+
In-Memory LRU Caches
|
|
35
|
+
--------------------
|
|
36
|
+
|
|
37
|
+
Synchronous LRU Caches
|
|
38
|
+
~~~~~~~~~~~~~~~~~~~~~~
|
|
39
|
+
|
|
40
|
+
- **functools.lru_cache:** Used for pure in-memory caching of function results, especially for database reads (see ``db_session_cached`` in ``eth_portfolio/_db/utils.py``).
|
|
41
|
+
- **functools.cached_property:** Used for property-level in-memory caching throughout the codebase.
|
|
42
|
+
|
|
43
|
+
Asynchronous LRU Caches
|
|
44
|
+
~~~~~~~~~~~~~~~~~~~~~~~
|
|
45
|
+
|
|
46
|
+
- **async_lru.alru_cache:** Used extensively for async LRU caching of coroutine results (e.g., token metadata, block lookups, protocol-specific data). Some usages include TTLs (e.g., 1 hour, 5 minutes) for time-limited caching.
|
|
47
|
+
|
|
48
|
+
What is LRU-cached
|
|
49
|
+
~~~~~~~~~~~~~~~~~~
|
|
50
|
+
|
|
51
|
+
- Token metadata (symbols, decimals, names, buckets)
|
|
52
|
+
- Contract ABIs and deploy blocks
|
|
53
|
+
- Block/timestamp lookups
|
|
54
|
+
- Price data
|
|
55
|
+
- Protocol-specific data
|
|
56
|
+
- Results of expensive on-chain or DB queries
|
|
57
|
+
|
|
58
|
+
Cache Control
|
|
59
|
+
~~~~~~~~~~~~~
|
|
60
|
+
|
|
61
|
+
- Some caches have TTLs (time-limited)
|
|
62
|
+
- Some caches are per-chain (partitioned by chain ID)
|
|
63
|
+
- Some caches are unlimited size
|
|
64
|
+
- Caches are generally transparent to the user; cache control parameters (e.g., skip_cache) may exist at the function level
|
|
65
|
+
|
|
66
|
+
Summary Table
|
|
67
|
+
-------------
|
|
68
|
+
|
|
69
|
+
+-------------------+--------------------------+-----------------------------+-----------------------------+-------------+
|
|
70
|
+
| Cache Type | Library/Decorator | Example Usage | What is Cached | Sync/Async |
|
|
71
|
+
+===================+==========================+=============================+=============================+=============+
|
|
72
|
+
| Local SQL | Pony ORM (SQLite) | _db/entities.py | Blockchain, portfolio data | Sync |
|
|
73
|
+
+-------------------+--------------------------+-----------------------------+-----------------------------+-------------+
|
|
74
|
+
| Disk Function | cache_to_disk (custom) | _cache.py | Function results | Sync/Async |
|
|
75
|
+
+-------------------+--------------------------+-----------------------------+-----------------------------+-------------+
|
|
76
|
+
| LRU (in-memory) | functools.lru_cache | _db/utils.py | DB reads | Sync |
|
|
77
|
+
+-------------------+--------------------------+-----------------------------+-----------------------------+-------------+
|
|
78
|
+
| LRU (in-memory) | functools.cached_property| _utils.py, etc. | Property values | Sync |
|
|
79
|
+
+-------------------+--------------------------+-----------------------------+-----------------------------+-------------+
|
|
80
|
+
| LRU (in-memory) | async_lru.alru_cache | _utils.py, _ledgers/, etc. | Async function results | Async |
|
|
81
|
+
+-------------------+--------------------------+-----------------------------+-----------------------------+-------------+
|
|
82
|
+
|
|
83
|
+
References
|
|
84
|
+
----------
|
|
85
|
+
|
|
86
|
+
- Canonical ypricemagic caching docs: https://bobthebuidler.github.io/ypricemagic/caching.html
|
|
87
|
+
- ``eth_portfolio/_cache.py``
|
|
88
|
+
- ``eth_portfolio/_db/entities.py``
|
|
89
|
+
- ``eth_portfolio/_db/utils.py``
|
|
90
|
+
- ``eth_portfolio/_utils.py``
|
|
91
|
+
- ``eth_portfolio/_ledgers/``
|
|
92
|
+
- ``eth_portfolio/_loaders/``
|
|
93
|
+
- ``eth_portfolio/protocols/``
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_db/entities.py
RENAMED
|
@@ -36,7 +36,7 @@ class AddressExtended(Address):
|
|
|
36
36
|
"""
|
|
37
37
|
Extends the base Address entity to add relationships for sent/received transactions, internal transfers, and token transfers.
|
|
38
38
|
"""
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
if typing.TYPE_CHECKING:
|
|
41
41
|
# if we execute this code we get `TypeError: 'type' object is not subscriptable`
|
|
42
42
|
transactions_sent: Set["Transaction"]
|
|
@@ -75,7 +75,7 @@ class TokenExtended(Token, AddressExtended):
|
|
|
75
75
|
"""
|
|
76
76
|
Extends both Token and AddressExtended to represent a token contract with address relationships.
|
|
77
77
|
"""
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
if typing.TYPE_CHECKING:
|
|
80
80
|
# if we execute this code we get `TypeError: 'type' object is not subscriptable`
|
|
81
81
|
transfers: Set["TokenTransfer"]
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/dsr.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
from typing import Final, Optional
|
|
2
|
+
from typing import ClassVar, Final, Optional, final
|
|
3
3
|
|
|
4
4
|
import y
|
|
5
5
|
from y.datatypes import Address, Block
|
|
@@ -19,23 +19,27 @@ dai: Final = y.dai
|
|
|
19
19
|
Decimal: Final = _decimal.Decimal
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
@final
|
|
22
23
|
class MakerDSR(ProtocolABC):
|
|
23
|
-
networks = [Network.Mainnet]
|
|
24
|
+
networks: ClassVar = [Network.Mainnet]
|
|
24
25
|
|
|
25
26
|
def __init__(self) -> None:
|
|
26
27
|
dsr_manager = "0x373238337Bfe1146fb49989fc222523f83081dDb"
|
|
27
28
|
pot = "0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7"
|
|
28
|
-
self.dsr_manager = Contract(dsr_manager)
|
|
29
|
-
self.pot = Contract(pot)
|
|
30
|
-
self._start_block = max(
|
|
31
|
-
|
|
29
|
+
self.dsr_manager: Final = Contract(dsr_manager)
|
|
30
|
+
self.pot: Final = Contract(pot)
|
|
31
|
+
self._start_block: Final = max(
|
|
32
|
+
contract_creation_block(dsr_manager), contract_creation_block(pot)
|
|
33
|
+
)
|
|
34
|
+
self._get_chi: Final = self.pot.chi.coroutine
|
|
35
|
+
self._get_pie: Final = self.dsr_manager.pieOf.coroutine
|
|
32
36
|
|
|
33
37
|
async def _balances(self, address: Address, block: Optional[Block] = None) -> TokenBalances:
|
|
34
38
|
balances = TokenBalances(block=block)
|
|
35
39
|
if block and block < self._start_block:
|
|
36
40
|
return balances
|
|
37
41
|
pie, exchange_rate = await gather(
|
|
38
|
-
self.
|
|
42
|
+
self._get_pie(address, block_identifier=block),
|
|
39
43
|
self._exchange_rate(block),
|
|
40
44
|
)
|
|
41
45
|
if pie:
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/balances.py
RENAMED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
+
from argparse import Namespace
|
|
1
2
|
from datetime import datetime, timezone
|
|
3
|
+
from typing import Final
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
import a_sync
|
|
6
|
+
import a_sync.asyncio
|
|
5
7
|
|
|
6
8
|
from eth_portfolio_scripts import docker
|
|
7
9
|
from eth_portfolio_scripts._utils import aiter_timestamps, parse_timedelta
|
|
8
10
|
|
|
9
11
|
|
|
12
|
+
_UTC: Final = timezone.utc
|
|
13
|
+
|
|
14
|
+
create_task: Final = a_sync.create_task
|
|
15
|
+
yield_to_loop: Final = a_sync.asyncio.sleep0
|
|
16
|
+
|
|
17
|
+
|
|
10
18
|
@docker.ensure_containers
|
|
11
|
-
async def export_balances(args):
|
|
19
|
+
async def export_balances(args: Namespace) -> None:
|
|
12
20
|
import dank_mids
|
|
13
21
|
|
|
14
22
|
from eth_portfolio_scripts._portfolio import ExportablePortfolio
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from functools import wraps
|
|
3
|
+
from importlib import resources
|
|
3
4
|
from os import path
|
|
4
5
|
from subprocess import CalledProcessError, check_output
|
|
5
|
-
from typing import Callable, Iterable, Tuple, TypeVar
|
|
6
|
+
from typing import Callable, Final, Iterable, List, Tuple, TypeVar
|
|
6
7
|
|
|
7
8
|
from typing_extensions import ParamSpec
|
|
8
9
|
|
|
9
10
|
from eth_portfolio_scripts.docker.check import check_system
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
logger = logging.getLogger(__name__)
|
|
13
|
+
logger: Final = logging.getLogger(__name__)
|
|
13
14
|
|
|
14
|
-
compose_file =
|
|
15
|
+
compose_file: Final = str(
|
|
16
|
+
resources.files("eth_portfolio_scripts").joinpath("docker/docker-compose.yaml")
|
|
17
|
+
)
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
def up(*services: str) -> None:
|
|
@@ -44,7 +47,7 @@ _T = TypeVar("_T")
|
|
|
44
47
|
|
|
45
48
|
def ensure_containers(fn: Callable[_P, _T]) -> Callable[_P, _T]:
|
|
46
49
|
@wraps(fn)
|
|
47
|
-
async def compose_wrap(*args: _P.args, **kwargs: _P.kwargs):
|
|
50
|
+
async def compose_wrap(*args: _P.args, **kwargs: _P.kwargs) -> _T:
|
|
48
51
|
# register shutdown sequence
|
|
49
52
|
# TODO: argument to leave them up
|
|
50
53
|
# NOTE: do we need both this and the finally?
|
|
@@ -55,16 +58,16 @@ def ensure_containers(fn: Callable[_P, _T]) -> Callable[_P, _T]:
|
|
|
55
58
|
|
|
56
59
|
try:
|
|
57
60
|
# attempt to run `fn`
|
|
58
|
-
await fn(*args, **kwargs)
|
|
61
|
+
return await fn(*args, **kwargs)
|
|
59
62
|
finally:
|
|
60
63
|
# stop and remove containers
|
|
61
64
|
# down()
|
|
62
|
-
|
|
65
|
+
pass
|
|
63
66
|
|
|
64
67
|
return compose_wrap
|
|
65
68
|
|
|
66
69
|
|
|
67
|
-
def _exec_command(command:
|
|
70
|
+
def _exec_command(command: List[str], *, compose_options: Tuple[str, ...] = ()) -> None:
|
|
68
71
|
check_system()
|
|
69
72
|
try:
|
|
70
73
|
check_output(["docker", "compose", *compose_options, "-f", compose_file, *command])
|
|
@@ -59,10 +59,11 @@ try:
|
|
|
59
59
|
"eth_portfolio/_shitcoins.py",
|
|
60
60
|
# "eth_portfolio/_submodules.py",
|
|
61
61
|
"eth_portfolio/constants.py",
|
|
62
|
+
"eth_portfolio_scripts/docker",
|
|
62
63
|
# "eth_portfolio_scripts/victoria/__init__.py", # this one built fine with other files but wont alone
|
|
63
64
|
# "eth_portfolio_scripts/_portfolio.py",
|
|
64
65
|
# "eth_portfolio_scripts/_utils.py",
|
|
65
|
-
|
|
66
|
+
"eth_portfolio_scripts/balances.py",
|
|
66
67
|
"--strict",
|
|
67
68
|
"--pretty",
|
|
68
69
|
"--install-types",
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/.github/workflows/black.yaml
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/.github/workflows/compile.yaml
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/.github/workflows/deploy_docs.yaml
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/.github/workflows/release.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/basic.css
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/file.png
RENAMED
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/minus.png
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/docs/_build/html/_static/plus.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_db/__init__.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_db/decorators.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_db/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_decorators.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_exceptions.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_ledgers/__init__.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_ledgers/address.py
RENAMED
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_loaders/__init__.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_loaders/_nonce.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_loaders/balances.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_loaders/utils.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_shitcoins.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_submodules.py
RENAMED
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/_ydb/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/constants.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/portfolio.py
RENAMED
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/_base.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/convex.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/protocols/liquity.py
RENAMED
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/structs/__init__.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/structs/modified.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/structs/structs.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio/typing/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/__init__.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/_args.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/_logging.py
RENAMED
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/main.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/eth_portfolio_scripts/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/tests/_test_completeness.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/tests/protocols/test_external.py
RENAMED
|
File without changes
|
{eth_portfolio_temp-0.0.24.dev0 → eth_portfolio_temp-0.0.26.dev0}/tests/scripts/test_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|