An unofficial python wrapper for the comdirect API for private consumers.

Overview

Comdirect API

This is an unofficial python wrapper for the comdirect API for private consumers (April 2020).

This package currently supports the following operations:

  • Read balances and transactions
  • Read depot information
  • Read and download Documents
  • Read and update orders
  • Read instrument information
  • Export and import the session

Use at your own risk.

Install

Install the package using pip

pip install comdirect-api-simple

Usage

Initialize the client:

from comdirect_api.comdirect_client import ComdirectClient

client_id = '
   
    '
   
client_secret = '
   
    '
   
client = ComdirectClient(client_id, client_secret)

Login with your credentials like so:

user = 'your_zugangsnummer'
password = 'your_pin'
client.fetch_tan(user, password)

After confirming the login on your photoTAN app you can activate your session.

client.activate_session()

You can refresh your token with:

client.refresh_token()

The the client is now ready for use, for example:

balances = client.get_all_balances()
print(balances['values'])

It is also possible to send a GET request to a self defined endpoint, for example:

client.get('reports/participants/user/v1/allbalances', productType='ACCOUNT')

List all the complete order-book and filter for OPEN orders:

data = client.get_all_orders(depotId, order_status='OPEN')
print(data)

You can change an OPEN order as follows:

orderId = 'XXYYYAA...'
order = client.get_order(orderId)
order['triggerLimit']['value'] = '16.6'
[challenge_id, challenge] = client.set_order_change_validation(orderId, order)
orderChanged=client.set_order_change(orderId, data, challenge_id)

To export the session you can use

client.activate_session()
...
client.session_export()

To import it in another instance call:

client = ComdirectClient('client_id', 'client_secret', import_session=True)

More information about the official API can be found at https://developer.comdirect.de

Comments
  • GET account transactions, incomplete list of transactions / page count does not work

    GET account transactions, incomplete list of transactions / page count does not work

    Hi, first of all, thanks for this well-packed API!

    While I was trying to put together my first python program interacting with this API, I stumbled upon an issue, which I am not sure if it's mine / this API or (probably) comdirect fault.

    If I try to retrieve all my transactions:

    transactions = client.get('/banking/v1/accounts/{}/transactions'.format(accountId))
    print (json.dumps(transactions['paging'], sort_keys=True, indent=4))
    >>> {
        "index": 0,
        "matches": 46
    }
    

    As I got much more than 46 transactions, something is going wrong. Trying with:

    transactions = client.get_account_transactions(accountId)
    

    returns the same results. Ideas? Is it an intrinsic limit of this API? While trying to dig into this issue I dug into get_account_transactions function and found the paging_count and paging_first parameters. Those are not documented in the official PDF/Postman JSON and manipulating them does not give any different results.. does anyone had successfully tested them?

    Thanks!

    opened by itaBlackHawk 5
  • Add depot transaction method

    Add depot transaction method

    Implemented get_depot_transactions(). Note: when testing, it seems that some filtering methods do not work on the comdirect side. Or they are not properly documented...

    opened by SanMiggel 1
  • Feature request: Support stock transactions

    Feature request: Support stock transactions

    Hi Alex,

    first of all great project and thanks for your effort! I am planning to use it to monitor my stocks, but would need support for some more API functions, especially transactions. I would be very happy to contribute and add the functionality myselft.

    Question: Are you interested in extending this codebase? In that case, I would work on top of this repository and send you a few pull requests. If not, I would work on my own fork.

    Best Michael

    opened by SanMiggel 1
  • get_account_transactions - URL

    get_account_transactions - URL

    Current url isn't working. I changed v2 to v1 and it worked. Official url form the Comdirect Postman import is: {{url}}/banking/v1/accounts/{{accountUUID}}/transactions

    bug 
    opened by alex21289 1
  • Bump certifi from 2021.5.30 to 2022.12.7

    Bump certifi from 2021.5.30 to 2022.12.7

    Bumps certifi from 2021.5.30 to 2022.12.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Problems with refresh_token()

    Problems with refresh_token()

    Hello, thanks so much for sharing this! It works really well so far, just using refresh_token() gives huzzles. After calling it, it might be that one or two following other API-calls still work, but then get a "401 - unauthorized" and need to re-authenticate with an M_TAN. Your code looks perfectly fine and is following the spec, maybe it only works with P_TAN?

    This is what I do, to test it:

    I have an 'ini.py' file where I do the TAN-dance once and export the session:

    from comdirect_api.comdirect_client import ComdirectClient
    client = ComdirectClient(client_id, client_secret)
    client.fetch_tan(userId, pin)
    tan = input('Enter TAN:')
    client.activate_session(tan)
    client.session_export()
    

    And then run it of the command-line python3 ini.py, which works fine.

    Then I import the session in another file called 'main.js' and do some API-calls:

    from comdirect_api.comdirect_client import ComdirectClient
    client = ComdirectClient(client_id, client_secret, import_session=True)
    balances = client.get_all_balances()
    print(balances)
    

    I can execute main.py flawlessly for the next ten minutes, before the token expires. However whenever I add the line client.refresh_token() to main.py, the next one or two calls work, but then get 401.

    bug 
    opened by martinbannert 5
Releases(v0.0.15)
Owner
Alexander Knittel
Alexander Knittel
A Telegram Bot to manage your music channel with some cool features.

Music Channel Manager V2 A Telegram Bot to manage your music channel with some cool features like appending your predefined username to the musics tag

11 Oct 21, 2022
A python discord client interaction emulator for the DC29 badge code channel

dc29-discord-signalbot A python discord client interaction emulator for the DC29 badge code channel Prep Open Developer mode Open the developer mode f

8 Aug 23, 2021
AWS DeepRacer Free Student Workshop: Run faster by using your custom waypoints

AWS DeepRacer Free Student Workshop: Run faster by using your custom waypoints Reward Function Template for waypoints def reward_function(params):

Yuen Cheuk Lam 88 Nov 27, 2022
Telegram Reporter

[Telegram Reporter v.3 ] 🇮🇷 AliCybeRR 🇮🇷 [ AliCybeRR.Reporter feature ] Login Your Telegram account 👽 support Termux ❕ No Limits ⚡ Secure 🔐 Free

AliCybeRR 1 Jun 08, 2022
💰 Import your ING Germany bank statements via FinTS into YNAB.

Import your ING Germany bank statements via FinTS into YNAB. Setup Before setting this up, please register your FinTS product – it's free and takes on

Arne Bahlo 23 Jan 21, 2022
An API Wrapper for Gofile API

Gofile2 from gofile2 import Gofile g_a = Gofile() print(g_a.upload(file="/home/itz-fork/photo.png")) An API Wrapper for Gofile API. About API Gofile

I'm Not A Bot #Left_TG 16 Dec 10, 2022
Apps related to Odoo it's calendar features

calendar Apps related to Odoo it's calendar/appointments features: online_appointment_locations: allow setting an online URL per employee online_appoi

Yenthe Van Ginneken 3 Oct 27, 2022
PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

PRAW: The Python Reddit API Wrapper PRAW, an acronym for "Python Reddit API Wrapper", is a Python package that allows for simple access to Reddit's AP

Python Reddit API Wrapper Development 3k Dec 29, 2022
A lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos.

24 July 2020 Actively soliciting contributers! Ping @ronncc if you would like to help out! pytube pytube is a very serious, lightweight, dependency-fr

pytube 7.9k Jan 02, 2023
Практическая работа 6 - Документирование кода

Практическая работа №6 ПСП – правильная скобочная последовательность – последовательность из открывающих «(« и закрывающих «)» круглых скобок. Програм

0 Apr 14, 2022
A Telegram bot to upload files from Telegram or Direct links to Google Drive.

Google Drive Uploader Telegram Bot A Telegram bot to upload files from Telegram or Direct links to Google Drive. Features Telegram files support. Dire

IDNCoderX 21 Dec 05, 2022
Monitor your Binance portfolio

Binance Report Bot The intent of this bot is to take a snapshot of your binance wallet, e.g. the current balances and store it for further plotting. I

37 Oct 29, 2022
Powerful Telegram Members Scraping and Adding Toolkit

🔥 Genisys V2.1 Powerful Telegram Members Scraping and Adding Toolkit 🔻 Features 🔺 ADDS IN BULK[by user id, not by username] Scrapes and adds to pub

The Cryptonian 16 Mar 01, 2022
A telegram bot to track whales activities on multiple blockchains.

Telegram Bot : Whale Watcher A straightforward telegram bot written in python to track whales activity on multiple blockchains, using whale-alert API

Laurenz Bougan 1 Dec 10, 2021
ServiceX DID Finder Girder

ServiceX_DID_Finder_Girder Access datasets for ServiceX from yt Hub Finding datasets This DID finder is designed to take a collection id (https://gird

1 Dec 07, 2021
A Telegram Bot written in Python for mirroring files on the Internet to Google Drive

No support is going to be provided of any kind, only maintaining this for vps user on request. This is a Telegram Bot written in Python for mirroring

0 Dec 26, 2021
An example of matrix addition, demonstrating the basic method of Python calling C library functions

Example for Python call C functions An example of matrix addition, demonstrating the basic method of Python calling C library functions. How to run Bu

Quantum LIu 2 Dec 21, 2021
Telegram RAT written in Python

teleRAT Python based RAT that uses Telegram for sending commands and receiving data to and from a victim computer. Setup.py Insert your API key into t

96 Jan 01, 2023
AWS Workmail Migration Tool

WMigrate A tool for migrating AWS Workmail Users and Groups cross region and cross accounts. It also creates user and group aliases and adds the users

NK 1 Oct 27, 2021
Bagas Mirror&Leech Bot is a multipurpose Telegram Bot written in Python for mirroring files on the Internet to our beloved Google Drive. Based on python-aria-mirror-bot

- [ MAYBE UPDATE & ADD MORE MODULE ] Bagas Mirror&Leech Bot Bagas Mirror&Leech Bot is a multipurpose Telegram Bot written in Python for mirroring file

4 Nov 23, 2021