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
An API wrapper for Henrik's Unofficial VALORANT API

ValorantAPI.py An API wrapper for Henrik's Unofficial VALORANT API Warning!! This project is still in beta and only contains barely anything yet. If y

Jakkaphat Chalermphanaphan 0 Feb 4, 2022
Official python API for Phish.AI public and private API to detect zero-day phishing websites

phish-ai-api Summary Official python API for Phish.AI public and private API to detect zero-day phishing websites How it Works (TLDR) Essentially we h

Phish.AI 168 May 17, 2022
🚀 An asynchronous python API wrapper meant to replace discord.py - Snappy discord api wrapper written with aiohttp & websockets

Pincer An asynchronous python API wrapper meant to replace discord.py ❗ The package is currently within the planning phase ?? Links |Join the discord

Pincer 125 Dec 26, 2022
Unofficial Python wrapper for official Hacker News API

haxor Unofficial Python wrapper for official Hacker News API. Installation pip install haxor Usage Import and initialization: from hackernews import H

null 147 Sep 18, 2022
An Unofficial TikTok API Wrapper In Python

This is an unofficial api wrapper for TikTok.com in python. With this api you are able to call most trending and fetch specific user information as well as much more.

David Teather 2.9k Jan 8, 2023
An unofficial Python wrapper for the 'Binance exchange REST API'

Welcome to binex_f v0.1.0 many interfaces are heavily used by myself in product environment, the websocket is reliable (re)connected. Latest version:

DeepLn 2 Jan 5, 2022
This is a simple unofficial async Api-wrapper for tio.run

Async-Tio This is a simple unofficial async Api-wrapper for tio.run

Tom-the-Bomb 7 Oct 28, 2022
Unofficial API wrapper for seedr.cc

Seedr API Unofficial API wrapper for seedr.cc Inspired by theabbie's seedr-api Powered by @harp_tech (Telegram) How to use You can install lib via git

Anjana Madu 49 Oct 24, 2022
Clash of Clans developer unofficial api Wrapper to generate ip based token

Clash of Clans developer unofficial api Wrapper to generate ip based token

Aryan Vikash 6 Apr 1, 2022
A Python library to access Instagram's private API.

Instagram Private API A Python wrapper for the Instagram private API with no 3rd party dependencies. Supports both the app and web APIs. Overview I wr

null 2.6k Jan 5, 2023
Integrating Amazon API Gateway private endpoints with on-premises networks

Integrating Amazon API Gateway private endpoints with on-premises networks Read the blog about this application: Integrating Amazon API Gateway privat

AWS Samples 12 Sep 9, 2022
A simple way to create a request to the coinpayment API with a valid HMAC using your private key and command

Coinpayments Verify TXID Created for Astral Discord bot A simple way to create a request to the coinpayment API with a valid HMAC using your private k

HellSec 1 Nov 7, 2022
Aws-lambda-requests-wrapper - Request/Response wrapper for AWS Lambda with API Gateway

AWS Lambda Requests Wrapper Request/Response wrapper for AWS Lambda with API Gat

null 1 May 20, 2022
This package accesses nitrotype's official api along with its unofficial user api

NitrotypePy This package accesses nitrotype's official api along with its unofficial user api. Currently still in development. Install To install, run

The Moon That Rises 2 Sep 4, 2022
rewise is an unofficial wrapper for google search's auto-complete feature

rewise is an unofficial wrapper for google search's auto-complete feature

Somdev Sangwan 71 Jul 19, 2022
Python script to replace BTC adresses in the clipboard with similar looking ones, whose private key can be retrieved by a netcat listener or similar.

BTCStealer Python script to replace BTC adresses in the clipboard with similar looking ones, whose private key can be retrieved by a netcat listener o

Some Person 6 Jun 7, 2022
Clash of Clans v6.253 private server written in python

cocps Clash of Clans v6.253 private server written in python how2play download server files download Patched APK run Main.py and play Authors Patched

null 5 Aug 28, 2022
A Python script to backup all repos (public or private) of a user.

GithubBackupAllRepos A Python script to backup all repos (public or private) of a user. Features Clone public and private repos Load specified SSH key

Podalirius 15 Jan 3, 2023
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