Zarathustra2 / TradeRepublicApi

Unofficial trade republic API
MIT License
277 stars 68 forks source link

Limit order (buy) fails #22

Open LaoTszy opened 2 years ago

LaoTszy commented 2 years ago

Limit order (buy), e.g:

await tr.limit_order(order_id, 'DE0007037129', 'buy', '1', '21.78', 'gfd')

fails with

Unrecognized state E data ['{"errors":[{"errorCode":"JSON_PARSE_ERROR","errorField":null,"errorMessage":"Subscription', 'payload', '<{\"type\":\"simpleCreateOrder\",\"clientProcessId\":\" < some generated uuid > \",\"warningsShown\":[\"userExperience\"],\"acceptedWarnings\":[\"userExperience\"],\"parameters\":{\"instrumentId\":\"DE0007037129\",\"exchangeId\":\"LSX\",\"expiry\":{\"type\":\"gfd\"},\"limit\":\"21.78\",\"mode\":\"limit\",\"size\":\"1\",\"type\":\"buy\"},\"token\":\" < the very long token > \"}>', 'validation', 'failed","meta":{"source":"MAPPER"}}]}']

This json above really looks funny with "errorMessage" value looking like a fragment of the payload without its head and tail parts.

Zarathustra2 commented 2 years ago

HMMM, is this maybe related to https://github.com/Zarathustra2/TradeRepublicApi/pull/21 which I merged yesterday?

Zarathustra2 commented 2 years ago

What if you use the previous commit before the merge?

LaoTszy commented 2 years ago

I have indeed used the version preceding the merge. The error looks a bit different now with an exception thrown in TRApi.start. The content of the message is still the same though:

Traceback (most recent call last): File "using_tr.py", line 25, in history await tr.start() File "api.py", line 349, in start raise TRapiExcServerErrorState(f"Error during server access\n\tServer-side Object probably expired...\n\t{sErr}") trapi.api.TRapiExcServerErrorState: Error during server access Server-side Object probably expired... ERROR state: E data: ['{"errors":[{"errorCode":"JSON_PARSE_ERROR","errorField":null,"errorMessage":"Subscription', 'payload', '<{\"type\":\"simpleCreateOrder\",\"clientProcessId\":\" \",\"warningsShown\":[\"userExperience\"],\"acceptedWarnings\":[\"userExperience\"],\"parameters\":{\"instrumentId\":\"DE0007037129\",\"exchangeId\":\"LSX\",\"expiry\":{\"type\":\"gfd\"},\"limit\":\"35.85\",\"mode\":\"limit\",\"size\":\"1\",\"type\":\"buy\"},\"token\":\" \"}>', 'validation', 'failed","meta":{"source":"MAPPER"}}]}'] python-BaseException

Zarathustra2 commented 2 years ago

hmmm interesting. Not sure if I find the time to debug it as I don't use TR really

LaoTszy commented 2 years ago

How did you come up with this API? I've tried to look at the the web application network exchange: it looks pretty different to me.

Jeffote commented 2 years ago

is there an update to this issue?

deepbeat commented 1 year ago

hello there, having the same issue. Anyone working on this? And if not, how and with what tools did you reverse engineer this API exactly?

deepbeat commented 1 year ago

Solved it. It still works with the given code. You just need to give a well-formated uuid as id. Otherwise you get this misleading JSON_PARSE_ERROR from above.

However, I am still very interested in this open question: how and with what tools did you reverse engineer this API exactly?