icastillejogomez / degiro-api

Unofficial DeGiro stock broker API. See your portfolio and set up orders in the market like wall street
MIT License
194 stars 29 forks source link

How to retrieve current size/value of CASH data in PORTFOLIO #51

Open AnAnalogGuy opened 1 year ago

AnAnalogGuy commented 1 year ago

First of all: Thanks @icastillejogomez for the API, very useful!

--

Hi all

when retrieving the CASH account data as rows in the PORTFOLIO dataframe like


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

the API seems to return the Cash Account Data from the last cash transfer to the FLATEX account, not the actual value of the Cash Account (i.e. US Dollar, "size" parameter), neither in the baseCurrency nor in the FXCurrency (i.e. EUR, "value" parameter).

The Cash Account (size) could have changed in the meantime because of buy/sell activities, the baseCurrency Value (value) because of changes in the exchange rate. Now, i was wondering if there is a way to retrieve the actual values for both, size and value, or at least the changes since the last transfer to the FLATEX account - i was searching the API doc but was not able to find related information. Maybe someone could give me a hint?

Thanks a lot!

icastillejogomez commented 1 year ago

When I developed this library I've tried to retrieve this information but was not possible only fetching data from the degiro API. You can inspect the degiro webpage usage to discover how they are getting this data in order we can implement this feature. I'm going to keep this issue open for a week wating for this information.

AnAnalogGuy commented 1 year ago

It might be the cash data does not come from the same source as the portfolio data since in the backend these are two different systems. However i would expect it's made available in the same application gateway, maybe as a seperate endpoint.

I'm not too familiar with reverse engineering and JS, but i will give it a try. Any starting point/starting information you can provide me with, so I don't have to start from zero?

AnAnalogGuy commented 1 year ago

From the basic mechanism, it must be two requests. Actually, it seems generally the current state is always composed from the last day end state plus relativ changes during the current day. At least this is what one can see when the UI is rendered - first the values from last market close is rendered and then updated with the current value.