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
SongLink Discord Bot - Discord bot to share music links easily

SongLink_Discord_Bot Discord bot to share music links easily. Take a link from y

Edgar Lefevre 4 Feb 18, 2022
A discord nitro generator written in python

VerseGenerator A discord nitro generator written in python Usage ・Fork the repo ・Clone it to replit ・Install the required packages and run it ・Input t

NotDrakezz 4 Nov 13, 2021
Due to changes to the discord API and discord.py being discontinued

Talia Due to changes to the discord API and discord.py being discontinued, Talia development has been halted permanently A customizable economy discor

2 Mar 08, 2022
派蒙Bot / PaimonBot

派蒙Bot / PaimonBot 基于Mrs4s / go-cqhttp 和 nonebot / nonebot2 的原神QQ群聊机器人 特别鸣谢 MingxuanGame 的人物武器名字自动纠正功能 小灰灰 的人物武器信息api 环境 请务必使用Python3.7以上版本!! 尽量在linux下

晓轩 96 Dec 16, 2022
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
Discord Token Checker and Info

Discord Token Checker A simple way to check Discord user tokens and their info in bulk. By Roover#7098. https://discord.gg/W8hnMWY6XP Proxy support co

Roover 3 Dec 09, 2021
This tool is created by Shahzain and is one of the best self bots out there!

Shahzain SelfBot This tool is created by Shahzain and is one of the best self bots out there! Features Token Destroyer! Server Nuker(50-100 Bans Per S

Shahzain 6 Apr 02, 2022
CyberTKR - CyberTK-API

CyberTKR - CyberTK-API

TKR 2 Apr 08, 2022
CnCL - CnCLess it's an Easy to deploy Botnet without CnC/C2

CnCL CnCLess it's an Easy to deploy Botnet without CnC/C2, Harder to track and t

ZSendokame 2 Jan 10, 2022
Código que verifica se o grafo é Hamiltoniano (Em Python)

Código para encontrar um ciclo de Hamilton em um dado grafo e a partir daí verificar se o grafo é hamiltoniano. Um ciclo hamiltoniano é um ciclo gerad

Hemili Beatriz 1 Jan 08, 2022
Free and Open Source Group Voice chat music player for telegram ❤️ with button support youtube playback support

Free and Open Source Group Voice chat music player for telegram ❤️ with button support youtube playback support

Sehath Perera 1 Jan 08, 2022
🎄 JustaGrabber - A discord token grabber written in python3

🎄 JustaGrabber - A discord token grabber written in python3 🎇 Made by kldiscord https://github.com/kldiscord 🌟 Please leave a star if you liked Jus

1 Dec 19, 2022
A Telegram bot that searches for the original source of anime, manga, and art

A Telegram bot that searches for the original source of anime, manga, and art How to use the bot Just send a screenshot of the anime, manga or art or

Kira Kormak 9 Dec 28, 2022
A bot created with Python that interacts with GroupMe

GroupMe_Bot This is a bot I'm working on a small groupme group I'm in. This is something I'll work on in my spare time. Nothing but just a fun little

0 May 19, 2022
An API serving data on all creatures, monsters, materials, equipment, and treasure in The Legend of Zelda: Breath of the Wild

Hyrule Compendium API An API serving data on all creatures, monsters, materials, equipment, and treasure in The Legend of Zelda: Breath of the Wild. B

Aarav Borthakur 116 Dec 01, 2022
Petpy is an easy-to-use and convenient Python wrapper for the Petfinder API.

Petpy is an easy-to-use and convenient Python wrapper for the Petfinder API. Includes methods for parsing output JSON into pandas DataFrames for easier data analysis

Aaron Schlegel 27 Nov 19, 2022
A chatbot that helps you set price alerts for your amazon products.

Amazon Price Alert Bot Description A Telegram chatbot that helps you set price alerts for amazon products. The bot checks the price of your watchliste

Rittik Basu 24 Dec 29, 2022
PerrOS - The operating system for your discord server.

PerrOS PerrOS is a Opensource Discord Bot to do it all! Installation Use the package manager pip to install the python3 requirements. pip3 install -r

Webshort 2 Jun 20, 2022
Python lib to control HottoH based stove devices

Project desciption This library can be used to discuss with HootoH based stove devices Actually tested and validated with a CMG Drum stove. To use thi

3 May 16, 2022
AWS Auto Inventory allows you to quickly and easily generate inventory reports of your AWS resources.

Photo by Denny Müller on Unsplash AWS Automated Inventory ( aws-auto-inventory ) Automates creation of detailed inventories from AWS resources. Table

AWS Samples 123 Dec 26, 2022