Flatten button entered a trade

Market data, Trading, Technical support, Features requests, etc
latnemele
Posts: 39
Joined: Wed May 13, 2020 12:27 am
Location: Europe
Has thanked: 12 times
Been thanked: 6 times

Flatten button entered a trade

Post by latnemele » Tue Nov 10, 2020 2:35 pm

I want to report a potential bug. I say potential, because I'm not 100% it's an issue in Bookmap, it might have been a misclick so I wanted to verify it with you.

Here's a report of what I experienced:
I was trading 1 contract long of ES on the CME through Rithmic.
  • I had entered a short position with active brackets
  • I clicked the "flatten" button to exit the position *(this is the part I'm not 100% sure about. It is possible that I clicked the market sell button instead of flatten as they're right next to each other)
  • at the same time the price reached my target
I though I had exited the position but I saw that I was holding 1 short contract (opposite).

As I said it's possible that I've clicked market sell instead of flatten. Is there a way to check what actually happened in the logs?

I know that rithmic OCO orders are held server side (rithmic servers) while the flatten button acts client side (my PC). Could that be the reason for this issue? Could you please verify that Rithmic oco bracket orders don't break the flatten button.

Additionally, having keyboard shortcuts for trading would make it much faster & less error prone. Bookmap already has shortcuts for replay mode, why not add them for live as well. They can be turned off by default.

Svyatoslav
Site Admin
Posts: 278
Joined: Mon Jun 11, 2018 11:44 am
Has thanked: 2 times
Been thanked: 31 times

Re: Flatten button entered a trade

Post by Svyatoslav » Tue Nov 10, 2020 2:53 pm

Hi. Yes, log files would help us understand what happened. Please send those if possible (you can send to [email protected] - make sure to include both -trading and -common log files).

OCO bracket orders do not have known issues.

If I have to guess what could have happened, there are 2 possibilities:
- as you mentioned, missclick could one
- another could be that position close is not an atomic operation in most API's, which means that with some bad luck what you describe can happen. R+ API does not have an atomic position close operation, as far as I recall. It means that when you click a button we do 2 things: request order cancellation for every order active and send a market order that is supposed to close position. However, due to the nature of network communication there are 2 delays. One is that the state in bookmap is always behind the exchange - it takes few tens of milliseconds for data to reach bookmap from exchange even on a very good connection. And another is that when bookmap sends a request it will also take time to reach exchange. This means that if you press "flatten" while you still see the position, it will issue a market order + order cancellations immediately, but it's possible that by the time cancellations reach the server it is too late - there is nothing to cancel.
To avoid this we'd have to wait for cancellation requests to get fully processed and only then send a market order, however that would have it's own issues, the most obvious one being that position close would become slower.

latnemele
Posts: 39
Joined: Wed May 13, 2020 12:27 am
Location: Europe
Has thanked: 12 times
Been thanked: 6 times

Re: Flatten button entered a trade

Post by latnemele » Tue Nov 10, 2020 3:25 pm

Thank you, I've sent the log files & the bmo & bmf files to the support email.

If it was just a misclick, I can look into the 3rd party bookmap shortcut plugins in the bookmap marketplace. I really don't want to have to look away from the heatmap to click on a button with my mouse.

The 2nd possibility worries me more. I completely understand what you mean by the lack of atomic operation to do both actions.

Does the Rithmic API support order conditions? In this case we'd want the flatten button to send an opposing order ONLY IF the position is still open with the condition being verified on server side (rithmic servers) instead of client side. Can we make a network request to Rithmic that achieves that? That'll solve the network delay issue.

Svyatoslav
Site Admin
Posts: 278
Joined: Mon Jun 11, 2018 11:44 am
Has thanked: 2 times
Been thanked: 31 times

Re: Flatten button entered a trade

Post by Svyatoslav » Wed Nov 11, 2020 10:45 am

It looks like one of the newer API versions adds ability to exit position. We just didn't make use of it when we migrated to that version in spring of this year. We'll try to start using this new method in nearest future.

latnemele
Posts: 39
Joined: Wed May 13, 2020 12:27 am
Location: Europe
Has thanked: 12 times
Been thanked: 6 times

Re: Flatten button entered a trade

Post by latnemele » Wed Nov 11, 2020 6:01 pm

Svyatoslav wrote:
Wed Nov 11, 2020 10:45 am
It looks like one of the newer API versions adds ability to exit position. We just didn't make use of it when we migrated to that version in spring of this year. We'll try to start using this new method in nearest future.

That's great news, thank you for checking!

Post Reply