TradeRepublicApi icon indicating copy to clipboard operation
TradeRepublicApi copied to clipboard

Limit order (buy) fails

Open LaoTszy opened this issue 3 years ago • 8 comments
trafficstars

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.

LaoTszy avatar Jan 03 '22 17:01 LaoTszy

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

Zarathustra2 avatar Jan 03 '22 17:01 Zarathustra2

What if you use the previous commit before the merge?

Zarathustra2 avatar Jan 03 '22 17:01 Zarathustra2

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

LaoTszy avatar Jan 03 '22 18:01 LaoTszy

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

Zarathustra2 avatar Jan 03 '22 22:01 Zarathustra2

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.

LaoTszy avatar Jan 04 '22 00:01 LaoTszy

is there an update to this issue?

Jeffote avatar Mar 04 '22 07:03 Jeffote

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 avatar Apr 10 '23 16:04 deepbeat

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?

deepbeat avatar Apr 11 '23 13:04 deepbeat