<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[The Quant Stack: Arb Wiki]]></title><description><![CDATA[Various articles on arbitrage strategies I’ve ran or attempted to run over my years in quant (mostly crypto focused)]]></description><link>https://www.algos.org/s/arb-wiki</link><image><url>https://substackcdn.com/image/fetch/$s_!1nam!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d11d4ff-8ca9-48a4-b1d4-9d7cd609f7b2_391x391.png</url><title>The Quant Stack: Arb Wiki</title><link>https://www.algos.org/s/arb-wiki</link></image><generator>Substack</generator><lastBuildDate>Fri, 15 May 2026 23:02:05 GMT</lastBuildDate><atom:link href="https://www.algos.org/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Quant Arb]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[quantitativearb67@gmail.com]]></webMaster><itunes:owner><itunes:email><![CDATA[quantitativearb67@gmail.com]]></itunes:email><itunes:name><![CDATA[Quant Arb]]></itunes:name></itunes:owner><itunes:author><![CDATA[Quant Arb]]></itunes:author><googleplay:owner><![CDATA[quantitativearb67@gmail.com]]></googleplay:owner><googleplay:email><![CDATA[quantitativearb67@gmail.com]]></googleplay:email><googleplay:author><![CDATA[Quant Arb]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Finding Arbitrage Opportunities]]></title><description><![CDATA[Where the best arbitrage opportunities are]]></description><link>https://www.algos.org/p/finding-arbitrage-opportunities</link><guid isPermaLink="false">https://www.algos.org/p/finding-arbitrage-opportunities</guid><dc:creator><![CDATA[Quant Arb]]></dc:creator><pubDate>Mon, 22 Sep 2025 20:20:52 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!ejsU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa07f4424-6b98-4766-92d5-01787037cbad_734x401.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ejsU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa07f4424-6b98-4766-92d5-01787037cbad_734x401.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ejsU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa07f4424-6b98-4766-92d5-01787037cbad_734x401.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ejsU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa07f4424-6b98-4766-92d5-01787037cbad_734x401.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ejsU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa07f4424-6b98-4766-92d5-01787037cbad_734x401.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ejsU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa07f4424-6b98-4766-92d5-01787037cbad_734x401.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ejsU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa07f4424-6b98-4766-92d5-01787037cbad_734x401.jpeg" width="734" height="401" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a07f4424-6b98-4766-92d5-01787037cbad_734x401.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:401,&quot;width&quot;:734,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Super Dump Of Vintage/Retro Science Fiction Art - Imgur&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Super Dump Of Vintage/Retro Science Fiction Art - Imgur" title="Super Dump Of Vintage/Retro Science Fiction Art - Imgur" srcset="https://substackcdn.com/image/fetch/$s_!ejsU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa07f4424-6b98-4766-92d5-01787037cbad_734x401.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ejsU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa07f4424-6b98-4766-92d5-01787037cbad_734x401.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ejsU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa07f4424-6b98-4766-92d5-01787037cbad_734x401.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ejsU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa07f4424-6b98-4766-92d5-01787037cbad_734x401.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Introduction</h3><div><hr></div><p>Half the work with arbitrage trading is figuring out where the opportunities are. You can make your system as advanced as you want, but if you can&#8217;t find the exchanges and products where all the returns are concentrated then you won&#8217;t be very profitable.</p><p>In this article, I explain what to look for when deciding on whether to add an exchange and even when you do integrate an exchange the reasons why the initial research showing arbs could be unrealistic (wash flow, internalized flow, etc).</p><p>Then, finally &#8212; the part most of you are deeply interested in, I explicitly share where the best arbitrage opportunities currently are and can actually be captured based on my own private research. </p><p></p>
      <p>
          <a href="https://www.algos.org/p/finding-arbitrage-opportunities">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Ultimate Crypto Arbitrage Guide]]></title><description><![CDATA[A full walkthrough of all the arbitrage strategies and how they're pulled off]]></description><link>https://www.algos.org/p/ultimate-crypto-arbitrage-guide</link><guid isPermaLink="false">https://www.algos.org/p/ultimate-crypto-arbitrage-guide</guid><dc:creator><![CDATA[Quant Arb]]></dc:creator><pubDate>Fri, 20 Jun 2025 15:33:47 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!JYDb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4635e18-dc27-4401-8a36-0627ba80bebb_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!JYDb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4635e18-dc27-4401-8a36-0627ba80bebb_1536x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JYDb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4635e18-dc27-4401-8a36-0627ba80bebb_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!JYDb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4635e18-dc27-4401-8a36-0627ba80bebb_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!JYDb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4635e18-dc27-4401-8a36-0627ba80bebb_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!JYDb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4635e18-dc27-4401-8a36-0627ba80bebb_1536x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JYDb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4635e18-dc27-4401-8a36-0627ba80bebb_1536x1024.png" width="1456" height="971" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c4635e18-dc27-4401-8a36-0627ba80bebb_1536x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:971,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JYDb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4635e18-dc27-4401-8a36-0627ba80bebb_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!JYDb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4635e18-dc27-4401-8a36-0627ba80bebb_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!JYDb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4635e18-dc27-4401-8a36-0627ba80bebb_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!JYDb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4635e18-dc27-4401-8a36-0627ba80bebb_1536x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Introduction</h3><div><hr></div><p>Let&#8217;s start with the textbook basics - the definition. What is arbitrage afterall? Well, the dictionary will give you this definition:</p><blockquote><p><strong>the <a href="https://www.google.com/search?num=10&amp;sca_esv=ee5c04314dac669e&amp;rlz=1C1CHBF_enGB1124GB1124&amp;q=simultaneous&amp;si=AMgyJEvfjzRzn-1LlmPs29qkb8mqC79J43hCCeyBmpABkRVqX9Hm2psTjOuj3MxkzXSfI7aBj2J7u7zHLJX0fIrnIC1Z_wcB85ffxypCLD8NW5e0V14iP-k%3D&amp;expnd=1&amp;sa=X&amp;sqi=2&amp;ved=2ahUKEwjih8fx4NqNAxUhGBAIHV1vB3kQyecJegQIIhAS">simultaneous</a> buying and selling of securities, currency, or commodities in different markets or in derivative forms in order to take advantage of <a href="https://www.google.com/search?num=10&amp;sca_esv=ee5c04314dac669e&amp;rlz=1C1CHBF_enGB1124GB1124&amp;q=differing&amp;si=AMgyJEu0vuRfTngwPFrZh1qV1iGHKk2QuelpIydC5S9l05rgVrc7Z674w0605WSR1i2UpqmS8IqxM6NDqQjVEQl7eNjq5eGCqiiiojpw8IASucWjKON3Yes%3D&amp;expnd=1&amp;sa=X&amp;sqi=2&amp;ved=2ahUKEwjih8fx4NqNAxUhGBAIHV1vB3kQyecJegQIIhAT">differing</a> prices for the same asset.</strong></p></blockquote><p>I&#8217;d say this is a fairly good definition for arbitrage in the traditional sense, but in the modern sense&#8230; I&#8217;m not really sure this is true. Most advanced arbitrage trading doesn&#8217;t hedge the other side of the trade simultaneously at all. If you are in and out of the position in a couple seconds, then why would you even care about being hedged? Especially if you know that the side you are trading is the one doing all the moving. </p><p>Let&#8217;s say we have two exchanges. ShitEx and MegaEx. MegaEx trades 500 billion USD a day, ShitEx trades about 500 million USD a day. If they diverge do you really expect that MegaEx and ShitEx will both meet in the middle? Probably not&#8230; In fact, ShitEx will do almost all of the moving, which we can round to 100% of the moving when we consider that we really only care about moves that occur in excess of our cost to trade (which is very non-trivial for this kind of trading). </p><p>This is just the introduction so we&#8217;ll avoid diving into too much of the advanced weeds but you can already see from this example that the textbook definition isn&#8217;t quite what arbitrage trading looks like in practice. In today&#8217;s article, I will take a walk through all the different forms of arbitrage trading and what it realistically looks like to trade these opportunities. Not simply taking the textbook approach, but showing how real money gets made by professional arbitrageurs. </p><p></p><h3>Index</h3><div><hr></div><ol><li><p>Introduction</p></li><li><p>Index</p></li><li><p>Types of Arbitrage</p></li><li><p>Where can *I* find alpha?</p></li><li><p>Execution</p></li><li><p>When should you hedge?</p></li><li><p>When you have to predict</p></li><li><p>Incompletes</p></li><li><p>Normalization</p></li><li><p>Reducing trading costs</p></li><li><p>Trading more things</p></li><li><p>Leverage &amp; Borrowing</p></li><li><p>Funding Arbitrage</p></li><li><p>Spot Arbitrage</p></li><li><p>Perpetuals Arbitrage</p></li><li><p>Triangular Arbitrage</p></li><li><p>Geographic Arbitrage</p></li></ol><p></p>
      <p>
          <a href="https://www.algos.org/p/ultimate-crypto-arbitrage-guide">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Geographic Arbitrage]]></title><description><![CDATA[An operational edge that requires you to get down and dirty in the weeds of it]]></description><link>https://www.algos.org/p/geographic-arbitrage</link><guid isPermaLink="false">https://www.algos.org/p/geographic-arbitrage</guid><dc:creator><![CDATA[Quant Arb]]></dc:creator><pubDate>Sun, 17 Nov 2024 14:14:05 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F254821d3-0748-4f8b-a386-295634f0f6b1_708x466.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GkCg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3479b4d4-e51e-4f83-b549-a31737c99370_1024x998.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GkCg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3479b4d4-e51e-4f83-b549-a31737c99370_1024x998.jpeg 424w, https://substackcdn.com/image/fetch/$s_!GkCg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3479b4d4-e51e-4f83-b549-a31737c99370_1024x998.jpeg 848w, https://substackcdn.com/image/fetch/$s_!GkCg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3479b4d4-e51e-4f83-b549-a31737c99370_1024x998.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!GkCg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3479b4d4-e51e-4f83-b549-a31737c99370_1024x998.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GkCg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3479b4d4-e51e-4f83-b549-a31737c99370_1024x998.jpeg" width="1024" height="998" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3479b4d4-e51e-4f83-b549-a31737c99370_1024x998.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:998,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:93507,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GkCg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3479b4d4-e51e-4f83-b549-a31737c99370_1024x998.jpeg 424w, https://substackcdn.com/image/fetch/$s_!GkCg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3479b4d4-e51e-4f83-b549-a31737c99370_1024x998.jpeg 848w, https://substackcdn.com/image/fetch/$s_!GkCg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3479b4d4-e51e-4f83-b549-a31737c99370_1024x998.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!GkCg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3479b4d4-e51e-4f83-b549-a31737c99370_1024x998.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Introduction</h3><div><hr></div><blockquote><p>&#8220;Maybe the real small trader alpha is just not having a compliance department&#8221; - Quant Arb to WorstContrarian via Twitter</p></blockquote><p>There are many kinds of edges, but one of the most defendable edges is an operational edge. Effectively, your edge comes from the fact that doing the trade is a lot of work. Who wants to make friends with local bankers in T&#252;rkiye? Very few is the answer.</p><p>This is a niche that can hit quite a bit of scale, and as a result is an area me and my team spent a fair few months looking into (about 2 years ago) so today let&#8217;s talk a bit about the trade and it&#8217;s core details.</p><p>Geographic arbitrages move money between local and international markets for a currency.</p><p></p><h3>Index</h3><div><hr></div><ol><li><p>Introduction</p></li><li><p>Index</p></li><li><p>How the trade works</p></li><li><p>Where it works</p></li><li><p>Bribes &amp; Smuggling</p></li><li><p>Getting money out of T&#252;rkiye</p></li><li><p>Liquidity maximization</p></li><li><p>Price Effects</p></li></ol><p></p><h3>How the trade works</h3><div><hr></div><p>Let&#8217;s take the example of the Turkish Lira. We start with USD, or another highly liquid and easily transferable currency (JPY, EUR, GBP). The imbalance is typically created via a mass exodus from a certain currency to liquid international currencies so in basically every case we will be selling into international markets and buying local markets.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5BZr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be71009-c31a-45cf-b29b-2a53a6b28c7e_845x513.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5BZr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be71009-c31a-45cf-b29b-2a53a6b28c7e_845x513.png 424w, https://substackcdn.com/image/fetch/$s_!5BZr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be71009-c31a-45cf-b29b-2a53a6b28c7e_845x513.png 848w, https://substackcdn.com/image/fetch/$s_!5BZr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be71009-c31a-45cf-b29b-2a53a6b28c7e_845x513.png 1272w, https://substackcdn.com/image/fetch/$s_!5BZr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be71009-c31a-45cf-b29b-2a53a6b28c7e_845x513.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5BZr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be71009-c31a-45cf-b29b-2a53a6b28c7e_845x513.png" width="845" height="513" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4be71009-c31a-45cf-b29b-2a53a6b28c7e_845x513.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:513,&quot;width&quot;:845,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!5BZr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be71009-c31a-45cf-b29b-2a53a6b28c7e_845x513.png 424w, https://substackcdn.com/image/fetch/$s_!5BZr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be71009-c31a-45cf-b29b-2a53a6b28c7e_845x513.png 848w, https://substackcdn.com/image/fetch/$s_!5BZr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be71009-c31a-45cf-b29b-2a53a6b28c7e_845x513.png 1272w, https://substackcdn.com/image/fetch/$s_!5BZr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be71009-c31a-45cf-b29b-2a53a6b28c7e_845x513.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We move our USD to local Turkish exchanges and then trade for TRY, we then transfer the TRY out of the country to a liquid international FX exchange such as LMAX and convert TRY back to USD. </p><p>We can optimize this by using cryptocurrencies. Instead of starting with USD, we start with USDT, BTC, ETH, or any combination of popular liquid cryptocurrencies. We then send these directly to BTCTurk, a popular Turkish crypto exchange. We can then convert this into TRY on exchange, withdraw it, transfer to LMAX, convert to USD, move to Binance or a liquid crypto exchange and convert back to crypto. We may also prefer to use an OTC dealer that can convert TRY directly to crypto. We end up with a roughly 1-2% profit per cycling of our capital through this trade.</p>
      <p>
          <a href="https://www.algos.org/p/geographic-arbitrage">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Small Trader Alpha #7: Perpetual Arbitrage Pt. 2]]></title><description><![CDATA[Advanced perpetual arbitrage strategy]]></description><link>https://www.algos.org/p/small-trader-alpha-7-perpetual-arbitrage</link><guid isPermaLink="false">https://www.algos.org/p/small-trader-alpha-7-perpetual-arbitrage</guid><dc:creator><![CDATA[Quant Arb]]></dc:creator><pubDate>Tue, 01 Oct 2024 11:02:03 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!QCAO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd33d3137-041d-4acb-94d5-d0fa34ac2706_1792x1024.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QCAO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd33d3137-041d-4acb-94d5-d0fa34ac2706_1792x1024.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QCAO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd33d3137-041d-4acb-94d5-d0fa34ac2706_1792x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!QCAO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd33d3137-041d-4acb-94d5-d0fa34ac2706_1792x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!QCAO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd33d3137-041d-4acb-94d5-d0fa34ac2706_1792x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!QCAO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd33d3137-041d-4acb-94d5-d0fa34ac2706_1792x1024.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QCAO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd33d3137-041d-4acb-94d5-d0fa34ac2706_1792x1024.webp" width="1456" height="832" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d33d3137-041d-4acb-94d5-d0fa34ac2706_1792x1024.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:832,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Create a more glorious and grand cover image for a Substack article about implementing a trading algorithm, in landscape format. The cover should resemble a prestigious, 'holy grail' textbook on perpetual arbitrage for cryptocurrency, sitting on a luxurious wooden table. The book design should be ornate, with gold accents, intricate borders, and a bold title that reads 'Perpetual Arbitrage Trading' in an elegant, commanding font. Include subtle, refined crypto-themed symbols like Bitcoin and Ethereum logos, and trading charts. The lighting should be dramatic, casting a warm, radiant glow on the book, emphasizing its grandeur and importance.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Create a more glorious and grand cover image for a Substack article about implementing a trading algorithm, in landscape format. The cover should resemble a prestigious, 'holy grail' textbook on perpetual arbitrage for cryptocurrency, sitting on a luxurious wooden table. The book design should be ornate, with gold accents, intricate borders, and a bold title that reads 'Perpetual Arbitrage Trading' in an elegant, commanding font. Include subtle, refined crypto-themed symbols like Bitcoin and Ethereum logos, and trading charts. The lighting should be dramatic, casting a warm, radiant glow on the book, emphasizing its grandeur and importance." title="Create a more glorious and grand cover image for a Substack article about implementing a trading algorithm, in landscape format. The cover should resemble a prestigious, 'holy grail' textbook on perpetual arbitrage for cryptocurrency, sitting on a luxurious wooden table. The book design should be ornate, with gold accents, intricate borders, and a bold title that reads 'Perpetual Arbitrage Trading' in an elegant, commanding font. Include subtle, refined crypto-themed symbols like Bitcoin and Ethereum logos, and trading charts. The lighting should be dramatic, casting a warm, radiant glow on the book, emphasizing its grandeur and importance." srcset="https://substackcdn.com/image/fetch/$s_!QCAO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd33d3137-041d-4acb-94d5-d0fa34ac2706_1792x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!QCAO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd33d3137-041d-4acb-94d5-d0fa34ac2706_1792x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!QCAO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd33d3137-041d-4acb-94d5-d0fa34ac2706_1792x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!QCAO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd33d3137-041d-4acb-94d5-d0fa34ac2706_1792x1024.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Introduction</h3><div><hr></div><p>In the previous article in the small trader alpha series, we walked through a taker strategy quite broadly. Now, we will dive into the implementation details of that providing the *FULL* code for a perpetual arbitrage scanner in Rust that can be put into production.</p><p>This article will explain the code, but the appendix will contain the entire code which can easily be copy-pasted. This is the easiest method instead of everyone having to email me for access to a GitHub. In making this project, we were also able to contribute to barter-rs, an open-source project similar to CCXT but for Rust.</p><p>This code is presented with the intention that the comments and naming should be self-documenting. Thus, it is up to the reader to build that understanding of how it works by reading it. This is a simple expectation I hope.</p>
      <p>
          <a href="https://www.algos.org/p/small-trader-alpha-7-perpetual-arbitrage">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Small Trader Alpha #6: Perpetual Arbitrage ]]></title><description><![CDATA[Arbitrage between perpetuals and a deep dive into the world of global lead-lag]]></description><link>https://www.algos.org/p/small-trader-alpha-6-perpetual-arbitrage</link><guid isPermaLink="false">https://www.algos.org/p/small-trader-alpha-6-perpetual-arbitrage</guid><dc:creator><![CDATA[Quant Arb]]></dc:creator><pubDate>Tue, 09 Jul 2024 17:13:09 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!aCRL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48edad68-a1fa-4a91-89ef-abd3fdc7bd79_928x753.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>Introduction</h3><div><hr></div><p>The most liquid way to trade in digital assets is through the perpetual markets. However, they&#8217;re not precisely the same instrument, even if they have the same ticker, so this adds quite a bit of complexity to the equation.</p><p>We&#8217;ll tease some PNL - this is one coin only, between 2 exchanges, and top-of-book. The shape is the part to focus on; the scaling part is trivial.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aCRL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48edad68-a1fa-4a91-89ef-abd3fdc7bd79_928x753.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aCRL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48edad68-a1fa-4a91-89ef-abd3fdc7bd79_928x753.png 424w, https://substackcdn.com/image/fetch/$s_!aCRL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48edad68-a1fa-4a91-89ef-abd3fdc7bd79_928x753.png 848w, https://substackcdn.com/image/fetch/$s_!aCRL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48edad68-a1fa-4a91-89ef-abd3fdc7bd79_928x753.png 1272w, https://substackcdn.com/image/fetch/$s_!aCRL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48edad68-a1fa-4a91-89ef-abd3fdc7bd79_928x753.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aCRL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48edad68-a1fa-4a91-89ef-abd3fdc7bd79_928x753.png" width="928" height="753" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/48edad68-a1fa-4a91-89ef-abd3fdc7bd79_928x753.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:753,&quot;width&quot;:928,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aCRL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48edad68-a1fa-4a91-89ef-abd3fdc7bd79_928x753.png 424w, https://substackcdn.com/image/fetch/$s_!aCRL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48edad68-a1fa-4a91-89ef-abd3fdc7bd79_928x753.png 848w, https://substackcdn.com/image/fetch/$s_!aCRL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48edad68-a1fa-4a91-89ef-abd3fdc7bd79_928x753.png 1272w, https://substackcdn.com/image/fetch/$s_!aCRL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48edad68-a1fa-4a91-89ef-abd3fdc7bd79_928x753.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><h3>Index</h3><div><hr></div><ol><li><p>Introduction </p></li><li><p>Index</p></li><li><p>Part 1: Basics</p><ol><li><p>Overview of Perpetual Arbitrage </p></li><li><p>Stable-coin basis</p></li><li><p>Normalisation of contracts</p></li><li><p>Entry / Exit Timing</p></li></ol></li><li><p>Part 2: Implementation</p><ol><li><p>Data Scraping</p></li><li><p>Pre-Processing</p></li><li><p>Checking For Opportunities </p></li><li><p>Taker Backtest</p></li></ol></li><li><p>Part 3: Advanced Trading</p><ol><li><p>Maker / Taker Execution </p></li><li><p>Volume &amp; Lead-Lag</p></li><li><p>Latency &amp; Message Ordering</p></li><li><p>Mean Estimate Free Reversion</p></li><li><p>Global Lead Lag</p></li></ol></li><li><p>Conclusion</p></li><li><p>Further Reading</p></li></ol><p></p><h3>Part 1: Basics</h3><div><hr></div><p>To start, it&#8217;s worth mapping out the trade and how to achieve a simplified version of it. These don&#8217;t work so well in the modern market, although they did previously, but that&#8217;s why we have the advanced trading section - to get readers up to speed on the state of the art.</p><p></p><h4>Overview of Perpetual Arbitrage</h4><div><hr></div><p>Like most of the trades we&#8217;ve covered, perpetual arbitrage has a statistical element to it. In fact, it&#8217;s not even technically a pure arbitrage and is counted as a statistical arbitrage - although it relies on mechanical forces which pull assets back together (unlike a purely statistical trade). </p><p>We are effectively betting on the convergence of two perpetual contracts, likely cross-exchange.</p><p>It mimics pairs trading in the regard that we have some entry threshold for the spread and an exit thread (usually the mean), and similarly we use methods from pairs trading to time this spread.</p><p>In the below sketch, we can see the cross exchange prices of 2 Solana perpetuals on different exchanges: </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jrZq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2f54f04-33b4-48d4-bc42-c7e968a8bd33_1343x1154.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jrZq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2f54f04-33b4-48d4-bc42-c7e968a8bd33_1343x1154.jpeg 424w, https://substackcdn.com/image/fetch/$s_!jrZq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2f54f04-33b4-48d4-bc42-c7e968a8bd33_1343x1154.jpeg 848w, https://substackcdn.com/image/fetch/$s_!jrZq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2f54f04-33b4-48d4-bc42-c7e968a8bd33_1343x1154.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!jrZq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2f54f04-33b4-48d4-bc42-c7e968a8bd33_1343x1154.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jrZq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2f54f04-33b4-48d4-bc42-c7e968a8bd33_1343x1154.jpeg" width="1343" height="1154" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a2f54f04-33b4-48d4-bc42-c7e968a8bd33_1343x1154.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1154,&quot;width&quot;:1343,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:442847,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jrZq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2f54f04-33b4-48d4-bc42-c7e968a8bd33_1343x1154.jpeg 424w, https://substackcdn.com/image/fetch/$s_!jrZq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2f54f04-33b4-48d4-bc42-c7e968a8bd33_1343x1154.jpeg 848w, https://substackcdn.com/image/fetch/$s_!jrZq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2f54f04-33b4-48d4-bc42-c7e968a8bd33_1343x1154.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!jrZq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2f54f04-33b4-48d4-bc42-c7e968a8bd33_1343x1154.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Three things that are important to notice:</p><ol><li><p>Our perpetuals use different quoting assets (USD v.s. USDC)</p></li><li><p>The OKX perpetual trades consistently higher than the Binance perpetual </p></li><li><p>They are strongly tied to one another </p></li></ol><p>Our first and second observations both tie into each other. The consistency in the price difference can be any of 3 causes:</p><ol><li><p>Stablecoin differences (USDC / USD)</p></li><li><p>Structural differences </p></li><li><p>Contract differences </p></li></ol><p>With stablecoin driven differences we can easily adjust by tracking the prices of different stablecoins and with contract differences we can investigate how different the contracts between two exchanges are manually (we will explore contract normalization as a topic soon). </p><p>Finally, our differences may be entirely structural and related to the specific flows that occur on each platform. Whilst theories as to why may vary, it&#8217;s no secret that certain exchanges simply trade higher relative to others. Likely because of how their indexes are constructed. </p><p>There&#8217;s also differences in their basis volatility due to how the indexes are constructed. A good proxy for this is the closeness to a total share of total market volume that the index covers. An index made of Bybit, Okex, and Binance will be very stable, but if it&#8217;s driven entirely by an exchange&#8217;s own spot market, especially a smaller exchange</p><p>When we divide the two assets by another, we get the spread ratio. This is useful for timing as it&#8217;s a lot more normalized between assets, but is not directly trade-able:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Eo8t!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50034392-cfe7-424a-8fbb-20eed18304c6_924x794.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Eo8t!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50034392-cfe7-424a-8fbb-20eed18304c6_924x794.png 424w, https://substackcdn.com/image/fetch/$s_!Eo8t!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50034392-cfe7-424a-8fbb-20eed18304c6_924x794.png 848w, https://substackcdn.com/image/fetch/$s_!Eo8t!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50034392-cfe7-424a-8fbb-20eed18304c6_924x794.png 1272w, https://substackcdn.com/image/fetch/$s_!Eo8t!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50034392-cfe7-424a-8fbb-20eed18304c6_924x794.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Eo8t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50034392-cfe7-424a-8fbb-20eed18304c6_924x794.png" width="924" height="794" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/50034392-cfe7-424a-8fbb-20eed18304c6_924x794.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:794,&quot;width&quot;:924,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:156445,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Eo8t!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50034392-cfe7-424a-8fbb-20eed18304c6_924x794.png 424w, https://substackcdn.com/image/fetch/$s_!Eo8t!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50034392-cfe7-424a-8fbb-20eed18304c6_924x794.png 848w, https://substackcdn.com/image/fetch/$s_!Eo8t!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50034392-cfe7-424a-8fbb-20eed18304c6_924x794.png 1272w, https://substackcdn.com/image/fetch/$s_!Eo8t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50034392-cfe7-424a-8fbb-20eed18304c6_924x794.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>What we can actually trade is the difference - where we subtract the price of one asset from another.</p><p></p><h4>Stablecoin Basis</h4><div><hr></div><p>As we touched on earlier, the first step to normalizing our spreads is to account for Stablecoin basis. The price of stablecoins, much like the perpetuals, varies by exchange so we need to normalize based on this. If the exchange has the stablecoin market pair listed, then it&#8217;ll be best to use this.</p><p>In the event of a depegging, we will want to switch off the system so it&#8217;s critical that the system has an edge scenario for this. Otherwise we may end up betting on the depeg due to large discrepancies in stablecoin prices cross exchange. This is not because the depeg will cause the prices to be different, since we would of course have adjusted for this, but because during a depeg the prices vary drastically.</p><p>We can look at Coinbase which got as low as 93c on the dollar when USDC depegged whereas other exchanges only depegged a few cents. KuCoin also depegged a lot more than others. Hence, unless we adjusted for the exchange-specific prices of stablecoins, instead of trying to apply some global price, we would&#8217;ve seen a basis between perpetuals that was a bet on USDC. Even if we did manage to adjust well, there&#8217;s a good chance we would&#8217;ve still needed to monitor the system because of the significant variance introduced by the stablecoin basis.</p><p>It&#8217;s also worth remembering that some exchanges will write -USD on the ticker symbolism, but when you read the documentation, they&#8217;re marking it against USDC or USDT. There may also be USDC, USDT, and USD perpetuals for the same asset on a given exchange, and you can **usually** use the ratio between these to get an idea of the exchange-specific rate for stablecoins (if one is not present). You can only use this proxy if the contracts settle the same way and have the same funding payment specifications. They don&#8217;t always, sometimes the USD ones are coin margined, and I&#8217;ve seen coin margined have different funding intervals to stablecoin margined perpetuals before.</p><p></p><h4>Normalization of Contracts</h4><div><hr></div><p>Converting perpetual prices from one venue, like Binance, to another, such as Bybit, Okx, or Hyperliquid, is complex.</p><p>Using Binance's perpetual prices directly is not optimal, especially for platforms with shorter perpetual durations, like hourly ones on DEXs. This is because perpetual prices tend to converge towards the spot price in a pattern that resembles descending stairs until a funding payment occurs, which then causes a jump. We don&#8217;t want to make trades that get us into a bad position on funding payments. </p><p>An alternative approach of relying solely on spot prices is also flawed. It may lead to imbalanced positions, favouring underperforming coins while shorting the surging ones. A potential solution is to "clean" the perpetual prices from a platform like Binance by accounting for accrued but unpaid funding payments, adjusting for rate differences, and then subtracting the accrued coupon for the specific platform you're converting to. </p><p>This method is only moderately effective due to various challenges:</p><ol><li><p>Different indices used across platforms can lead to discrepancies, especially during volatile market conditions.</p></li><li><p>There are limits on how high funding payments can go, which vary by exchange.</p></li><li><p>Funding rates change frequently, affecting the conversion due to the non-linear nature of common funding formulas.</p></li><li><p>Practical implementation issues, such as determining accrued funding payments and adjusting for rate differences, considering the intricacies of funding rate formulas.</p></li></ol><p>The closest approach to a practical solution involves taking Binance's perpetual prices, adjusting for accrued funding payments and rate differences, and then recalculating the funding payments. </p><p>However, there's no one-size-fits-all formula for this, and you&#8217;ll turn off specific exchange pairs or increase their entry thresholds in your system to try to counter this.</p><p>An effective strategy involves analyzing data to understand how funding payments evolve relative to premiums and devising cross-venue adjustments based on empirical evidence. </p><p>This should include models for predicting how spot prices will converge across different venues. These are mostly driven by relative volumes on each exchange.</p><p>We want to remember the notion of confidence throughout. If we deem two perps to be very similar, we can give a higher confidence to it and then size up on a divergence to a greater extent. How that score is developed is up to you as the reader, but generally, it should include components like interval, index price formula, funding limits, and accrual formula.</p><p>In any of these trades, the funding rate can play a significant role in divergence if contracts are misaligned. Thus, we should take these into account for our final live version. </p><p></p><h4>Entry / Exit Timing</h4><div><hr></div><p>Timing our entries and exits for most firms is a simple moving average or perhaps even an exponentially weighted moving average with a set lookback period. This look-back period can be equated between the parameters for an SMA and an EMA using the formula below: </p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\begin{equation}\nN_{\\text{EMA}} \\approx \\frac{2}{\\alpha} - 1\n\\end{equation}&quot;,&quot;id&quot;:&quot;ZNTCYBJBMD&quot;}" data-component-name="LatexBlockToDOM"></div><p>In addition to this, we have a parameter, typically with a value of 2 to set the number of standard deviations from this threshold that we will enter into a trade, with the baseline assumption being that we exit when the price reaches the mean. </p><p>We do not have to exit when price reaches the mean and can instead exit earlier.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_81Y!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F535707cf-5f1b-4a2a-8bce-838d3f02a2c7_697x599.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_81Y!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F535707cf-5f1b-4a2a-8bce-838d3f02a2c7_697x599.png 424w, https://substackcdn.com/image/fetch/$s_!_81Y!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F535707cf-5f1b-4a2a-8bce-838d3f02a2c7_697x599.png 848w, https://substackcdn.com/image/fetch/$s_!_81Y!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F535707cf-5f1b-4a2a-8bce-838d3f02a2c7_697x599.png 1272w, https://substackcdn.com/image/fetch/$s_!_81Y!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F535707cf-5f1b-4a2a-8bce-838d3f02a2c7_697x599.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_81Y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F535707cf-5f1b-4a2a-8bce-838d3f02a2c7_697x599.png" width="697" height="599" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/535707cf-5f1b-4a2a-8bce-838d3f02a2c7_697x599.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:599,&quot;width&quot;:697,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:29518,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_81Y!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F535707cf-5f1b-4a2a-8bce-838d3f02a2c7_697x599.png 424w, https://substackcdn.com/image/fetch/$s_!_81Y!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F535707cf-5f1b-4a2a-8bce-838d3f02a2c7_697x599.png 848w, https://substackcdn.com/image/fetch/$s_!_81Y!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F535707cf-5f1b-4a2a-8bce-838d3f02a2c7_697x599.png 1272w, https://substackcdn.com/image/fetch/$s_!_81Y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F535707cf-5f1b-4a2a-8bce-838d3f02a2c7_697x599.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As we can see in the above diagram, the expected mean reversion between t1 and t2, written as E[MR(t1, t2)] in our diagram, is proportional to the absolute z-score of the spread. The expected mean reversion roughly says how much we expect the absolute z-score to decrease by (towards 0) between two different time steps. I&#8217;ve drawn the relationship as linear, but it could be exponential or plateau out at a higher score - maybe even going negative (likely due to liquidation-based momentum / caps on funding rates that you&#8217;d see these effects); we&#8217;d need to look empirically to see the true relationship, but the general idea stands for now.</p><p>The issue is that the volatility of our spread can roughly be assumed to be constant; if anything, it is proportional to the absolute z-score, but let&#8217;s call it a constant because it&#8217;s an acceptable assumption for the explainer. The expected mean reversion is our edge, so we have a ratio between our edge and the volatility. As we see more of a reversion, the edge shrinks, but our volatility stays the same. So, we get a worse risk-reward ratio as the spread reverts. When we add in the risk of mean estimation errors (differences in moving average parameters can lead to different results), it starts to become questionable whether we should hold entirely to the mean or exit slightly before. </p><p>Thus, we may have a 3rd parameter, our exit z-score.</p><p>It is worth noting that these trades compete aggressively on the ability to beat fees/costs of trading. We could end up tying up capital for ages&#8230; sure, but we also could end up giving away a couple extra bps that mean the world to us when we&#8217;re only working with a few bps after transaction costs in all likelihood. I write this all down so that traders can make their own decisions and so that you know what the experiments are that need to be conducted - not so I can spoon-feed the alpha step by step. No one will do that for you.</p><p></p><h3>Part 2 - Implementation</h3><div><hr></div><p>This section implements a backtest for a basic taker version of the strategy. We will explore a few different days of interest and go from data scraping all the way to our PNL plot. </p><p>For me, at least, the pipeline looks exactly like this every time:</p><ol><li><p>Data Scraping</p></li><li><p>Data Pre-Processing</p></li><li><p>Analysis</p></li><li><p>Analysis Cont. [Optional]</p></li><li><p>Expanded Analysis [Optional]</p></li></ol><p>In this case, I expect the analysis to be a basic opportunity test, and then, from there, the analysis will develop a backtest. Then, finally, we would do an expanded analysis, which would include additional factors. Those additional factors would likely be latency or trading costs, which we vary to see their impact.</p><p>Each of these five steps represents an .ipynb notebook. The alternative for me would be to open a .py file and start building tooling if I am expecting this analysis to be more than just research (other researchers need to validate my findings too, if it&#8217;s going to take up lots of implementation resources like this strategy would since lots of the alpha is on latency)</p><p></p><h4>Data Scraping</h4><div><hr></div><p>We&#8217;ll be using <a href="https://tardis.dev/">Tardis</a> as our data source today since our analysis is historical, but because of the nature of this strategy, you can always open up Rust, subscribe to the WebSocket feeds of all the exchanges you want, start scanning, and log those opportunities to a dataset. You can also use this to scrape your own dataset.</p><p>To start, we import our libraries:</p><pre><code># Import Libraries

import aiohttp
import asyncio
import requests
import nest_asyncio
import json
from urllib import parse
from tardis_dev import datasets
from tqdm import tqdm</code></pre><p>Half of these are my &#8216;default imports&#8217; because the cost of importing is very low, and I typically copy-paste the imports block from another notebook, so realistically, there is no cost to importing libraries I expect to be using. Technically speaking, we can get away with just these:</p><pre><code># Import Libraries

import nest_asyncio
import json
from tardis_dev import datasets

# and maybe, but you can edit the code to remove this
import tqdm </code></pre><p>We are using Python from an IPython environment (Jupyter), so we need nest_asyncio, JSON will be used to open the JSON file with my Tardis API key, and tardis_dev is of course, the Tardis library for downloading. </p><p>TQDM is a helpful library that makes the loops a lot easier to track the progress of. It's pretty helpful when you have hours-long downloads. </p><p>We could end up using requests if we were fetching symbols from the exchange using:</p><pre><code>exchange_name = 'binance-futures'
r = requests.get("https://api.tardis.dev/v1/exchanges/{exchange_name}).json()
results = r.json()</code></pre><p>Before we do that, let&#8217;s define out exchanges, and ticker formats. If we use the requests approach to tickers we don&#8217;t need to define ticker formats:</p><pre><code># list[(exchange-name, exchange-ticker-format)]

exchange_list = [
    ["okex-swap", "-USDT-SWAP"],
    ["bybit", "USDT"],
    ["dydx", "-USD"],
    ["gate-io-futures", "_USDT"],
    ["binance-futures", "USDT"],
]</code></pre><p>For tickers, I wanted to filter by market capitalization, and I already have a hardcoded list, so we&#8217;ll use these:</p><pre><code>base_assets = [
    'CORE', 'BAT', 'MAGIC', 'LDO', 'API3', 'CHZ', 'CVC', 'FITFI',
    'LOOKS', 'SWEAT', 'GMX', 'WAVES', 'LINK', 'BTC', 'AVAX', 'CELO', 'ETC',
    'SAND', 'SOL', 'MASK', 'APT', 'KLAY', 'BAND', 'GRT', 'DOGE', 'FIL',
    'KSM', 'FTM', 'DYDX', 'BICO', 'GALA', 'NEO', 'IMX', 'AAVE', 'OP', 'EGLD',
    'LRC', 'YGG', 'ATOM', 'ONT', 'ETHW', 'SNX', 'MINA', 'QTUM', 'CRV', 'LPT',
    'COMP', 'MANA', 'GMT', 'BCH', 'TRB', 'MATIC', 'ZIL', 'ZEN', 'OMG', 'AXS',
    'ETH', 'DOT', 'REN', 'ANT', '1INCH', 'SLP', 'JST', 'EOS', 'SUSHI', 'APE',
    'PEOPLE', 'XMR',
]</code></pre><p>Now, let&#8217;s define our lookback date, data types, and open our Tardis key:</p><pre><code># Define parameters for data to be scraped

dtypes_list = ["quotes", "trades", "book_snapshot_25"]
start_date = "2024-01-01"
end_date = "2024-01-02"
tardis_api_key = json.loads(json.load(open("secrets.json")))['tardis_key']</code></pre><p>Time to scrape our data. Here is my big chunk of code I usually copy and paste about:</p><pre><code>nest_asyncio.apply()

print_exceptions = True # Some will print errors, but worth checking first run that they're all ticker not found errors

# Loop through available exchanges
for exchange_name, exchange_suffix in exchange_list:
    # Loop through base tickers
    for symbol_prefix in tqdm(base_assets):
        for current_data_type in dtypes_list:
            # Normalizing Ticker Names Based On Exchange
            current_symbol = symbol_prefix + exchange_suffix
            
            # Some tickers will not be available so are caught with an error
            try:
                datasets.download(
                    exchange=exchange_name,
                    data_types=[
                        current_data_type
                    ],
                    from_date=start_date,
                    to_date=end_date,
                    symbols=[
                        current_symbol
                    ],
                    download_dir=f"D:/Market_Data/Digital_Assets/Tardis_Data/{exchange_name}/Futures/{current_symbol}/{current_data_type}",
                    api_key=tardis_api_key,
                )
            except Exception as e:
                if print_exceptions:
                    print(f"Error occurred: {e}")</code></pre><p>My download_dir is specifically set up based on the data structure of my research data on my laptop. You may ask, why not do it all at once with multiple data types and multiple symbols? Well, that's because it has a fit if you give it too much data to download at once so I prefer to do it in smaller chunks, but it is really up to you to experiment with a bit more concurrency in your downloads.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8wW0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc70be37e-ef0e-4a76-af0a-98a0bf9df5ab_1376x305.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8wW0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc70be37e-ef0e-4a76-af0a-98a0bf9df5ab_1376x305.png 424w, https://substackcdn.com/image/fetch/$s_!8wW0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc70be37e-ef0e-4a76-af0a-98a0bf9df5ab_1376x305.png 848w, https://substackcdn.com/image/fetch/$s_!8wW0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc70be37e-ef0e-4a76-af0a-98a0bf9df5ab_1376x305.png 1272w, https://substackcdn.com/image/fetch/$s_!8wW0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc70be37e-ef0e-4a76-af0a-98a0bf9df5ab_1376x305.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8wW0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc70be37e-ef0e-4a76-af0a-98a0bf9df5ab_1376x305.png" width="1376" height="305" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c70be37e-ef0e-4a76-af0a-98a0bf9df5ab_1376x305.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:305,&quot;width&quot;:1376,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:25266,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8wW0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc70be37e-ef0e-4a76-af0a-98a0bf9df5ab_1376x305.png 424w, https://substackcdn.com/image/fetch/$s_!8wW0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc70be37e-ef0e-4a76-af0a-98a0bf9df5ab_1376x305.png 848w, https://substackcdn.com/image/fetch/$s_!8wW0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc70be37e-ef0e-4a76-af0a-98a0bf9df5ab_1376x305.png 1272w, https://substackcdn.com/image/fetch/$s_!8wW0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc70be37e-ef0e-4a76-af0a-98a0bf9df5ab_1376x305.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Don&#8217;t worry if you get a ton of these. It just means that the symbol isn&#8217;t on that exchange. Remember, all we need is for the symbol to be on at minimum 2 exchanges. It doesn&#8217;t need to be on them all. </p><p>You may also want to increase the date range we pull for. I made mine short to save time, but I&#8217;ve used whole years for this kind of analysis in the past. I usually recommend doing a day and then going straight into writing the backtest code. Then, you can re-run the data scraper to scrape more data. This prevents you from sitting at the desk reading a book/paper/whatever you do in this time because you can claim the data is scraping.</p><p></p><h4>Data Pre-Processing</h4><div><hr></div><p>Our data is normalized already because of the Tardis formatting, but it&#8217;s also GZ compressed and has a load of useless columns. Here&#8217;s how we merge multiple exchanges into a format we can use for analysis:</p><pre><code>import pandas as pd
import warnings
import os
from tqdm import tqdm

warnings.filterwarnings("ignore")

# Constants
BASE_DATA_DIR = r"D:/Market_Data/Digital_Assets/Tardis_Data/"
MERGED_DATA_BASE_FOLDER = r"D:/MergedData/MergedTradeQuotes/"

exchange_list = [
    ["okex-swap", "-USDT-SWAP"],
    ["bybit", "USDT"],
    ["dydx", "-USD"],
    ["gate-io-futures", "_USDT"],
    ["binance-futures", "USDT"],
]

def get_folder_names(path):
    return [f for f in os.listdir(path) if os.path.isdir(os.path.join(path, f))]

def isolate_base_asset(exchange_ticker: str, exchange_name: str) -&gt; str:
    append_str = next((append for exch, append in exchange_list if exch == exchange_name), "")
    if not append_str:
        raise ValueError(f"Unknown exchange: {exchange_name}")
    if append_str.startswith(("-", "_")):
        base_asset = exchange_ticker.rsplit(append_str, 1)[0]
    else:
        base_asset = exchange_ticker.rstrip(append_str)
    return base_asset

def create_exchange_ticker(base_asset: str, exchange_name: str) -&gt; str:
    append_str = next((append for exch, append in exchange_list if exch == exchange_name), None)
    if append_str is None:
        raise ValueError(f"Unknown exchange: {exchange_name}")
    if append_str.startswith(("-", "_")):
        full_ticker = f"{base_asset}{append_str}"
    else:
        full_ticker = f"{base_asset}{append_str}"
    return full_ticker

def get_valid_symbols(exchanges, threshold=2):
    all_symbols = {}
    for exchange in exchanges:
        symbol_folder = os.path.join(BASE_DATA_DIR, exchange, "Futures")
        symbols = os.listdir(symbol_folder)
        normalized_symbols = [isolate_base_asset(symbol, exchange) for symbol in symbols]
        all_symbols[exchange] = set(normalized_symbols)
    
    # Find common symbols across all exchanges
    common_symbols = set.union(*all_symbols.values())
    valid_symbols = [symbol for symbol in common_symbols 
                     if sum(symbol in exchange_symbols for exchange_symbols in all_symbols.values()) &gt;= threshold]
    
    return valid_symbols

def create_folder_structure(tickers):
    for ticker in tickers:
        os.makedirs(f"{MERGED_DATA_BASE_FOLDER}{ticker}/merged_taq", exist_ok=True)
        os.makedirs(f"{MERGED_DATA_BASE_FOLDER}{ticker}/merged_quotes", exist_ok=True)

def create_exchange_ticker(base_asset: str, exchange_name: str) -&gt; str:
    append_str = next((append for exch, append in exchange_list if exch == exchange_name), None)
    if append_str is None:
        raise ValueError(f"Unknown exchange: {exchange_name}")
    return f"{base_asset}{append_str}"

def get_common_dates(base_asset, exchanges):
    common_dates = None
    for exchange in exchanges:
        ticker = create_exchange_ticker(base_asset, exchange)
        quotes_folder = os.path.join(BASE_DATA_DIR, exchange, "Futures", ticker, "quotes")
        trades_folder = os.path.join(BASE_DATA_DIR, exchange, "Futures", ticker, "trades")
        
        quotes_files = os.listdir(quotes_folder)
        trades_files = os.listdir(trades_folder)
        
        quote_dates = set(x.split("_")[2] for x in quotes_files)
        trade_dates = set(x.split("_")[2] for x in trades_files)
        
        exchange_dates = quote_dates &amp; trade_dates
        
        if common_dates is None:
            common_dates = exchange_dates
        else:
            common_dates &amp;= exchange_dates
    
    return list(common_dates)

def process_quotes(base_asset, exchanges, selected_date):
    all_data = []
    
    for exchange in exchanges:
        ticker = create_exchange_ticker(base_asset, exchange)
        quotes_folder = os.path.join(BASE_DATA_DIR, exchange, "Futures", ticker, "quotes")        
        quotes_path = f"{quotes_folder}/{exchange}_quotes_{selected_date}_{ticker}.csv.gz"
        
        try:
            df = pd.read_csv(quotes_path, compression='gzip')  
            df['timestamp'] = pd.to_datetime(df['timestamp'], unit='us')      
            df = df.sort_values(by='timestamp')
            df['mid_price'] = (df['ask_price'] + df['bid_price']) / 2.0            
            columns_to_keep = ['timestamp', 'ask_price', 'bid_price', 'bid_amount', 'ask_amount']
            df = df[columns_to_keep]
            df.columns = [f'{exchange}_{col}' if col != 'timestamp' else col for col in df.columns]
            all_data.append(df)
        
        except Exception as e:
            print(f"Error processing {exchange} data for {base_asset} on {selected_date}: {e}")
    
    if not all_data:
        print(f"No data processed for {base_asset} on {selected_date}")
        return
    
    merged_df = all_data[0]
    for df in all_data[1:]:
        merged_df = pd.merge_asof(merged_df, df, on='timestamp', direction='nearest')
    merged_df.sort_values('timestamp', inplace=True)
    output_path = f"{MERGED_DATA_BASE_FOLDER}{base_asset}/merged_quotes/{base_asset}_{selected_date}_merged-quotes.parquet"
    merged_df.to_parquet(output_path, index=False)

def process_data(base_asset, exchange, selected_date):
    all_data = []
    
    ticker = create_exchange_ticker(base_asset, exchange)
    quotes_folder = os.path.join(BASE_DATA_DIR, exchange, "Futures", ticker, "quotes")
    trades_folder = os.path.join(BASE_DATA_DIR, exchange, "Futures", ticker, "trades")
    
    quotes_path = f"{quotes_folder}/{exchange}_quotes_{selected_date}_{ticker}.csv.gz"
    trades_path = f"{trades_folder}/{exchange}_trades_{selected_date}_{ticker}.csv.gz"
    
    try:
        df_quotes = pd.read_csv(quotes_path, compression='gzip')
        df_trades = pd.read_csv(trades_path, compression='gzip')
        
        df_quotes['timestamp'] = pd.to_datetime(df_quotes['timestamp'], unit='us')
        df_trades['timestamp'] = pd.to_datetime(df_trades['timestamp'], unit='us')

        df_quotes = df_quotes.sort_values(by='timestamp')
        df_trades = df_trades.sort_values(by='timestamp')

        # Merge trades and quotes
        df = pd.merge_asof(df_trades, df_quotes, on='timestamp', direction='forward', 
                           suffixes=('_trade', '_quote'))

        df = df.sort_values(by='timestamp')
        
        # Calculate mid price and is_buy
        df['mid_price'] = (df['ask_price'] + df['bid_price']) / 2.0
        df['is_buy'] = df['side'].map({'buy': True, 'sell': False})
        
        # Select and rename columns
        columns_to_keep = ['timestamp', 'price', 'amount', 'mid_price', 'is_buy', 'ask_price', 'bid_price', 'bid_amount', 'ask_amount']
        df = df[columns_to_keep]
        df.columns = [f'{col}' if col != 'timestamp' else col for col in df.columns]
        
        all_data.append(df)
    
    except Exception as e:
        print(f"Error processing {exchange} data for {base_asset} on {selected_date}: {e}")
    
    if not all_data:
        print(f"No data processed for {base_asset} on {selected_date}")
        return
    
    # Merge all exchanges data
    merged_df = all_data[0]
    for df in all_data[1:]:
        merged_df = pd.merge_asof(merged_df, df, on='timestamp', direction='nearest')
    
    # Sort by timestamp
    merged_df.sort_values('timestamp', inplace=True)
    
    output_path = f"{MERGED_DATA_BASE_FOLDER}{base_asset}/merged_taq/{exchange}_{base_asset}_{selected_date}_merged-taq.parquet"
    merged_df.to_parquet(output_path, index=False)

def merge_exchanges_quotes(exchanges, threshold=2):
    valid_tickers = get_valid_symbols(exchanges, threshold)
    create_folder_structure(valid_tickers)
    for base_asset in valid_tickers:
        common_dates = get_common_dates(base_asset, exchanges)
        
        for selected_date in tqdm(common_dates, desc=f"Processing {base_asset}"):
            try:
                process_quotes(base_asset, exchanges, selected_date)
            except Exception as e:
                print(f"Error occurred processing the data: {e}")

def merge_exchange_taq(exchange, threshold=1):
    valid_tickers = get_valid_symbols([exchange], threshold)
    create_folder_structure(valid_tickers)
    for base_asset in valid_tickers:
        try:
            common_dates = get_common_dates(base_asset, [exchange])
            for selected_date in tqdm(common_dates, desc=f"Processing {base_asset}"):
                try:
                    process_data(base_asset, exchange, selected_date)
                except Exception as e:
                    print(f"Error occurred processing the data: {e}")
        except:
            print(f"Skipping {base_asset}")</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tSqs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb107d360-09d1-4d41-b6fc-3b4abf891e23_2402x7968.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tSqs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb107d360-09d1-4d41-b6fc-3b4abf891e23_2402x7968.png 424w, https://substackcdn.com/image/fetch/$s_!tSqs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb107d360-09d1-4d41-b6fc-3b4abf891e23_2402x7968.png 848w, https://substackcdn.com/image/fetch/$s_!tSqs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb107d360-09d1-4d41-b6fc-3b4abf891e23_2402x7968.png 1272w, https://substackcdn.com/image/fetch/$s_!tSqs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb107d360-09d1-4d41-b6fc-3b4abf891e23_2402x7968.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tSqs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb107d360-09d1-4d41-b6fc-3b4abf891e23_2402x7968.png" width="1456" height="4830" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b107d360-09d1-4d41-b6fc-3b4abf891e23_2402x7968.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:4830,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2219891,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tSqs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb107d360-09d1-4d41-b6fc-3b4abf891e23_2402x7968.png 424w, https://substackcdn.com/image/fetch/$s_!tSqs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb107d360-09d1-4d41-b6fc-3b4abf891e23_2402x7968.png 848w, https://substackcdn.com/image/fetch/$s_!tSqs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb107d360-09d1-4d41-b6fc-3b4abf891e23_2402x7968.png 1272w, https://substackcdn.com/image/fetch/$s_!tSqs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb107d360-09d1-4d41-b6fc-3b4abf891e23_2402x7968.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>If we run the code like this:</p><pre><code>exchanges_to_merge = ['bybit', 'okex-swap']
merge_exchanges_quotes(exchanges_to_merge)
[merge_exchange_taq(exchange) for exchange in exchanges_to_merge]</code></pre><p>Then, we should end up with an output that looks like the below:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!mH0i!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F124e1273-fc54-45ae-a564-c00e8af74c54_1092x764.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mH0i!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F124e1273-fc54-45ae-a564-c00e8af74c54_1092x764.png 424w, https://substackcdn.com/image/fetch/$s_!mH0i!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F124e1273-fc54-45ae-a564-c00e8af74c54_1092x764.png 848w, https://substackcdn.com/image/fetch/$s_!mH0i!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F124e1273-fc54-45ae-a564-c00e8af74c54_1092x764.png 1272w, https://substackcdn.com/image/fetch/$s_!mH0i!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F124e1273-fc54-45ae-a564-c00e8af74c54_1092x764.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!mH0i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F124e1273-fc54-45ae-a564-c00e8af74c54_1092x764.png" width="1092" height="764" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/124e1273-fc54-45ae-a564-c00e8af74c54_1092x764.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:764,&quot;width&quot;:1092,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:111523,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mH0i!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F124e1273-fc54-45ae-a564-c00e8af74c54_1092x764.png 424w, https://substackcdn.com/image/fetch/$s_!mH0i!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F124e1273-fc54-45ae-a564-c00e8af74c54_1092x764.png 848w, https://substackcdn.com/image/fetch/$s_!mH0i!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F124e1273-fc54-45ae-a564-c00e8af74c54_1092x764.png 1272w, https://substackcdn.com/image/fetch/$s_!mH0i!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F124e1273-fc54-45ae-a564-c00e8af74c54_1092x764.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We have two functions here. One merges TAQ (Trades &amp; Quotes) on a per-exchange basis, and another merges quotes cross-exchange. We will use the TAQ data for the limit order optimization analysis and the quote data for the initial opportunity exploration + backtest.</p><p>Our data appears to be processed (although our data selection is limited):</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!A03n!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4646a3a-8266-4f09-90af-6b5a5da151e4_688x219.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!A03n!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4646a3a-8266-4f09-90af-6b5a5da151e4_688x219.png 424w, https://substackcdn.com/image/fetch/$s_!A03n!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4646a3a-8266-4f09-90af-6b5a5da151e4_688x219.png 848w, https://substackcdn.com/image/fetch/$s_!A03n!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4646a3a-8266-4f09-90af-6b5a5da151e4_688x219.png 1272w, https://substackcdn.com/image/fetch/$s_!A03n!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4646a3a-8266-4f09-90af-6b5a5da151e4_688x219.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!A03n!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4646a3a-8266-4f09-90af-6b5a5da151e4_688x219.png" width="688" height="219" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c4646a3a-8266-4f09-90af-6b5a5da151e4_688x219.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:219,&quot;width&quot;:688,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:12436,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!A03n!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4646a3a-8266-4f09-90af-6b5a5da151e4_688x219.png 424w, https://substackcdn.com/image/fetch/$s_!A03n!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4646a3a-8266-4f09-90af-6b5a5da151e4_688x219.png 848w, https://substackcdn.com/image/fetch/$s_!A03n!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4646a3a-8266-4f09-90af-6b5a5da151e4_688x219.png 1272w, https://substackcdn.com/image/fetch/$s_!A03n!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4646a3a-8266-4f09-90af-6b5a5da151e4_688x219.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KADs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d3ce4a1-fea9-4590-9ba6-320eb9913813_686x282.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KADs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d3ce4a1-fea9-4590-9ba6-320eb9913813_686x282.png 424w, https://substackcdn.com/image/fetch/$s_!KADs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d3ce4a1-fea9-4590-9ba6-320eb9913813_686x282.png 848w, https://substackcdn.com/image/fetch/$s_!KADs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d3ce4a1-fea9-4590-9ba6-320eb9913813_686x282.png 1272w, https://substackcdn.com/image/fetch/$s_!KADs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d3ce4a1-fea9-4590-9ba6-320eb9913813_686x282.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KADs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d3ce4a1-fea9-4590-9ba6-320eb9913813_686x282.png" width="686" height="282" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9d3ce4a1-fea9-4590-9ba6-320eb9913813_686x282.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:282,&quot;width&quot;:686,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:20070,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KADs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d3ce4a1-fea9-4590-9ba6-320eb9913813_686x282.png 424w, https://substackcdn.com/image/fetch/$s_!KADs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d3ce4a1-fea9-4590-9ba6-320eb9913813_686x282.png 848w, https://substackcdn.com/image/fetch/$s_!KADs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d3ce4a1-fea9-4590-9ba6-320eb9913813_686x282.png 1272w, https://substackcdn.com/image/fetch/$s_!KADs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d3ce4a1-fea9-4590-9ba6-320eb9913813_686x282.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>(Ignore the extra day I added; I scraped that after for the backtest).</p><p>A quick test in our notebook reveals this has worked properly:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QPhk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0278e87-fd89-4394-af25-85514e319291_877x701.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QPhk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0278e87-fd89-4394-af25-85514e319291_877x701.png 424w, https://substackcdn.com/image/fetch/$s_!QPhk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0278e87-fd89-4394-af25-85514e319291_877x701.png 848w, https://substackcdn.com/image/fetch/$s_!QPhk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0278e87-fd89-4394-af25-85514e319291_877x701.png 1272w, https://substackcdn.com/image/fetch/$s_!QPhk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0278e87-fd89-4394-af25-85514e319291_877x701.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QPhk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0278e87-fd89-4394-af25-85514e319291_877x701.png" width="877" height="701" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f0278e87-fd89-4394-af25-85514e319291_877x701.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:701,&quot;width&quot;:877,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:67699,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QPhk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0278e87-fd89-4394-af25-85514e319291_877x701.png 424w, https://substackcdn.com/image/fetch/$s_!QPhk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0278e87-fd89-4394-af25-85514e319291_877x701.png 848w, https://substackcdn.com/image/fetch/$s_!QPhk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0278e87-fd89-4394-af25-85514e319291_877x701.png 1272w, https://substackcdn.com/image/fetch/$s_!QPhk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0278e87-fd89-4394-af25-85514e319291_877x701.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is all satisfactory, and on further inspection the data looks well formatted:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QYfs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ce435e6-9b91-4cd3-9d88-c2324521cb40_828x399.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QYfs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ce435e6-9b91-4cd3-9d88-c2324521cb40_828x399.png 424w, https://substackcdn.com/image/fetch/$s_!QYfs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ce435e6-9b91-4cd3-9d88-c2324521cb40_828x399.png 848w, https://substackcdn.com/image/fetch/$s_!QYfs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ce435e6-9b91-4cd3-9d88-c2324521cb40_828x399.png 1272w, https://substackcdn.com/image/fetch/$s_!QYfs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ce435e6-9b91-4cd3-9d88-c2324521cb40_828x399.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QYfs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ce435e6-9b91-4cd3-9d88-c2324521cb40_828x399.png" width="828" height="399" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ce435e6-9b91-4cd3-9d88-c2324521cb40_828x399.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:399,&quot;width&quot;:828,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:34644,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QYfs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ce435e6-9b91-4cd3-9d88-c2324521cb40_828x399.png 424w, https://substackcdn.com/image/fetch/$s_!QYfs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ce435e6-9b91-4cd3-9d88-c2324521cb40_828x399.png 848w, https://substackcdn.com/image/fetch/$s_!QYfs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ce435e6-9b91-4cd3-9d88-c2324521cb40_828x399.png 1272w, https://substackcdn.com/image/fetch/$s_!QYfs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ce435e6-9b91-4cd3-9d88-c2324521cb40_828x399.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>If you want to open multiple of them at once, then you can use this snippet to aggregate them by date range:</p><pre><code>import os
import pandas as pd
from datetime import datetime as dt

def load_parquet_files_in_date_range(folder_path: str, start_date: str, end_date: str) -&gt; pd.DataFrame:
    start_date = dt.strptime(start_date, '%Y-%m-%d')
    end_date = dt.strptime(end_date, '%Y-%m-%d')
    dataframes = []
    for file_name in os.listdir(folder_path):
        if file_name.endswith('.parquet'):
            file_date_str = file_name.split('_')[1]
            file_date = dt.strptime(file_date_str, '%Y-%m-%d')
            if start_date &lt;= file_date &lt;= end_date:
                file_path = os.path.join(folder_path, file_name)
                df = pd.read_parquet(file_path)
                dataframes.append(df)
    if dataframes:
        combined_df = pd.concat(dataframes).sort_index()
        return combined_df
    else:
        return pd.DataFrame()</code></pre><p>os and pandas should be imported already, so you only need to import datetime.</p><p>Let&#8217;s wrap up by talking about how the code works:</p><p>We have decided to use quote data as our events, but typically, we would have quotes and trades simultaneously and then fill forward only the quote values. We would loop through it by saying if the trade column of our choice is NaN, then it&#8217;s a quote update, and if it&#8217;s not NaN, then it&#8217;s a trade update. </p><p>We&#8217;re allowed to fill forward quote values but not trade values. Once we get a quote message, we can assume that the quote is valid until the following quote is given. There are some very low latency issues here when you start to care about the sub-100ms, and especially the sub-30ms frequencies of data. Even orderbook events will be aggregated (roughly 30ms updates on Binance real-time updates). As long as you assume some decently sized latency between your deciding to make a trade and you actually simulating your fill, you should be fine.</p><p>For context, we include trades in our data because trade data is very useful for lead-lag analysis, which we will discuss later (volume plays a prominent role and at a very trade-focused level). Still, we won&#8217;t be implementing this, so I didn&#8217;t feel there was a need. We do still need trade data, but not all the trades for all exchanges at once since we estimate limit fill probabilities on a per-exchange basis.</p><p></p><h4>Checking For Opportunities</h4><div><hr></div><p>Let&#8217;s start by looking at a single asset and scanning for arbitrages between 2 exchanges. It&#8217;s the best way to check that something is there. We&#8217;ll re-use LINK, which we used to test earlier whether our data was correct.</p><p>Quick import:</p><pre><code>import pandas as pd

import matplotlib.pyplot as plt
import seaborn as sns</code></pre>
      <p>
          <a href="https://www.algos.org/p/small-trader-alpha-6-perpetual-arbitrage">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[How to level up your arb game]]></title><description><![CDATA[The paths to improving an existing arbitrage trade]]></description><link>https://www.algos.org/p/how-to-level-up-your-arb-game</link><guid isPermaLink="false">https://www.algos.org/p/how-to-level-up-your-arb-game</guid><dc:creator><![CDATA[Quant Arb]]></dc:creator><pubDate>Sun, 07 Apr 2024 16:24:27 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!X2S1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d2fd2d2-e79e-41f8-a862-362dbcdb89fc_1024x1024.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!X2S1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d2fd2d2-e79e-41f8-a862-362dbcdb89fc_1024x1024.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!X2S1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d2fd2d2-e79e-41f8-a862-362dbcdb89fc_1024x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!X2S1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d2fd2d2-e79e-41f8-a862-362dbcdb89fc_1024x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!X2S1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d2fd2d2-e79e-41f8-a862-362dbcdb89fc_1024x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!X2S1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d2fd2d2-e79e-41f8-a862-362dbcdb89fc_1024x1024.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!X2S1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d2fd2d2-e79e-41f8-a862-362dbcdb89fc_1024x1024.webp" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3d2fd2d2-e79e-41f8-a862-362dbcdb89fc_1024x1024.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Visualize a trading algorithm represented as a futuristic robot, surrounded by dynamic digital effects and icons symbolizing stock market elements like graphs and currencies. The scene is set in a virtual space, resembling a video game, where the robot stands on a podium that glows with neon lights. Above the robot, a large, glowing 'Level Up!' sign hovers, emphasizing the video game-like progression. The background is filled with abstract digital patterns and binary code streams, highlighting the high-tech environment. This image captures the moment of the algorithm advancing to a new level of capability and performance.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Visualize a trading algorithm represented as a futuristic robot, surrounded by dynamic digital effects and icons symbolizing stock market elements like graphs and currencies. The scene is set in a virtual space, resembling a video game, where the robot stands on a podium that glows with neon lights. Above the robot, a large, glowing 'Level Up!' sign hovers, emphasizing the video game-like progression. The background is filled with abstract digital patterns and binary code streams, highlighting the high-tech environment. This image captures the moment of the algorithm advancing to a new level of capability and performance." title="Visualize a trading algorithm represented as a futuristic robot, surrounded by dynamic digital effects and icons symbolizing stock market elements like graphs and currencies. The scene is set in a virtual space, resembling a video game, where the robot stands on a podium that glows with neon lights. Above the robot, a large, glowing 'Level Up!' sign hovers, emphasizing the video game-like progression. The background is filled with abstract digital patterns and binary code streams, highlighting the high-tech environment. This image captures the moment of the algorithm advancing to a new level of capability and performance." srcset="https://substackcdn.com/image/fetch/$s_!X2S1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d2fd2d2-e79e-41f8-a862-362dbcdb89fc_1024x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!X2S1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d2fd2d2-e79e-41f8-a862-362dbcdb89fc_1024x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!X2S1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d2fd2d2-e79e-41f8-a862-362dbcdb89fc_1024x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!X2S1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d2fd2d2-e79e-41f8-a862-362dbcdb89fc_1024x1024.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>Introduction</h4><div><hr></div><p>Especially when it comes to the high-frequency world, trades quickly become crowded and die out. I&#8217;ll list out some arbitrages that used to work in their basic form and then died off:</p><ol><li><p>Triangular arbitrage</p></li><li><p>Perpetual basis arbitrage </p></li><li><p>BTC lead-lag</p></li><li><p>Spot / spot arbitrage</p></li></ol><p>This extends past pure arbitrages to more statistical trades or event-driven ones. </p><p>Of course, how you optimize a trade varies based on its attributes. A longer-lasting statistical alpha gives more room for execution enhancements than an event-driven alpha like Elon tweeting about DOGE, where the alpha realizes over a very discrete interval.</p><p>In this article, we dive deep into how to level up your alphas at very broad level. For specific examples where I&#8217;ve walked through this for individual trades, my small trader alpha series gives clear examples of many of these trades (Funding arbitrage, Spot/Spot, Triangular) which with the exception of funding arbitrage is dead in the traditional form, but as we show is still very profitable in modern day by levelling up the trade. </p><p></p><h4>Index</h4><div><hr></div><ol><li><p>Introduction </p></li><li><p>Index</p></li><li><p>Execution </p></li><li><p>Statistical</p></li><li><p>Exposures</p></li><li><p>Universe Expansion</p></li><li><p>Scope Expansion</p></li><li><p>Latency</p></li><li><p>Trading Costs</p></li><li><p>Leverage </p></li><li><p>Walkthroughs</p><ol><li><p>Funding </p></li><li><p>Triangular </p></li><li><p>Spot</p></li></ol></li><li><p>Final Comments</p></li></ol><p></p><h4>Execution </h4><div><hr></div><p>It&#8217;s often the case that we see teams evolve their HFT strategies over a common path, in these stages:</p><ol><li><p>Taker / Taker </p></li><li><p>Maker / Taker</p></li><li><p>Maker / Maker</p></li></ol><p>This is how arbitrageurs become market makers so frequently because they start off with a great trade that works fine. Then, as they expand it, there begins a transition to more making in the execution, until eventually the alpha dies and they are left with a full maker system that can no longer be called an arbitrage strategy and is now a full-fledged market-making strategy. </p><p>If you have an arbitrage that involves taking, you&#8217;ll start by making the first trade using a limit order and entering the maker/taker world. This is easier than all maker because you still ensure the trade remains fully hedged throughout.</p><p>With taker/taker, you control both legs, so you can ensure that you hedge after the first leg completes, and with maker/taker, whilst you don&#8217;t control the first leg, you can still make sure that the remaining legs will complete.</p><p>Maker/maker becomes a little bit more complicated, but by the time you transition to it, the general concept should be quite easy because, hopefully, you&#8217;ve solved the core optimization problems related to maker/taker already.</p><p>The main thing to consider is the signal decay. If your signal lasts a very long time, then you can afford to make into it. These are arbitrages that are uncompetitive since the exit liquidity on the exit legs will not be taken rapidly. </p><p>There is then also the question of what causes the discrepancy. If you get filled on a limit order that is 5% wide and then cross-exchange exit that trade, then it was probably the insanely wide limit order that created the profitability. </p><p>However, if you earn 10 bps on an arbitrage where the difference in midprices cross-exchange is 5%, then you&#8217;re still earning all the profits from the difference in midprices. </p><p>Thus, it&#8217;s important to establish how much of the actual edge you are gaining from this maker model. This isn&#8217;t just about the decision of how valuable making is, but more about alpha decay. Discrepancies in price tend to resolve a lot faster, but of course, if you are getting filled to make the edge, then it&#8217;s simply an analysis of your fill times.</p><p>Here&#8217;s what you&#8217;ll need to solve:</p><ol><li><p>Optimal level of spread (trading off how much you get filled vs.. spread earnt)</p></li><li><p>How aggressive should I be based on signal decay (the balance between the signal going away over time and you getting better fills if you wait longer / wider)</p></li><li><p>Quoting constraints (spot requires inventory to quote, and margin considerations will all play a role)</p></li></ol>
      <p>
          <a href="https://www.algos.org/p/how-to-level-up-your-arb-game">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Small Trader Alpha #5 - Market Making in Binary Markets ]]></title><description><![CDATA[How to use existing option markets to price binary options for easy market making.]]></description><link>https://www.algos.org/p/small-trader-alpha-5-market-making</link><guid isPermaLink="false">https://www.algos.org/p/small-trader-alpha-5-market-making</guid><dc:creator><![CDATA[Quant Arb]]></dc:creator><pubDate>Sat, 06 Apr 2024 20:57:51 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!UqTd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb15dd59e-1448-41fd-bcbd-778741594554_1792x1024.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!UqTd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb15dd59e-1448-41fd-bcbd-778741594554_1792x1024.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UqTd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb15dd59e-1448-41fd-bcbd-778741594554_1792x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!UqTd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb15dd59e-1448-41fd-bcbd-778741594554_1792x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!UqTd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb15dd59e-1448-41fd-bcbd-778741594554_1792x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!UqTd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb15dd59e-1448-41fd-bcbd-778741594554_1792x1024.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UqTd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb15dd59e-1448-41fd-bcbd-778741594554_1792x1024.webp" width="1456" height="832" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b15dd59e-1448-41fd-bcbd-778741594554_1792x1024.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:832,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:298348,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UqTd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb15dd59e-1448-41fd-bcbd-778741594554_1792x1024.webp 424w, https://substackcdn.com/image/fetch/$s_!UqTd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb15dd59e-1448-41fd-bcbd-778741594554_1792x1024.webp 848w, https://substackcdn.com/image/fetch/$s_!UqTd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb15dd59e-1448-41fd-bcbd-778741594554_1792x1024.webp 1272w, https://substackcdn.com/image/fetch/$s_!UqTd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb15dd59e-1448-41fd-bcbd-778741594554_1792x1024.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>Introduction</h4><div><hr></div><p>Small trader alpha is a series of articles I write about real trades that are actually profitable at present. They exist because they are only available to small traders due to limited capacity. This doesn&#8217;t mean they should be shunned. It&#8217;s often the case that those who care to exploit it don&#8217;t know how and those who know how don&#8217;t care because they seek larger opportunities. Hence we bridge this gap in the small trader alpha series. With that said, on with the article:</p><p>A very interesting trade exists at the moment regarding market making event prediction markets for financial assets.</p><p>It&#8217;s not often where we get given a really great fair value model for free, but this is one of those examples.</p><p>Sites like Kalshi offer the ability to bet on yes/no outcome questions. This effectively ends up creating binary option markets when they start asking questions like:</p><p>&#8220;Will the S&amp;P500 end the year over 4000?&#8221;</p><p>The flow on these bets are almost exclusively retail, but more importantly we can actually use option prices for the real tradfi markets on these assets to figure out the implied probability of outcomes.</p><p>In this article, we break down this opportunity and all of the components that would go into taking advantage of it from start to finish.</p><p>We include code and practical details of how to implement this. To my understanding there is a fairly decent amount of flow (if you&#8217;re a small trader or team, maybe not for bigger shops), lack of competition, and attractive incentives from exchanges.</p><p>There&#8217;s also a very good arbitrage in addition to all this that I&#8217;ll dive into.</p><p></p>
      <p>
          <a href="https://www.algos.org/p/small-trader-alpha-5-market-making">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Small Trader Alpha #4 - Funding Arbitrage]]></title><description><![CDATA[Exploiting niche funding arbitrage opportunities for financial gain]]></description><link>https://www.algos.org/p/small-trader-alpha-4-funding-arbitrage</link><guid isPermaLink="false">https://www.algos.org/p/small-trader-alpha-4-funding-arbitrage</guid><dc:creator><![CDATA[Quant Arb]]></dc:creator><pubDate>Tue, 30 Jan 2024 01:00:16 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!jsX5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6537d68d-9e98-412a-8d5d-c867cbadd050_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jsX5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6537d68d-9e98-412a-8d5d-c867cbadd050_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jsX5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6537d68d-9e98-412a-8d5d-c867cbadd050_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!jsX5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6537d68d-9e98-412a-8d5d-c867cbadd050_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!jsX5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6537d68d-9e98-412a-8d5d-c867cbadd050_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!jsX5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6537d68d-9e98-412a-8d5d-c867cbadd050_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jsX5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6537d68d-9e98-412a-8d5d-c867cbadd050_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6537d68d-9e98-412a-8d5d-c867cbadd050_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1930461,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jsX5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6537d68d-9e98-412a-8d5d-c867cbadd050_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!jsX5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6537d68d-9e98-412a-8d5d-c867cbadd050_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!jsX5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6537d68d-9e98-412a-8d5d-c867cbadd050_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!jsX5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6537d68d-9e98-412a-8d5d-c867cbadd050_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>Introduction</h4><div><hr></div><p>In the heyday of funding arbitrage strategies, back in 2020 &amp; 2021, it was quite normal to see people making 100% returns on 8 figure sums, but as we entered the bear market and as people caught onto the strategy, it began to fade. Now, as the bull market re-emerges, and with many of the traditional market participants removed, we are seeing a renaissance in the funding arbitrage strategy. Better yet, with the explosion of decentralized perpetual exchanges, there is now far more of an opportunity for the niche trader - without needing to engage in the headache of KYC&#8217;ing with tons of exchanges.</p><p>Small exchanges are great for niche arbitrages, especially when they have factors that keep away large players, such as liquidity faults and cybersecurity/compliance risks. </p><p>There are two main versions: </p><ol><li><p>Spot / Perpetual </p></li><li><p>Perpetual / Perpetual</p></li></ol><p>Funding arbitrage involves collecting funding payments in exchange for holding positions that bet on the convergence of two mechanically tied assets. While we need to consider how the convergence or continued divergence of the two assets may affect our trade, betting on this basis is not the core part of the trade; instead, we focus on the differential of payments.</p><p>For spot against perpetual arbitrages, we need to acquire cheap borrowing of spot on the short side and own spot on the long side (we will see how regimes then affect this later). For perpetual to perpetual, we usually are taking a perpetual on the same instrument, either slightly different types (coin margined vs USD margined) or across exchanges (most common).</p><p>A code demonstration on how to build this into a system is provided at the end, with some technical guidance on implementation. </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.algos.org/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">More great content coming soon, subscribe to stay up to date.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h4>Index</h4><div><hr></div><ol><li><p>Introduction</p></li><li><p>Index</p></li><li><p>Regime Variability</p></li><li><p>Managing Shock Risk &amp; Margin</p></li><li><p>Sources For Borrow</p></li><li><p>Expected Holding Times</p></li><li><p>Entry &amp; Exit Timing</p></li><li><p>Risk Premiums</p></li><li><p>Reducing Impact &amp; It&#8217;s Importance</p></li><li><p>When Is Cross-Exchange Funding Priced-In?</p></li><li><p>Differences In Funding Intervals</p></li><li><p>Implementation Guidance [CODE INCLUDED]</p></li></ol><p></p><h4>Regime Variability</h4><div><hr></div><p>One characteristic of the funding arb strategy is its dependence on the directional state of the market. When there is a bull market, futures tend to be the asset above spot most of the time:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!McaU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a0410fa-217f-4972-95eb-44529e423ad7_539x306.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!McaU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a0410fa-217f-4972-95eb-44529e423ad7_539x306.png 424w, https://substackcdn.com/image/fetch/$s_!McaU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a0410fa-217f-4972-95eb-44529e423ad7_539x306.png 848w, https://substackcdn.com/image/fetch/$s_!McaU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a0410fa-217f-4972-95eb-44529e423ad7_539x306.png 1272w, https://substackcdn.com/image/fetch/$s_!McaU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a0410fa-217f-4972-95eb-44529e423ad7_539x306.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!McaU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a0410fa-217f-4972-95eb-44529e423ad7_539x306.png" width="539" height="306" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3a0410fa-217f-4972-95eb-44529e423ad7_539x306.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:306,&quot;width&quot;:539,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:12291,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!McaU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a0410fa-217f-4972-95eb-44529e423ad7_539x306.png 424w, https://substackcdn.com/image/fetch/$s_!McaU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a0410fa-217f-4972-95eb-44529e423ad7_539x306.png 848w, https://substackcdn.com/image/fetch/$s_!McaU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a0410fa-217f-4972-95eb-44529e423ad7_539x306.png 1272w, https://substackcdn.com/image/fetch/$s_!McaU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a0410fa-217f-4972-95eb-44529e423ad7_539x306.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>However, we see the opposite in a bear market, where the perpetual tends to be below spot prices. One effect not shown, is that when there is a bear market we tend to see a lack of opportunities in general as people become more desperate for opportunities. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NhYp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffea9a96e-aa1b-4e30-b3d3-cded28843352_547x312.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NhYp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffea9a96e-aa1b-4e30-b3d3-cded28843352_547x312.png 424w, https://substackcdn.com/image/fetch/$s_!NhYp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffea9a96e-aa1b-4e30-b3d3-cded28843352_547x312.png 848w, https://substackcdn.com/image/fetch/$s_!NhYp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffea9a96e-aa1b-4e30-b3d3-cded28843352_547x312.png 1272w, https://substackcdn.com/image/fetch/$s_!NhYp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffea9a96e-aa1b-4e30-b3d3-cded28843352_547x312.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NhYp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffea9a96e-aa1b-4e30-b3d3-cded28843352_547x312.png" width="547" height="312" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fea9a96e-aa1b-4e30-b3d3-cded28843352_547x312.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:312,&quot;width&quot;:547,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!NhYp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffea9a96e-aa1b-4e30-b3d3-cded28843352_547x312.png 424w, https://substackcdn.com/image/fetch/$s_!NhYp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffea9a96e-aa1b-4e30-b3d3-cded28843352_547x312.png 848w, https://substackcdn.com/image/fetch/$s_!NhYp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffea9a96e-aa1b-4e30-b3d3-cded28843352_547x312.png 1272w, https://substackcdn.com/image/fetch/$s_!NhYp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffea9a96e-aa1b-4e30-b3d3-cded28843352_547x312.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>But why do we care which is above which?</p><p>In the bull scenario, we buy the spot and short the perpetual. We earn funding on the perpetual and pay no cost to hold the spot - we may lever into the spot position, but this is relatively cheap because we are borrowing stablecoins. </p><p>In the bear scenario, we need to short spot - this introduces short borrowing costs. While we may get paid on the long perpetual leg, it is typically very expensive to short spot, and it is tricky to find the borrowing availability. This culminates to mean that funding arbitrage is much harder to make money on in bear markets.</p><p></p><h4>Managing Shock Risk &amp; Margin</h4><div><hr></div><p>Funding arbitrage is a leveraged strategy for almost everyone who runs it. This means that we need to manage risks and control our margin. It is easier when the position is on one exchange, say if we were doing spot to futures on Binance, in which case we simply need to rebalance the position to take profits on one leg and cover losses on the other. We may even be able to leave the losses/profits because the exchange counts our profits between the two (depends on the exchange).</p><p>The more likely case, though, is that we will have complex cross-exchange positions. We can have our spot borrow sources from a DEX, but then our perpetual position is traded on a CEX, or even have two perpetual positions between CEXs that we are arbitraging.</p><p>There are real cases I know where friends of mine blew up because they overleveraged into basis spreads between two exchanges. Then, a large 100% move happened on one asset, resulting in huge gains on one exchange, but also huge losses on the other exchange. They couldn&#8217;t move capital in time to cover the margin difference, and this resulted in a liquidation. This is VERY expensive. Not only because you have exited the trade at the worst possible time, when the basis has gone against you, but that you now have a naked leg to close on another exchange, plus are paying huge liquidation fees (often 1%+ * your leverage, so potentially double digits).</p><p>To model this sort of risk, you should use shock analysis. What would happen if this one asset shocked up XX % suddenly? What is the probability of that happening? If it&#8217;s a shitcoin, then look at other shitcoins, not just it&#8217;s price history. Understand that if BTC has a large move, then all the other tokens will follow, likely in a much more pronounced magnitude. Make sure that your portfolio can survive these shocks without getting liquidated. </p><p>It is also important to have automated systems to remove the second leg then if you get liquidated on one exchange and to automate transfers of margin between exchanges to reduce the waiting time (this can pose a cybersecurity risk to have APIs moving capital; some firms will avoid this practice as a result). </p><p></p><h4>Sources For Borrow</h4><div><hr></div>
      <p>
          <a href="https://www.algos.org/p/small-trader-alpha-4-funding-arbitrage">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Small Trader Alpha #3 - Triangles]]></title><description><![CDATA[Everything is better with limit orders, including triangles.]]></description><link>https://www.algos.org/p/small-trader-alpha-3-triangles</link><guid isPermaLink="false">https://www.algos.org/p/small-trader-alpha-3-triangles</guid><dc:creator><![CDATA[Quant Arb]]></dc:creator><pubDate>Sun, 17 Sep 2023 20:51:43 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!sVqR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbbb2fed-bccb-4e0f-918e-5b87c2c2451c_1500x499.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sVqR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbbb2fed-bccb-4e0f-918e-5b87c2c2451c_1500x499.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sVqR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbbb2fed-bccb-4e0f-918e-5b87c2c2451c_1500x499.jpeg 424w, https://substackcdn.com/image/fetch/$s_!sVqR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbbb2fed-bccb-4e0f-918e-5b87c2c2451c_1500x499.jpeg 848w, https://substackcdn.com/image/fetch/$s_!sVqR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbbb2fed-bccb-4e0f-918e-5b87c2c2451c_1500x499.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!sVqR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbbb2fed-bccb-4e0f-918e-5b87c2c2451c_1500x499.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sVqR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbbb2fed-bccb-4e0f-918e-5b87c2c2451c_1500x499.jpeg" width="1456" height="484" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bbbb2fed-bccb-4e0f-918e-5b87c2c2451c_1500x499.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:484,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Image" title="Image" srcset="https://substackcdn.com/image/fetch/$s_!sVqR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbbb2fed-bccb-4e0f-918e-5b87c2c2451c_1500x499.jpeg 424w, https://substackcdn.com/image/fetch/$s_!sVqR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbbb2fed-bccb-4e0f-918e-5b87c2c2451c_1500x499.jpeg 848w, https://substackcdn.com/image/fetch/$s_!sVqR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbbb2fed-bccb-4e0f-918e-5b87c2c2451c_1500x499.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!sVqR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbbbb2fed-bccb-4e0f-918e-5b87c2c2451c_1500x499.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>Introduction</h4><div><hr></div><p>Today&#8217;s episode of Small Trader Alpha dives into triangular arbitrage and the remaining pieces of this strategy that still have an edge in illiquid markets. There are many ways to approach this strategy, and they all have quite a lot of overlap, so in this article, we will try to cover as much of the useful information related to the strategy as possible.</p>
      <p>
          <a href="https://www.algos.org/p/small-trader-alpha-3-triangles">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Small Trader Alpha #2 - Advanced Approaches]]></title><description><![CDATA[Expanding on the previous article's strategy with additional improvements.]]></description><link>https://www.algos.org/p/small-trader-alpha-2-advanced-arbitrage</link><guid isPermaLink="false">https://www.algos.org/p/small-trader-alpha-2-advanced-arbitrage</guid><dc:creator><![CDATA[Quant Arb]]></dc:creator><pubDate>Mon, 17 Jul 2023 03:41:26 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!vcW0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22cf2fc9-71fc-4bb0-ad45-c9e570d44c1b_1200x630.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vcW0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22cf2fc9-71fc-4bb0-ad45-c9e570d44c1b_1200x630.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vcW0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22cf2fc9-71fc-4bb0-ad45-c9e570d44c1b_1200x630.jpeg 424w, https://substackcdn.com/image/fetch/$s_!vcW0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22cf2fc9-71fc-4bb0-ad45-c9e570d44c1b_1200x630.jpeg 848w, https://substackcdn.com/image/fetch/$s_!vcW0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22cf2fc9-71fc-4bb0-ad45-c9e570d44c1b_1200x630.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!vcW0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22cf2fc9-71fc-4bb0-ad45-c9e570d44c1b_1200x630.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vcW0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22cf2fc9-71fc-4bb0-ad45-c9e570d44c1b_1200x630.jpeg" width="1200" height="630" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/22cf2fc9-71fc-4bb0-ad45-c9e570d44c1b_1200x630.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:630,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vcW0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22cf2fc9-71fc-4bb0-ad45-c9e570d44c1b_1200x630.jpeg 424w, https://substackcdn.com/image/fetch/$s_!vcW0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22cf2fc9-71fc-4bb0-ad45-c9e570d44c1b_1200x630.jpeg 848w, https://substackcdn.com/image/fetch/$s_!vcW0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22cf2fc9-71fc-4bb0-ad45-c9e570d44c1b_1200x630.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!vcW0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F22cf2fc9-71fc-4bb0-ad45-c9e570d44c1b_1200x630.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h4>Introduction</h4><div><hr></div><p>In the previous article, I broke down a strategy for arbitraging shitcoins. There&#8217;s a bit more to uncover with this strategy, so this will be a part 2, where we explore 5 advanced modifications to the strategy. Some of these are more of a modification than others, so I&#8217;ll leave it up to the reader to decide which ones count as separate strategies in their own right.</p><p>They all share many of the risks and considerations discussed in the previous article, which I would recommend reading prior to this, or you may end up a little confused.</p><p></p><h4>Index</h4><div><hr></div><ol><li><p>Introduction</p></li><li><p>Index</p></li><li><p>Going Deeper</p></li><li><p>Getting Aggressive</p></li><li><p>Why not both?</p></li><li><p>Spotting idiots</p></li><li><p>Not-so-pure </p></li><li><p>Wrapping it all up</p></li></ol><p></p>
      <p>
          <a href="https://www.algos.org/p/small-trader-alpha-2-advanced-arbitrage">
              Read more
          </a>
      </p>
   ]]></content:encoded></item></channel></rss>