Git Product home page Git Product logo

Comments (6)

Chavithra avatar Chavithra commented on July 28, 2024

Hello,

if you need TOTALPORTFOLIO you need to add it in the request_list like this :

request_list = Update.RequestList()
request_list.values.extend([
    Update.Request(option=Update.Option.TOTALPORTFOLIO, last_updated=0),
])

Right now you are asking for the PORTFOLIO only : these are two separate things in Degiro`s API.

Hope that helps

from degiro-connector.

blastik avatar blastik commented on July 28, 2024

Hello,

if you need TOTALPORTFOLIO you need to add it in the request_list like this :

request_list = Update.RequestList()
request_list.values.extend([
    Update.Request(option=Update.Option.TOTALPORTFOLIO, last_updated=0),
])

Right now you are asking for the PORTFOLIO only : these are two separate things in Degiro`s API.

Hope that helps

same result. KeyError: 'total_portfolio'

from degiro-connector.

Chavithra avatar Chavithra commented on July 28, 2024

Can you send me your new code ?

Thanks

from degiro-connector.

blastik avatar blastik commented on July 28, 2024

@Chavithra exactly the same but with what you proposed

import json
import logging
import degiro_connector.quotecast.helpers.pb_handler as pb_handler
import pandas as pd

from IPython.display import display
from degiro_connector.trading.api import API as TradingAPI
from degiro_connector.trading.pb.trading_pb2 import (Credentials, Update)

# SETUP LOGGING LEVEL
logging.basicConfig(level=logging.INFO)

# SETUP CONFIG DICT
with open('config/config.json') as config_file:
    config_dict = json.load(config_file)

# SETUP CREDENTIALS
username = config_dict['username']
password = config_dict['password']
totp_secret_key = config_dict['totp_secret_key']

credentials = Credentials(
    int_account=None,
    username=username,
    password=password,
    totp_secret_key=totp_secret_key
)

# SETUP TRADING API
trading_api = TradingAPI(credentials=credentials)

# CONNECT
trading_api.connect()

# ACCESS SESSION_ID
session_id = trading_api.connection_storage.session_id

# print('You are now connected, with the session id :', session_id)

# SETUP REQUEST
request_list = Update.RequestList()
request_list.values.extend([
    Update.Request(option=Update.Option.TOTALPORTFOLIO, last_updated=0),
])

update = trading_api.get_update(request_list=request_list)
update_dict = pb_handler.message_to_dict(message=update)
total_portfolio_df = pd.DataFrame(update_dict['total_portfolio']['values'])```

from degiro-connector.

Chavithra avatar Chavithra commented on July 28, 2024

Ok, I think I have found a second blocking point :

  • int_account needs to be set

I have tested your last code by adding int_account and it worked.

You can fetch it using this code :

client_details_table = trading_api.get_client_details()

More information about int_account is available in the README.

An example of TOTALPORTFOLIO fetching with the int_account setup is available in this file :

  • examples/trading/update.py

from degiro-connector.

Chavithra avatar Chavithra commented on July 28, 2024

Closing this issue since there is no more feedback.

Feel free to open a new issue if you still have questions.

from degiro-connector.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.