1
0
Python library for programmating downloads of asset position information from personal depository accounts.
Go to file
2024-12-14 23:38:47 +01:00
.gitea/workflows 🤖 Repository layout updated to latest version 2024-10-20 20:07:57 +02:00
fin_depo Kucoin order details now handle pagination correctly 2024-12-14 23:38:47 +01:00
test Ruff 2024-12-02 18:57:16 +01:00
.gitignore 🤖 Repository layout updated to latest Python version 2024-06-13 22:01:55 +02:00
LICENSE 🤖 Repository layout updated to latest version 2024-07-16 22:15:42 +02:00
README.md 🤖 Repository layout updated to latest version 2024-12-02 18:29:09 +01:00
requirements_test.txt Fix requirements 2024-07-19 01:04:00 +02:00
requirements.txt Add forgotten requirement 2024-12-02 18:28:49 +01:00
ruff.toml 🤖 Repository layout updated to latest version 2024-10-31 22:38:54 +01:00
setup.py 🤖 Repository layout updated to latest version 2024-12-02 18:29:09 +01:00

Financial Depository Fetchers

Test program/library Codequality (Ruff)

Python library for programmatic download 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 ordinary 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.

Supported websites/services

Service Description Read assets Swap assets
Kraken Crypto-currency exchange (KrakenDepoFetcher): Uses their publicly documented API. This provides the same data as the homepage.
Kucoin Crypto-currency exchange (KucoinDepoFetcher): Uses their publicly documented API. 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 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 Nordic investment bank (NordnetDepoFetcher): Uses their API. Thanks to Morten Helmstedt for sharing his Nordnet utilities, which helped with implementing this functionality. Exposes the same data as the home page.

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:

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:

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

Future extension

  • Investment Bank: Saxo Bank OpenAPI
  • Personal Bank: Personal Bank Account (Open Banking).
    • Maybe using Enable Banking? They seem to allow developers to access their own accounts in a sort of half production half demo environment.
    • AIIA is also a possiblity?
  • Partisia Blockchain: Implement sharding routing correctly.
  • 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.

Dependencies

All requirements can be installed easily using:

pip install -r requirements.txt

Full list of requirements:

License

MIT License

Copyright (c) 2024 Jon Michael Aanes

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.