Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit order (buy) fails #22

Open
LaoTszy opened this issue Jan 3, 2022 · 8 comments
Open

Limit order (buy) fails #22

LaoTszy opened this issue Jan 3, 2022 · 8 comments

Comments

@LaoTszy
Copy link

LaoTszy commented Jan 3, 2022

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
Copy link
Owner

HMMM, is this maybe related to #21 which I merged yesterday?

@Zarathustra2
Copy link
Owner

What if you use the previous commit before the merge?

@LaoTszy
Copy link
Author

LaoTszy commented Jan 3, 2022

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
Copy link
Owner

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

@LaoTszy
Copy link
Author

LaoTszy commented Jan 4, 2022

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
Copy link

Jeffote commented Mar 4, 2022

is there an update to this issue?

@deepbeat
Copy link

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
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants