86 lines
3.0 KiB
Python
86 lines
3.0 KiB
Python
"""# Financial Depository Fetchers.
|
|
|
|
Python library for programmating downloads of asset position information from
|
|
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,
|
|
it is hugely difficult for people to access and control their own personal
|
|
financial information.
|
|
|
|
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).
|
|
|
|
## Supported websites/services
|
|
|
|
- [**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 (`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.
|
|
|
|
## Future extension
|
|
|
|
- [ ] Investment Bank: Saxo Bank OpenAPI
|
|
- [ ] Personal Bank: Personal Bank Account (Open Banking) Maybe use AIIA?
|
|
"""
|
|
|
|
__all__ = [
|
|
'defi_kraken',
|
|
'defi_kucoin',
|
|
'defi_partisia_blockchain',
|
|
'investbank_nordnet',
|
|
'__version__',
|
|
'data',
|
|
'static',
|
|
]
|
|
|
|
import importlib
|
|
import logging
|
|
|
|
from . import (
|
|
data,
|
|
static,
|
|
)
|
|
from ._version import __version__
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def load_backend(name: str) -> object | None:
|
|
try:
|
|
return importlib.import_module(f'{__name__}.{name}')
|
|
except Exception:
|
|
logger.exception(
|
|
'Backend %s could not be imported? Are all module dependencies installed?',
|
|
name,
|
|
)
|
|
return None
|
|
|
|
# Import modules
|
|
|
|
defi_kraken = load_backend('defi_kraken')
|
|
defi_kucoin = load_backend('defi_kucoin')
|
|
investbank_nordnet = load_backend('investbank_nordnet')
|
|
defi_partisia_blockchain = load_backend('defi_partisia_blockchain')
|