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
Surfline Forecast Bot For Python

Surfline Forecast Bot A telegram bot created using Telethon that allows users to

1 May 08, 2022
Host your Python Discord Bot 24/7 for free. POC

🐉 Pandore 🐉 The easiest and fastest way to host your Python3 Discord Bot 24/7 for free! 📚 Documentation 📚 If you encounter any problem while using

Billy 73 Jan 02, 2023
Python: Asynchronous client for the Open-Meteo API.

Python: Asynchronous client for the Open-Meteo API. Asynchronous client for the Open-Meteo API. About Open-Meteo offers free weather forecast APIs for

Franck Nijhof 11 Dec 21, 2022
Scrapping malaysianpaygap & Extracting data from the Instagram posts

Scrapping malaysianpaygap & Extracting data from the posts Recently @malaysianpaygap has gotten quite famous as a platform that enables workers throug

Yudhiesh Ravindranath 65 Nov 09, 2022
ThetaGang is an IBKR bot for collecting money

💬 Join the Matrix chat, we can get money together. Θ ThetaGang Θ Beat the capitalists at their own game with ThetaGang 📈 ThetaGang is an IBKR tradin

Brenden Matthews 1.5k Jan 08, 2023
Python wrapper for JeyyAPI

Async python wrapper for JeyyAPI

7 Dec 10, 2022
This project is a basic login system in terminal for Discord

Welcome to Discord Login System(Terminal) 👋 This project is a basic login system in terminal for Discord Author 👤 arukovic Github: @SONIC-CODEZ Show

SONIC-CODEZ 2 Feb 11, 2022
Convenient script for trading with python.

Convenient script for trading with python.

VladKochetov007 66 Dec 07, 2022
A chatbot on Telegram using technologies of cloud computing.

Chatbot This project is about a chatbot on Telegram to study the cloud computing. You can refer to the project of chatbot-deploy which is conveinent f

Jeffery 4 Apr 24, 2022
Self-adjusting, auto-compounding multi-pair DCA crypto trading bot using Python, AWS Lambda & 3Commas API

Self-adjusting, auto-compounding multi-pair DCA crypto trading bot using Python, AWS Lambda & 3Commas API The following code describes how we can leve

Jozef Jaroščiak 21 Dec 07, 2022
Most Simple & Powefull web3 Trade Bot (WINDOWS LINUX) Suport BSC ETH

Most Simple & Powefull Trade Bot (WINDOWS LINUX) What Are Some Pros And Cons Of Owning A Sniper Bot? While having a sniper bot is typically an advanta

GUI BOT 6 Jan 30, 2022
WIOpy - Walmart Affiliate API Python wrapper

WalmartIO Python Wrapper - WIOpy A python wrapper for the Walmart io API. Only s

6 Nov 14, 2022
ignorant allows you to check if a phone number is used on different sites like snapchat, instagram.

Ignorant For BTC Donations : 1FHDM49QfZX6pJmhjLE5tB2K6CaTLMZpXZ ignorant does not alert the target phone number ignorant allows you to check if a phon

Palenath 513 Dec 31, 2022
OKEX数字货币自动交易python语言SDK

okex-py OKEx数字货币自动交易python语言SDK (非官方) OKEx Cryptocurrency Exchange python SDK (Unofficial) 本项目基于V5 API 使用例子 Example import okex.v5.account_api as acco

43 Dec 01, 2022
This repository will (hopefully) always contain the latest version of the libProfessorP.asm.so shared object.

libPuhfessorP - Deploy Repo This repo should (hopefully) always contain the latest version of the libPuhfessorP.asm.so shared object, to be linked wit

Puhfessor P - CPSC 240 3 Sep 30, 2021
A VCVideoPlayer Bot for Telegram made with 💞 By @TeamDeeCoDe

VC Video Player How To Host ✨ Heroku Deploy ✨ The easiest way to deploy this Bot is via Heroku. Credit 🔥 |🇮🇳 Louis |🇮🇳 Sammy |🇮🇳 Blaze |🇮🇳 S

TeamDeeCode 6 Feb 28, 2022
Efetuar teste de automação usando linguagem gherkin

🚀 Teste-de-Automação - QA---CI-T 🚀 Descrição • Primeira Parte • Segunda Parte • Terceira Parte Contributors Descrição Efetuamos testes de automação

Eliel martins 6 Dec 07, 2021
Free and Open Source Channel/Group Voice chat music player for telegram ❤️ with button support Heroku Commands

ZeusMusic Requirements 📝 FFmpeg NodeJS nodesource.com Python 3.7 or higher PyTgCalls MongoDB 2nd Telegram Account (needed for userbot) 🧪 Get SESSION

ZeusNetwork 4 Jan 03, 2022
Unofficial WebApp for WhatsApp Web created in PyQt6

Unofficial WebApp for WhatsApp Web created in PyQt6 using PyQt6-WebEngine

Rafael Tosta Santos 126 Dec 20, 2022