2024-05-29 19:54:45 +00:00
|
|
|
|
# WARNING
|
|
|
|
|
#
|
|
|
|
|
# THIS IS AN AUTOGENERATED FILE.
|
|
|
|
|
#
|
|
|
|
|
# MANUAL CHANGES CAN AND WILL BE OVERWRITTEN.
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
from setuptools import setup
|
|
|
|
|
|
|
|
|
|
PACKAGE_NAME = 'fin_depo'
|
|
|
|
|
|
2024-07-08 18:22:14 +00:00
|
|
|
|
PACKAGE_DESCRIPTION = """
|
|
|
|
|
# Financial Depository Fetchers.
|
|
|
|
|
|
2024-11-28 20:03:50 +00:00
|
|
|
|
Python library for programmatic download of asset position information from
|
2024-07-22 15:00:07 +00:00
|
|
|
|
personal depository accounts.
|
|
|
|
|
|
|
|
|
|
This library is a core part of my personal financial applications, as it allows
|
|
|
|
|
me to monitor my investments on financial markets and web3 investments.
|
|
|
|
|
|
|
|
|
|
A lot can be said (mostly negative) about web3, but at least they are serious
|
|
|
|
|
about API access, which the modern banking system is not great at providing.
|
|
|
|
|
Even in The European Union, where GDPR is law and OpenBanking is a requirement,
|
2024-11-28 20:03:50 +00:00
|
|
|
|
it is hugely difficult for ordinary people to access and control their own
|
|
|
|
|
personal financial information.
|
2024-07-22 15:00:07 +00:00
|
|
|
|
|
|
|
|
|
This is a library; if you want a simple program for downloading the information
|
|
|
|
|
exposed by one of the supported services, try [my personal-data-fetchers
|
|
|
|
|
program](https://gitfub.space/Jmaa/personal-data-fetchers).
|
2024-07-08 18:22:14 +00:00
|
|
|
|
|
2024-07-20 20:12:09 +00:00
|
|
|
|
## Supported websites/services
|
|
|
|
|
|
2024-11-29 00:27:46 +00:00
|
|
|
|
| Service | Description | Read assets | Swap assets |
|
|
|
|
|
| :-: | --- | :-: | :-: |
|
2024-11-29 00:26:23 +00:00
|
|
|
|
| [**Kraken**](https://www.kraken.com/) | Crypto-currency exchange (`KrakenDepoFetcher`): Uses their [publicly documented API](https://docs.kraken.com/rest/). This provides the same data as the homepage. | ✅︎ | |
|
|
|
|
|
| [**Kucoin**](https://www.kucoin.com/) | Crypto-currency exchange (`KucoinDepoFetcher`): Uses their [publicly documented API](https://www.kucoin.com/docs/beginners/introduction). This provides the same data as is available on the Assets Overview Page. This fetcher also allows for placing market orders, but be careful with this functionality. | ✅︎ | ✅︎ |
|
|
|
|
|
| [**Partisia Blockchain**](https://browser.partisiablockchain.com/) | Wallet balances on Partisia Blockchain (`PartisiaBlockchainAccountDepoFetcher`): Uses a public reader node to check the account state. This is the same data as can be found in the Partisia Browser Assets page. | ✅︎ | |
|
|
|
|
|
| [**Nordnet**](https://www.nordnet.dk) | Nordic investment bank (`NordnetDepoFetcher`): Uses their [API](https://www.nordnet.dk/externalapi/docs/api). Thanks to [Morten Helmstedt](https://helmstedt.dk/) for sharing his [Nordnet utilities](https://github.com/helmstedt/nordnet-utilities), which helped with implementing this functionality. Exposes the same data as the home page. | ✅︎ | |
|
2024-07-20 20:05:36 +00:00
|
|
|
|
|
2024-11-28 23:45:48 +00:00
|
|
|
|
## Example Application
|
|
|
|
|
|
|
|
|
|
The library ships with an example application in the form of a CLI program that
|
|
|
|
|
can display a tree representation of assets in known depositories:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
python -m fin_depo
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Example output:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Aggregated
|
|
|
|
|
├─ Kraken
|
|
|
|
|
│ ├─ BTC 0.00871009
|
|
|
|
|
│ └─ EUR 200.5
|
|
|
|
|
└─ Kucoin
|
|
|
|
|
├─ Kucoin trade
|
|
|
|
|
│ ├─ BTC 0.00169297
|
|
|
|
|
│ └─ USDT 20
|
|
|
|
|
└─ Kucoin main
|
|
|
|
|
├─ BTC 0
|
|
|
|
|
└─ USDT 40
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
Using the Kraken API as an example:
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
depo_fetcher = fin_depo.defi_kraken.KrakenDepoFetcher(
|
|
|
|
|
KRAKEN_KEY, KRAKEN_SECRET,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
depo = depo_fetcher.get_depo()
|
|
|
|
|
|
|
|
|
|
depo.assets()
|
|
|
|
|
> [BTC, USDT]
|
|
|
|
|
|
|
|
|
|
depo.get_amount_of_asset(BTC)
|
|
|
|
|
> 0.1
|
|
|
|
|
```
|
|
|
|
|
|
2024-07-20 20:05:36 +00:00
|
|
|
|
## Future extension
|
2024-07-08 18:22:14 +00:00
|
|
|
|
|
|
|
|
|
- [ ] Investment Bank: Saxo Bank OpenAPI
|
2024-11-28 20:03:50 +00:00
|
|
|
|
- [ ] Personal Bank: Personal Bank Account (Open Banking).
|
|
|
|
|
* Maybe using [Enable Banking](https://enablebanking.com/)? They seem to
|
|
|
|
|
allow developers to access their own accounts in a sort of half production
|
|
|
|
|
half demo environment.
|
|
|
|
|
* [AIIA](https://www.aiia.eu/) is also a possiblity?
|
2024-11-01 22:19:00 +00:00
|
|
|
|
- [ ] Partisia Blockchain: Implement sharding routing correctly.
|
2024-11-28 20:03:50 +00:00
|
|
|
|
- [ ] Depository history: Allow users to query both the state of their deposity
|
|
|
|
|
in the past, and to allow them to query the transactions.
|
|
|
|
|
* Most backends only support listing the transactions themselves, so the
|
|
|
|
|
depository history needs to be computed backwards from these.
|
2024-08-02 15:15:18 +00:00
|
|
|
|
""".strip()
|
2024-07-08 18:22:14 +00:00
|
|
|
|
|
2024-07-16 20:18:13 +00:00
|
|
|
|
PACKAGE_DESCRIPTION_SHORT = """
|
2024-11-28 20:03:50 +00:00
|
|
|
|
Python library for programmatic download of asset position information from
|
2024-07-22 15:00:07 +00:00
|
|
|
|
personal depository accounts.""".strip()
|
2024-07-10 21:39:53 +00:00
|
|
|
|
|
2024-06-03 20:37:42 +00:00
|
|
|
|
|
2024-05-29 19:54:45 +00:00
|
|
|
|
def parse_version_file(text: str) -> str:
|
|
|
|
|
match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text)
|
|
|
|
|
if match is None:
|
|
|
|
|
msg = 'Malformed _version.py file!'
|
|
|
|
|
raise Exception(msg)
|
|
|
|
|
return match.group(2)
|
|
|
|
|
|
2024-06-03 20:37:42 +00:00
|
|
|
|
|
2024-05-29 19:54:45 +00:00
|
|
|
|
with open(PACKAGE_NAME + '/_version.py') as f:
|
|
|
|
|
version = parse_version_file(f.read())
|
|
|
|
|
|
2024-06-03 20:37:42 +00:00
|
|
|
|
|
2024-08-08 15:38:09 +00:00
|
|
|
|
REQUIREMENTS_MAIN = [
|
2024-08-08 15:56:14 +00:00
|
|
|
|
'enforce-typing',
|
|
|
|
|
'python-kucoin',
|
|
|
|
|
'krakenex',
|
|
|
|
|
'frozendict',
|
|
|
|
|
'fin-defs @ git+https://gitfub.space/Jmaa/fin-defs.git',
|
2024-08-08 15:38:09 +00:00
|
|
|
|
]
|
|
|
|
|
REQUIREMENTS_TEST = [
|
2024-08-08 15:56:14 +00:00
|
|
|
|
'pytest',
|
|
|
|
|
'secret_loader @ git+https://gitfub.space/Jmaa/secret_loader.git',
|
2024-08-08 15:38:09 +00:00
|
|
|
|
]
|
2024-05-29 19:54:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setup(
|
|
|
|
|
name=PACKAGE_NAME,
|
|
|
|
|
version=version,
|
2024-07-08 18:22:14 +00:00
|
|
|
|
description=PACKAGE_DESCRIPTION_SHORT,
|
|
|
|
|
long_description=PACKAGE_DESCRIPTION,
|
2024-05-29 19:54:45 +00:00
|
|
|
|
long_description_content_type='text/markdown',
|
2024-07-09 21:59:54 +00:00
|
|
|
|
author='Jon Michael Aanes',
|
2024-05-29 19:54:45 +00:00
|
|
|
|
author_email='jonjmaa@gmail.com',
|
|
|
|
|
url='https://gitfub.space/Jmaa/' + PACKAGE_NAME,
|
|
|
|
|
packages=[PACKAGE_NAME],
|
2024-08-08 15:38:09 +00:00
|
|
|
|
install_requires=REQUIREMENTS_MAIN,
|
2024-05-29 19:54:45 +00:00
|
|
|
|
extras_require={
|
2024-08-08 15:38:09 +00:00
|
|
|
|
'test': REQUIREMENTS_TEST,
|
2024-05-29 19:54:45 +00:00
|
|
|
|
},
|
|
|
|
|
python_requires='>=3.9',
|
|
|
|
|
)
|