Comments (17)
Short update:
I went into the rabbit hole to learn how to monitor websocket traffic - quite fun actually - and learned there is a new subscription command compactPortfolio
, which returns a reduced json with only three entries:
{"positions":[{"instrumentId":"","netSize":"","averageBuyIn":""}]}
But that won't help with the old implementation, as a live update on the current net value is not provided.
from pytr.
I have the same. I think it is related to recent changes in Traderepublic like 2% of cash.
from pytr.
Same here. Worked last week but shows me the same error message
from pytr.
Short update: I went into the rabbit hole to learn how to monitor websocket traffic - quite fun actually - and learned there is a new subscription command
compactPortfolio
, which returns a reduced json with only three entries:{"positions":[{"instrumentId":"","netSize":"","averageBuyIn":""}]}
But that won't help with the old implementation, as a live update on the current net value is not provided.
Do you have a list of all available subscription commands?
from pytr.
From Web TradeRepublic it seems to get detailed information per stock required to use type: instrument
.
Example: sub 23 {"type":"instrument","id":"DE0001111111","jurisdiction":"DE"}
from pytr.
I pushed my changes to https://github.com/miry/pytr/tree/miry_master
$ git clone miry -b miry_master
$ pip3 install .
$ pytr -v debug portfolio
from pytr.
@miry With your changes the connection to websocket is possible again, thanks for that. There is a "bug", that the netValue of each position is 0, but you wrote in your code that is a ToDo. I'm curious for the next update.
from pytr.
@ChemicalEnginer I think Traderepublic removed old portfolio
method becuase it is too big. They replaced it with small compactPortfolio
. It requires to send additional request for each ISIN.
I will look next week for missing data.
from pytr.
@ChemicalEnginer Improved my changes and also add ability to show Title of the ISIN.
from pytr.
Sent PR: #39
from pytr.
Are there any news about it?
I am not using pytr, but another python tool, which has the same problem now. And I actually just need one value... the total depot amount.
I also had look on it today... and really got mad about their mess now.
My current thoughts about it.
'compactPortfolio' have 3 values:
instrumentId = Needs a separate call to get the details about the instrument.
netSize = How many do I owe.
averageBuyIn = How much did I spend on it. (In case someone wants to know the difference between current value and buy in price.)
So, the task is now to get the instrument data including the current price. Then we can multiply the netSize (which we have) with the current price and we have our personal amount for this instrument. And we have to repeat that with all instruments we have... add them up and we have the total value.
from pytr.
PS: I achieved my goal.
I'll share with you my code, maybe it is helpfull, even it is not straight for pytr (I work with https://github.com/Zarathustra2/TradeRepublicApi/).
tr = TrBlockingApi(NUMBER, PIN, locale="de")
tr.login()
TRcash = tr.available_cash()
cash = TRcash[0]["amount"]
TRportfolio = tr.compactPortfolio()
TotalValue = cash
for istrument in TRportfolio["positions"]:
try:
pp.pprint(istrument["instrumentId"])
TRticker = tr.ticker(istrument["instrumentId"])
print(TRticker["bid"]["price"])
TotalValue += (istrument["netSize"] * TRticker["bid"]["price"])
print("Value: " + str( (istrument["netSize"] * TRticker["bid"]["price"])))
time.sleep(0.5)
except Exception as err:
print(f"Unexpected {err=}, {type(err)=}")
print("Total Value: " + str(TotalValue))
I did it like I said.
First I get the available Cash. There is a straight call for it.
Then I get the compact Portfolio and take the instrumentID (one by one) and call the the ticker api point with the isin. From there I receive the current ask and bit price. So I can multiply the netSize with the bid price. Sum everything up (with the cash value) and I have my total value.
Hope it helps a bit.
from pytr.
Hmm... I was a very happy man today in the morning. My depot value was 10 times higher than yesterday... :-)
Until I checked it in Trade Republic itself... nothing changed there :-( Not rich over night.
What happen?
The ticker request seems to be a websocket. So the requested data is not the data which will be received the next time a payload is coming in. Yesterday, by chance, it was like that. Today I request the ticker for the isin "DE1234" but the next payload from Trade Republic is the ticker for "US1234". Which is also in my portfolio, but still...
So I guess it is needed to use the websocket to collect first all ticker for all positions and then do the math (as far as I understood, this is the way the TR webapp is working). Or there is a way to really collect a single ticker, without websocket.
from pytr.
@GordonInDaHouse I have the same understanding. Previous portfolio
operation did summarise for us. With a new implementation you need to collect all instruments and create a Total summaries.
In my PR https://github.com/marzzzello/pytr/pull/39/files#r1191328848 I have not work on it, first wanted to check that netValue is valid per single ISIN.
from pytr.
Hello,
Is there a new change in their api or did i make a mistake in the installation of pip?
2023-06-14 18:21:34+0200 main DEBUG logging is set to debug
2023-06-14 18:21:34+0200 account INFO Found credentials file
2023-06-14 18:21:34+0200 account INFO Phone: +49152********, PIN: ****
2023-06-14 18:21:34+0200 account INFO Web session resumed
2023-06-14 18:21:34+0200 account INFO Logged in
2023-06-14 18:21:34+0200 api INFO Connecting to websocket ...
2023-06-14 18:21:35+0200 api INFO Connected to websocket ...
2023-06-14 18:21:35+0200 api DEBUG Subscribing: 'sub 1 {"type": "portfolio"}'
2023-06-14 18:21:35+0200 api DEBUG Subscribing: 'sub 2 {"type": "cash"}'
2023-06-14 18:21:35+0200 api DEBUG Received message: '1 E {"errors":[{"errorCode":"BAD_SUBSCRIPTION_TYPE","errorField":null,"errorMessage":
"Unknown topic type","meta":{"source":"MAPPER"}}]}'
from pytr.
There is a change in TraderReublic API.
Fast fix is to install fork version: #37 (comment)
from pytr.
Yes, i know! It was my fault. I have make a mistake in the pip installation. Now the fix is working. Thanks for that :)
from pytr.
Related Issues (20)
- event.shares has €-sign and causes an error decimal.InvalidOperation in transactions.py -> format_decimal(event.shares HOT 2
- logfile for debug-mode HOT 2
- UnboundLocalError: local variable 'subscription' referenced before assignment HOT 2
- Problem with Download for all documents without using last_days HOT 2
- more date and time variables for the file name
- addtional variables from extracted-information in events for file name
- Missing interest payments HOT 11
- portfolio_history is not working HOT 2
- pytr dl_docs shows new documents but does not download them HOT 15
- UnboundLocalError HOT 16
- Looking for (co-)maintainers HOT 8
- TypeError for timestamp HOT 1
- pytr download of docs fails if last_days option is provided HOT 8
- Download transactions from date HOT 1
- release is not visible in package manager HOT 3
- Names of Files and their Folders changed HOT 1
- Add the transaction title to the transaction details
- Formatting improvement HOT 2
- Add card transactions into csv automatically HOT 1
- Customizable destination folder structure HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytr.