Paradigm Insights | Watch Your Legs!

Back to Blogs

August 27, 2022

...

All the views expressed below are the personal views of the author, and are not financial or investment advice.

In a previous article about basis trading we discussed how the combination of a spot and derivative product can deliver a delta (market) neutral return. This is not a complex trade by any means, but nevertheless as with any trading endeavour there are associated risks. While the risks of liquidation or auto deleveraging are flashy, there is another more obvious risk which is in many ways far more pedestrian. In this article, we will be covering leg risk, what it is, and how it can be mitigated.

What is a Leg?

What even is a “leg”? As mentioned above, certain trading strategies require you to take positions in multiple instruments at the same time. For instance, consider the “cash and carry” trade. The trader buys a coin in the spot market, and simultaneously sells short a future with the same underlying as the coin. Each of these is a separate trade (typically done on an order book) and is commonly referred to as a leg of a multi-leg trade.

A leg can be anything, for the above it is spot and future, but there are other strategies that use other combinations. Strategies involving options commonly are multi-leg, and the number of legs does not necessarily need to be two. For example, the Iron Condor options strategy is a strategy that aims to profit if the underlying price remains within a certain range, but limits the downside if the price moves outside these limits. This involves buying and selling four different options (legs) in order to set up!

The payout profile of the iron condor options strategy. Source: Wikipedia

What is Leg Risk?

The crucial detail for multi-leg strategies is that ideally all the legs need to be executed at the same time. Consider the earlier spot/futures basis trade. The reason for simultaneous execution is that the objective of the trade is to lock in the basis which means that the trader is trying to buy the spot at a lower price than the future, thereby guaranteeing a fixed profit when the future settles. It follows then, that any failure to achieve this objective will result in either a lower fixed return, or worse, an outright loss if the spot is bought above the price of the future.

Leg risk is therefore the risk that the execution of any of the legs of a multi-leg trade fails to achieve its desired objective. There can be various reasons why this happens, and we enumerate some of them below:

Slippage

Slippage is the difference between the expected price of a trade, and the actual price achieved. Usually, this is because of a lack of liquidity in the order book, which is why paying attention to impact prices is important. If one of the legs of the trade is particularly large, there is a risk that executing the trade will actually achieve an average execution price that is worse than expected.

For those that like a worked example, consider the below order books for both spot and future:

An example spot and futures orderbook for the same underlying.

Assume for simplicity that the futures and spot are one to one in notional. At a glance, it seems like there is an easy 2% fixed basis to be made by buying the spot at 100, and selling the future at 102. But not so fast, it turns out the liquidity for the future is not as great as it seems. Say we wanted to create a two leg basis trade for 1000 units, what would happen?

We buy 1000 units of the spot at an average price of 100.0, since there are 2000 available at the top of the book. How about the future though? Executing 1000 units blows through the first level and hits the second level giving us an average price of:

( 200 102 ) + ( 800 99 ) 1000 = 99.6

So we bought spot at 100, and sold the future lower at 99.6 causing us to actually lock in a negative basis, and therefore a loss at settlement! The larger the size of your trade, the higher the risk of adverse prices due to slippage.

Latency

We briefly touched on execution latency when discussing how arbitrage works. In summary, any price that a trader sees is actually slightly out of date. How out of date it is is actually a function of several variables such as how far they physically are from the exchange, and the pedigree of their technology setup. In the world of High Frequency Trading (HFT) the entire goal is to reduce this latency as much as possible, in order to be able to react quickly to market events.

While basis trades are not exactly what you would call a high frequency strategy, latency can still play a part in the leg risk of the trade. The more markets you need to trade in for your legs, the more risk you have of acting on out of date information. This risk can be mitigated somewhat by the use of limit orders, however even with this there remains the risk of only partially filling one of the trade legs.

For instance in the earlier example you could have set a limit sell price of 102 for the future, guaranteeing that you would fill at no less than 102. The result of this however, is that you would end up long 1000 units of spot and short only 200 units of the future, meaning that your spot position is now only partially hedged. This is particularly dangerous, since now you have full delta risk (of 800) on the spot leg that’s fully executed, and any downward price movement could easily wipe out your attempt to make a small amount of yield from basis trading.

Technology

Anyone who works in the software industry (and certainly anyone who experienced early windows versions) will attest to the fallibility of computers. The exchange itself can go down, or the connectivity between you and the exchange can be interrupted causing only some of the legs to be executed. Such a position can be doubly bad, as not only are you potentially exposed, but you may not even know if you are exposed if connectivity has been interrupted.

Can You Beat the Spread?

I love practical examples and I’m a gamer at heart, so I’ve built a small game to get the point across. In it, you play a trader trying to execute a basis trade with both a spot and a future symbol. The data is randomly generated, but your goal is to try and execute a trade with a positive fixed return. So for example, if spot is at 108.4, and the future is at 109.4, you can switch between the tabs and buy spot/sell the future. You need to be quick though, so choose your timing carefully!

This game is a bit contrived as it allows you to go short spot for free (normally you would pay borrow costs) and the prices move way faster than they would regularly. However, it is meant to illustrate that trying to do this manually on a website can actually be trickier than it seems. If you’re a developer, you can check out the source code if you are interested.

Try and achieve a positive spread. Have a go at watch-your-legs.netlify.app.

Using Technology to Mitigate Leg Risk

All of the issues and risks mentioned above, can be mitigated by the use of a reliable trading system. Many large funds will deal with leg risk by paying close attention to the market. Slippage can be mitigated (though not completely) by tracking the order book in real time, and constantly evaluating whether a trade is viable. This is not necessarily that complicated, and even the basis trade website I made earlier (cryptoncarry.com) takes slippage into account when assessing a potential trade. However it does require a proper technology setup with reliable feeds, and potentially even financial modelling to estimate what liquidity will look like in the future.

Latency is much harder to deal with. As mentioned HFT funds go to extreme lengths to get information faster, including setting up a network of microwave transmitters across Europe to reduce latency. Such assets are generally not available to the individual investor. But much like with liquidity, financial modelling can be used to try and estimate if the price will change by the time your order arrives at the exchange.

The issue with all of this is that it is quite involved, and generally out of reach of most smaller scale investors. Building, deploying and maintaining such a setup is not really feasible unless you have money (or time and development skills) to spend.

Block Trading & Atomicity

The crux of leg risk can generally be boiled down to two aspects:

  • The unpredictability of the market when executing the legs, which can lead to slippage.
  • The lack of atomicity when executing legs, leading to potentially a partial or no fill on some legs.

Atomicity is a property that means that either all of the legs execute, or none of them do. We covered this concept briefly in how smart contracts work, and how a failure of any one instruction leads to a rollback of any already executed instructions. For multi-leg trades this is a highly desirable property, since it allows the trader to guarantee that all the objectives (price, quantity, etc) of their individual legs have been achieved, and roll back or cancel if they haven’t.

Certain exchanges actually provide an advanced mechanism to do this, known as a block trade. A block trade is a special trade that is carried out privately between two counterparties, outside of the orderbook. They are often for a large size of one instrument, but they can also be done not just for one instrument, but for many at once. Since these trades are done privately party-to-party, they are usually done via a Request For Quote (RFQ) system where potential takers will put out a request for a block, and market markers will offer them a price.

The block itself will contain multiple instruments such as e.g. spot and future legs. The market maker will then provide an offer for the whole block, with a price for both the spot and futures legs as a group. The below diagram outlines how this workflow works.

An example workflow for a multi-leg block trade

Most importantly, this trade is atomic meaning that you either do all the legs at the desired price, or you do none at all. You never have the aforementioned risk of partially executing, or the executed price being different. It is essentially offloading the leg risk to a third party. A market maker usually takes on the risk, but typically this will be a firm that has the capability and technology to hedge and mitigate this risk effectively. For traders who either do not have the time or the capability of executing complex multi-leg trades, this facility considerably de-risks the process.

Multi-Leg Trades For All

Despite block trades being done party-to-party, they can often achieve better prices than executing directly in the orderbook. This benefit typically increases the larger the size of the trade, since market makers usually have access to multiple venues where they can offload or hedge a large block. A caveat however, is that this type of facility is normally only available to clients who would trade in large enough size - typically USD100,000 or greater, which largely excludes retail traders.

Paradigm offer a service that allows anyone to execute a fixed or variable rate basis block trade which is settled on either Deribit, ByBit or (recently) FTX. There is no minimum block trade size (on Bybit and FTX), which means any retail investors (in addition to the usual large institutions) are free to take advantage of block trading. Much like above, this service allows different combinations of spot, futures and perps to be quoted as an atomic multi-leg trade, allowing traders to avoid leg risk.

Paradigm interfaces with various exchanges which provide a settlement layer to the trades. Using block trades, Paradigm can allow market makers to quote a variety of complex strategies in a single place. For the trader, this requires providing an API key for your exchange account to the Paradigm app in order for it to execute a block trade on a settling exchange on your behalf.

The future spreads dashboard on Paradigm with potential spread trades laid out in a grid.

In the screenshot above, you can see a dashboard showing potential future spreads. These are laid out in a grid, with the near leg on the Y axis, and the far leg on the X axis. Near and far in this case represent the near (expiring first) and far (expiring later) dated futures in the spread. These represent the two legs in the multi-leg futures spread, and each has a separate bid/ask price.

Future spread execution window with prices quoted as spreads rather than absolute prices.

Astute readers may notice that the bid/ask prices don’t look familiar. This is because instead of quoting two separate legs with their absolute price e.g. spot at $40,000 and future at $40,100, they instead quote the spread between the far leg (the future) and the near leg (the spot), so $100. This method of quoting allows the trader to remain effectively price agnostic when trading the future’s spread. If the user sells the spread (which is long spot, short future) then the application will create a block trade with the counterparty at the current futures mark price, with the spread that was agreed upon applied.

Because these spreads are quoted in an order book, it is even possible to place a limit order for the spread. This would not be safe to do if you were placing the legs separately due to the risk of getting only filled on one leg, and not the other. Due to the atomicity and predictability of trading the spread itself traders can retain tighter control of their execution of multi-leg trades.

In addition, it is now possible to trade much smaller sizes (e.g. 0.0001 BTC) so retail traders executing smaller sized basis trades can take advantage of the service. If you can’t switch tabs between the spot and futures screen fast enough, consider giving it a try!

Article by
Kris Machowski @KrisMachowski
Developer in the Crypto/Finance space. Author of machow.ski blog.

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Block quote

Ordered list

  1. Item 1
  2. Item 2
  3. Item 3

Unordered list

  • Item A
  • Item B
  • Item C

Text link

Bold text

Emphasis

Superscript

Subscript

We've recently updated our privacy policy. The updated policy can be found here. Continued use of our services constitutes acceptance of our updated policy.