Jump to content
Lumpy

Algorithmic trading and flash orders

Recommended Posts

Folks,

1/

Am I the only one to experience ******* flash orders on certain exchanges (Kraken to not mention one of them)?

2/

How do you deal with them?

- - -

As you guess, if you are doing arbitrage activities, flash orders (usually popped between 30 and 500 milliseconds) can mislead intentionally your bot, forcing you to deal with a pending order afterwards.

Peace

Share this post


Link to post
Share on other sites

I have not built an automated trading system as of yet (my next project down the road), but I do a little futures trading on the side (Mostly crude oil and DOW). As you talk about "flash trading", I do experience this particularly with futures trading. I have a theory or two on this. Side note: I do not trade crypto due to light trading and it is an immature market.

However, it also depends on what time frame you are trading on, what platform you are trading with, and how you view the market. Typically one of two things happen in this "flash trading." Firstly, it could be abnormally large order is trying to be pushed through at one time. Think shoving a car through a pin hole. Secondly, there is the saturation of the market. What I mean by that is that the market tends of have certain cycles. Think of a trend. A higher high and a lower low is what makes a trend. In a trend there is a pull back(s). However when a trend ends we normally hit a consolidation period. I would also consider the end of a trend be called "market exhaustion", meaning that there is an extreme of overbought or oversold territory and profits are "dried up." This makes it easier for someone to take the opposite and start to form a support level at the current price range. Then we see the market being saturated at the current price range AKA market consolidation before the market makes it next move. 

With that being said, there is an underlying component within the two theories (could be more, but I'll touch on that later). The underlying component is volume (with futures I monitor the # of contract sizes coming in at a period of time). If we ignore theory # one, in theory # two you will see volume "drying up" within the pull back of a trend or if it is a market reversal, the volume will be "drying up" and not supporting the current price in the trend. Theory # 2 is accomplished at all time, tick, and volume frames. Some more important than others. Not to give away any trade secrets, but this is how I monitor trend reversals and pull backs. 

But remember when I said there could be more theories than just my two? Why do we see price spikes on one exchange but not any other exchanges? To through a wrench in all of this, it could be possible that exchanges and traders are concluding with each other (wash trading). The exchanges could be creating artificial volume for either themselves or maybe supporting a certain crypto. Trade volume is king when comparing one crypto to the next. This artificial volume could be setting off bots to make them "run wild", because isn't an automated trading system just really looking at discrepancies in the market itself? This is some speculation on my part, but we cannot ignore it.

My suggestion to you is to study the volume at a small time, tick, or volume frames. You can set parameters depending on the what types of volume you want to trade on, but it also depends on how you quantify your data coming in too. 

Share this post


Link to post
Share on other sites
13 hours ago, tulo said:

Define "flash orders", because it mights describe different events.

Flash orders are commonly used by HFT firms in the context of a "liquidity detection" strategy.

The idea is to try to find and trade against large institutional orders. Below an excellent definition:

Quote

HFT firms will repeatedly submit small-sized orders intended to detect large orders from institutional investors. Based on intelligence gathered from this process, these strategies can then trade ahead of large orders under the assumption that the large order will move the market’s pricing of the security to their benefit. One particularly contentious application of the strategy involves “flash orders”. Flash orders act as an exception to Rule 611 of Reg. NMS: instead of immediately rerouting an unmatched order, an exchange can “flash” the order at the NBBO price to participating traders for a brief period, usually between 30 and 500 milliseconds, who then can choose whether they want to trade against it before it is routed. Some traders and industry observers believe flash orders constitute a form of illegal frontrunning, arguing that it gives a small subset of traders with non-public information and thus giving them an unfair opportunity to act on that information.105 Others counter that these traders are only trading on public information and thus should remain legal.

Written by Micheal Morelli in REGULATING SECONDARY MARKETS IN THE HIGH FREQUENCY AGE: A PRINCIPLED AND COORDINATED APPROACH

@tulo @Sukrim @ObeyTheWafflehouse

Share this post


Link to post
Share on other sites
32 minutes ago, tulo said:

"flash crash"

I think you are right. Can you develop this element please?

 

33 minutes ago, tulo said:

"rerouting"

In other words and from what I understand, if the Best Bid Offer is at 1, flash orders can "capture" Non Best Bid Offers (NBBO) that will come (going to) to populate the orderbook, before it is actually in it. Quite a complex concept..

Share this post


Link to post
Share on other sites
33 minutes ago, Lumpy said:

I think you are right. Can you develop this element please?

Flash crash is when someone sells a big junk, or the volume is so low that selling moves the price down a bit that it triggers many stop loss orders in cascade and the price drops a lot in a fraction of second, then the market re-aligns (it can be in fraction of seconds or minutes) and the price recovers to the old price before flash crash.

And there is little you can do with the bot, if not being faster than the others, but usually all the stop loss orders trigger before any new order placed (if the exchange did a good job in the order matching engine).

Share this post


Link to post
Share on other sites
1 hour ago, tulo said:

volume is so low that selling moves the price down a bit that it triggers many stop loss orders in cascade and the price drops a lot in a fraction of second

I'm not sure how the equities market works in this fashion (being a positive sum game), but I see this all the time in the futures market (zero sum game). Typically in a market reversal, and this can apply to other areas too, there is a saturation of contracts at one time. What happens is the "smart money" will recognize this, throw the price higher, to trigger stop losses (which creates a "vaccuum"), and spikes the price before returning to normal levels and reversing. Actually the CFTC has implemented rule 589, which determines how much the price can be spike at one period of time. 

The only way to defend against this IMO is to dig into the tick or volume charts. I work on bigger time frames, 1min+, but the market mechanisms generally all work the same. 

Share this post


Link to post
Share on other sites
23 hours ago, tulo said:

 I don't unerstand what "rerouting" means here.

NBBO - National Best Bid and Offer (NBBO) is a regulation by the United States Securities and Exchange Commission that requires brokers to execute customer trades at the best available ask price when buying securities, and the best available bid price when selling securities.

A "broker" or in crypto an "exchange" is a business that has trading volume (retail or institutional volume), and they often get paid to route that trading flow through certain  channels for execution. 

Quote

 

A broker can attempt to fill your order in a number of ways:

  • Order to the Floor. 
  • Order to Third Market Maker. 
  • Internalization.
  • Electronic Communications Network (ECN)
  • Order to Market Maker.

 

The point is that the broker is supposed to have a fiduciary responsibility to their clients, and put the client's interest above theirs. There have been kickback lawsuits for firms routing all their trade flow though a certain channel and things of that nature in the past. https://www.sec.gov/enforce/ia-4983-s  https://www.sec.gov/news/public-statement/statement-chairman-clayton-2018-10-16

What this thread is discussing sounds more like how if you are running a node, you can see some of the proposed transactions in the ledger consensus process before they are actually executed to the ledger, and then try to front run those TXs intra-ledger close. I remember there being a whole thread on this a year or so back, and then Ripple made some change to randomize the transactions or something, not sure of the technicals, but if you know what thread I'm thinking of I would like to re-read it. There was also an amendment that was supposed to help prevent the really small bot trades

Share this post


Link to post
Share on other sites
On 12/19/2018 at 11:28 AM, Lumpy said:

Reg. NMS: instead of immediately rerouting an unmatched order, an exchange can “flash” the order at the NBBO price to participating traders for a brief period, usually between 30 and 500 milliseconds, who then can choose whether they want to trade against it before it is routed.

But here they talk about exchanges. An unmatched order (probably because the price moved meanwhile) can be flashed at NBBO seems to me like: "hey your order didn't match but I can sell/buy at actual NBBO even if lower/higher than you input price". Is that the "rerouting"? How can that happen in 30-500ms? 

Share this post


Link to post
Share on other sites

@tulo sort of what you said, yeah. Except if the NBBO was better than their internal ability to match the order, they should give the client the NBBO. If they get 0.5% kickback on the order's value for routing it through NYSE, and only 0.25% for routing it through NASDAQ... then they may route it to the NYSE to earn more money, even when the best price for the client was on the NASDAQ. You can switch out the "NYSE & NASDAQ" for any of these market makers names below who work at those exchanges.

I dont know all the inside details on how these deals on "kickbacks for order flow" are negotiated or what the points of negotiation would be? As you know if an orderbook is not active then it is hard to make money providing liquidity and trading that orderbook. From the Market Maker's point of view, if they can incentive more order-flow, then they will have be better able to run their market making business. This is functionally the same thing Ripple is doing by providing "incentives to liquidity providers". 

This gives some more details. https://www.barrons.com/articles/exclusive-who-makes-money-on-your-stock-trades-1425103695

ON-BI910_CovHow_G_20150227223750.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...