<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
	<title>Izaac&#39;s Website</title>
	<link>https://izaac.mammadov.co.uk/</link>
	<description>Recent content on Izaac&#39;s Website</description>
	<generator>Hugo -- gohugo.io</generator>
	<language>en-gb</language>
	<lastBuildDate>Mon, 06 Jan 2025 22:52:55 +0000</lastBuildDate>
    
        <atom:link href="https://izaac.mammadov.co.uk/index.xml" rel="self" type="application/rss+xml" />
	
	
	<item>
		<title>CryptoHack</title>
		<link>https://izaac.mammadov.co.uk/cryptohack/</link>
		<pubDate>Mon, 06 Jan 2025 22:52:55 +0000</pubDate>
		
		<guid>https://izaac.mammadov.co.uk/cryptohack/</guid>
		<description>&lt;p&gt;&lt;a href=&#34;https://cryptohack.org/&#34;&gt;CryptoHack&lt;/a&gt; is a beginner-friendly website for anyone to be able to learn the foundations of cryptography in an interactive way. It provides a wide variety of &amp;ldquo;Capture-the-Flag&amp;rdquo; style cryptography puzzles to help you learn and practice. In my opinion, it does a great job of throwing you in the deep end and gets you to learn by actually hacking, as opposed to being too in the trenches with theory. I&amp;rsquo;d recommend people who are interested to try out the courses/challenges. My profile on CryptoHack is &lt;a href=&#34;https://cryptohack.org/user/IzaacMammadov/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Advent of Code 2024</title>
		<link>https://izaac.mammadov.co.uk/aoc_2024/</link>
		<pubDate>Wed, 25 Dec 2024 12:39:33 +0000</pubDate>
		
		<guid>https://izaac.mammadov.co.uk/aoc_2024/</guid>
		<description>&lt;p&gt;Following on from &lt;a href=&#34;https://izaac.mammadov.co.uk/aoc_2023&#34;&gt;last year&lt;/a&gt;, I took part again in this year&amp;rsquo;s &lt;a href=&#34;https://adventofcode.com&#34;&gt;Advent of Code&lt;/a&gt; coding challenges. I would recommend everybody give them a go. I was less consistent about waking up on time to do them when they come out, but for the first time got to end and achieved all 50 stars. My GitHub repo of solutons can be found &lt;a href=&#34;https://github.com/IzaacMammadov/AOC-2024&#34;&gt;here&lt;/a&gt; and my personal times are below:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;    --------Part 1---------   --------Part 2--------
Day     Time    Rank  Score       Time   Rank  Score
25  06:02:24   10945      0   06:03:39   7045      0
24  08:38:04   13733      0   09:51:09   5389      0
23      &amp;gt;24h   19758      0       &amp;gt;24h  17342      0
22  06:54:08   12077      0   12:25:49  12454      0
21  17:55:39   11004      0       &amp;gt;24h  12815      0
20      &amp;gt;24h   21217      0       &amp;gt;24h  17437      0
19  14:22:21   20665      0   14:25:05  17905      0
18  07:06:10   14442      0   07:25:39  13825      0
17  05:59:41   13360      0   09:41:59   7569      0
16  07:50:14   12872      0   13:53:55  13160      0
15  13:24:52   24735      0   16:39:28  18069      0
14      &amp;gt;24h   33640      0       &amp;gt;24h  30088      0
13  00:25:18    2684      0   00:59:38   2782      0
12  00:16:38    1582      0   00:46:48   1316      0
11  00:08:59    1894      0   00:15:15    844      0
10  00:20:52    3179      0   00:24:32   2907      0
9   00:26:08    3096      0   01:22:50   3961      0
8       &amp;gt;24h   48586      0       &amp;gt;24h  46456      0
7       &amp;gt;24h   60143      0       &amp;gt;24h  57189      0
6       &amp;gt;24h   78989      0       &amp;gt;24h  58309      0
5       &amp;gt;24h   86056      0       &amp;gt;24h  76036      0
4       &amp;gt;24h  103867      0       &amp;gt;24h  95802      0
3   00:12:51    5532      0   00:40:11   7874      0
2   00:20:44    7105      0   00:26:46   4072      0
1   01:20:30   11458      0   01:23:15  10672      0
&lt;/code&gt;&lt;/pre&gt;</description>
	</item>
	
	<item>
		<title>Library</title>
		<link>https://izaac.mammadov.co.uk/library/</link>
		<pubDate>Sun, 24 Nov 2024 19:43:01 +0000</pubDate>
		
		<guid>https://izaac.mammadov.co.uk/library/</guid>
		<description>&lt;h2 id=&#34;books&#34;&gt;Books&lt;/h2&gt;
&lt;p&gt;Here is the list of books I currently either have read, own, or plan on reading, roughly divided into categories:&lt;/p&gt;
&lt;h3 id=&#34;crypto-and-privacy&#34;&gt;Crypto and Privacy:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Crypto&lt;/strong&gt; by &lt;em&gt;Steven Levy&lt;/em&gt; (ISBN 978-0-140-24432-8) &amp;mdash; Read&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Five Eyes&lt;/strong&gt; by &lt;em&gt;Richard Kerbaj&lt;/em&gt; (ISBN 978-1-789-46558-7) &amp;mdash; Currently reading&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Cryptopians&lt;/strong&gt; by &lt;em&gt;Laura Shin&lt;/em&gt; (ISBN 978-1-541-76301-2) &amp;mdash; Read&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Machine War&lt;/strong&gt; by &lt;em&gt;Noah Kumin&lt;/em&gt; (ISBN 979-8-218-29364-2) &amp;mdash; Read&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Trial of Julian Assange&lt;/strong&gt; by &lt;em&gt;Nils Melzer&lt;/em&gt; (ISBN 978-1-839-76622-0) &amp;mdash; Read&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;law-and-society&#34;&gt;Law and Society:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;A Republic, if you can keep it&lt;/strong&gt; by &lt;em&gt;Neil Gorsuch&lt;/em&gt; (ISBN 978-0-525-57678-5) &amp;mdash; Read&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Gray Mirror Fascicle I: Disturbance&lt;/strong&gt; by &lt;em&gt;Curtis Yarvin&lt;/em&gt; (ISBN 978-1-959-40354-8) &amp;mdash; Read&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sapiens&lt;/strong&gt; by &lt;em&gt;Yuval Noah Harari&lt;/em&gt; (ISBN 978-0-099-59008-8) &amp;mdash; Read&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scalia Speaks&lt;/strong&gt; by &lt;em&gt;Antonin Scalia&lt;/em&gt; (ISBN 978-0-525-57332-6) &amp;mdash; Read&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Federalist&lt;/strong&gt; by &lt;em&gt;Hamilton, Madison, and Jay&lt;/em&gt; (ISBN 978-0-521-00121-2) &amp;mdash; Own, will read&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Republic&lt;/strong&gt; by &lt;em&gt;Plato&lt;/em&gt; (ISBN 978-0-140-45511-3) &amp;mdash; Read&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;trading&#34;&gt;Trading:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Alpha Trader&lt;/strong&gt; by &lt;em&gt;Brent Donnelly&lt;/em&gt; (ISBN 978-1-736-73981-5) &amp;mdash; Read&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Finding Alphas&lt;/strong&gt; by &lt;em&gt;Igor Tulchinsky et al.&lt;/em&gt; (ISBN 978-1-119-57121-6) &amp;mdash; Read&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Liar&amp;rsquo;s Poker&lt;/strong&gt; by &lt;em&gt;Michael Lewis&lt;/em&gt; (ISBN 978-0-393-33869-0) &amp;mdash; Read&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Option Volatility and Pricing&lt;/strong&gt; by &lt;em&gt;Sheldon Natenberg&lt;/em&gt; (ISBN 978-0-071-81877-3) &amp;mdash; Read&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Options, Futures and Other Derivatives&lt;/strong&gt; by &lt;em&gt;John C. Hull&lt;/em&gt; (ISBN 978-1-292-41065-4) &amp;mdash; Read&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;other&#34;&gt;Other:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Fashion, Faith and Fantasy&lt;/strong&gt; by &lt;em&gt;Roger Penrose&lt;/em&gt; (ISBN 978-0-691-17853-0) &amp;mdash; Own, will read&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Goedel, Escher, Bach&lt;/strong&gt; by &lt;em&gt;Douglas R. Hofstadter&lt;/em&gt; (ISBN 978-0-465-02656-2) &amp;mdash; Read&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;How To Change Your Mind&lt;/strong&gt; by &lt;em&gt;Michael Pollan&lt;/em&gt; (ISBN 978-0-141-98513-8) &amp;mdash; Read&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;whitepapers-and-textbooks&#34;&gt;Whitepapers and Textbooks&lt;/h2&gt;
&lt;p&gt;Here is the list of whitepapers or textbooks that I have read through and particularly enjoyed:&lt;/p&gt;
&lt;h3 id=&#34;mathematics&#34;&gt;Mathematics&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pattern Recognition and Machine Learning&lt;/strong&gt; (Textbook) by &lt;em&gt;Christopher M. Bishop&lt;/em&gt; (ISBN 978-0-387-31073-2)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;trading-1&#34;&gt;Trading&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;More Than You Ever Wanted To Know About Volatility Swaps&lt;/strong&gt; by &lt;em&gt;Kresimir Demeterfi et al.&lt;/em&gt; (&lt;a href=&#34;https://emanuelderman.com/wp-content/uploads/1999/02/gs-volatility_swaps.pdf&#34;&gt;https://emanuelderman.com/wp-content/uploads/1999/02/gs-volatility_swaps.pdf&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Pricing with a Smile&lt;/strong&gt; by &lt;em&gt;Bruno Dupire&lt;/em&gt; (&lt;a href=&#34;https://www.risk.net/derivatives/equity-derivatives/1500211/pricing-with-a-smile&#34;&gt;https://www.risk.net/derivatives/equity-derivatives/1500211/pricing-with-a-smile&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Micro-Price: A High Frequency Estimator of Future Prices&lt;/strong&gt; by &lt;em&gt;Sasha Stoikov&lt;/em&gt; (&lt;a href=&#34;https://dx.doi.org/10.2139/ssrn.2970694&#34;&gt;https://dx.doi.org/10.2139/ssrn.2970694&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
</description>
	</item>
	
	<item>
		<title>Urbit</title>
		<link>https://izaac.mammadov.co.uk/urbit/</link>
		<pubDate>Sun, 24 Nov 2024 04:02:15 +0000</pubDate>
		
		<guid>https://izaac.mammadov.co.uk/urbit/</guid>
		<description>&lt;h1 id=&#34;what-is-urbit&#34;&gt;What is Urbit?&lt;/h1&gt;
&lt;p&gt;&lt;a href=&#34;https://urbit.org/&#34;&gt;Urbit&lt;/a&gt; is an incredibly ambitious project which aims to have an entirely clean-slate appraoch to the entire computing stack. It has its own low-level functional-programming language: &lt;a href=&#34;https://docs.urbit.org/language/nock/reference/definition&#34;&gt;Nock&lt;/a&gt; &amp;mdash; it&amp;rsquo;s Turing-Complete, but just about. It also has its own high-level functional programming language: &lt;a href=&#34;https://docs.urbit.org/language/hoon&#34;&gt;Hoon&lt;/a&gt;. Both languages look completely alien at first glance, somewhat intentionally, but amidst the ASCII punctuation marks, you gain an appreciation for their simplicity.&lt;/p&gt;
&lt;p&gt;Using Hoon (which compiles into Nock), an entirely clean-slate and completely sufficient overlay operating system was built that currently runs on top of Linux/Mac, but theoretically will be able to run on bare metal in the future. The operating system prides itself on being totally deterministic and frozen. The operating system&amp;rsquo;s state is a strict function of all the events it hears about (with some identity entropy added). As such, if you replay all events, it will end up in precisely the same state.&lt;/p&gt;
&lt;p&gt;Networking is also totally unique, with an identity system based on (currently) a scarce supply of Ethereum Urbit NFTs. Networking takes place between the holders of the NFTs. Holders of rarer NFTs have greater privileges in terms of acting as routing infrastructure for the network.&lt;/p&gt;
&lt;h1 id=&#34;find-me-on-urbit&#34;&gt;Find me on Urbit&lt;/h1&gt;
&lt;p&gt;If any of the above has piqued your interest, join the network. Tlon is a company which hosts Urbit instances, and develops the most used application on Urbit, also called Tlon where the community congregates to chat. Click this &lt;a href=&#34;https://join.tlon.io/0vvanj5.b5521.t84ll.ru4p1.gso9e&#34;&gt;link&lt;/a&gt; to receive an Urbit instance, and be able to chat on Tlon with me. If you want to send me a message, my @p is ~battul.&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Creating a CV using LaTeX</title>
		<link>https://izaac.mammadov.co.uk/latex_cv/</link>
		<pubDate>Tue, 28 May 2024 23:52:44 +0200</pubDate>
		
		<guid>https://izaac.mammadov.co.uk/latex_cv/</guid>
		<description>&lt;h1 id=&#34;latex-overview&#34;&gt;LaTeX Overview&lt;/h1&gt;
&lt;p&gt;LaTeX is a document typesetting and creation tool. It&amp;rsquo;s what you use if you want to create professional looking documents, letters, presentations, lecture notes, and so on&amp;hellip; Once you graduate from using Microsoft Office, you don&amp;rsquo;t look back. There is a little bit of a learning curve in getting used to using LaTeX, since you have to get used to the fact that you&amp;rsquo;re not going to be typing directly &amp;ldquo;into&amp;rdquo; your document, but it is well worth it. &lt;a href=&#34;https://www.overleaf.com/&#34;&gt;Overleaf&lt;/a&gt; have many very useful guides in both learning how to use LaTeX, and tools to let you create LaTeX documents in your browser. For myself personally, I use &lt;a href=&#34;https://www.texstudio.org/&#34;&gt;TeXstudio&lt;/a&gt; as a program for creating LaTeX documents.&lt;/p&gt;
&lt;h1 id=&#34;cv-template&#34;&gt;CV Template&lt;/h1&gt;
&lt;p&gt;The best way to learn how to make beautiful-looking LaTeX documents is to simply look at and copy from what other people have made. To this end, here is a &lt;a href=&#34;https://github.com/IzaacMammadov/CV&#34;&gt;GitHub Repo&lt;/a&gt; which contains the code that I use to make my CV, which you can find &lt;a href=&#34;https://izaac.mammadov.co.uk/CV.pdf&#34;&gt;here&lt;/a&gt;. It has a very minimalistic finance-style layout, and only uses three very common LaTeX packages. It was created without ever manually drawing a horizontal line, or even creating an invisible table like you&amp;rsquo;d have to do if you were using Word.&lt;/p&gt;
&lt;h1 id=&#34;katex&#34;&gt;KaTeX&lt;/h1&gt;
&lt;p&gt;LaTeX becomes invaluable when it comes to typesetting mathematical equations and formulae. It is quite easy to get LaTeX to render properly on Hugo static websites using the &lt;a href=&#34;https://katex.org/&#34;&gt;KaTeX API&lt;/a&gt;. I&amp;rsquo;d recommend following &lt;a href=&#34;https://mertbakir.gitlab.io/hugo/math-typesetting-in-hugo/&#34;&gt;this guide&lt;/a&gt;, which is what I personally do for this website.&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Making and Running a Limited Company</title>
		<link>https://izaac.mammadov.co.uk/making-a-limited-company/</link>
		<pubDate>Sat, 16 Mar 2024 20:56:00 +0000</pubDate>
		
		<guid>https://izaac.mammadov.co.uk/making-a-limited-company/</guid>
		<description>&lt;h1 id=&#34;disclaimer&#34;&gt;Disclaimer&lt;/h1&gt;
&lt;p&gt;Note all of the advice below is based on my personal experience of setting up a limited company in England. I am also not a financial professional and have no financial qualifications. If in doubt, find and pay for a financial professional. I&amp;rsquo;ve managed to set up and run everything without paying a penny, but your mileage may vary.&lt;/p&gt;
&lt;h1 id=&#34;motivation&#34;&gt;Motivation&lt;/h1&gt;
&lt;p&gt;Here are some reasons why it makes sense to do whatever you do to make money via a limited company:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Share Structure&lt;/strong&gt;: You get to decide how to structure ownership and voting rights in your company by allocating shares. You also get to sell ownership/voting rights in your company by issuing new shares in exchange for equity.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Respect&lt;/strong&gt;: Unfortunately, in dealing with suppliers and clients, they won&amp;rsquo;t treat you as well, or perhaps won&amp;rsquo;t work with you at all if you are a sole individual. Having a limited company gives you access to &amp;ldquo;corporate/business&amp;rdquo; services from various providers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Limited Liability&lt;/strong&gt;: If you ever unfortunately get into the situation where your company cannot meet its debt obligations, the company will become bankrupt, but your personal liability is limited (hence the name limited company). Your liability is limited to the total par value of all your shares, which can easily be set to be £1.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;incorporation&#34;&gt;Incorporation&lt;/h1&gt;
&lt;p&gt;Incorporation is the process by which you create a new limited company. In doing so, you have a number of decisions to make.&lt;/p&gt;
&lt;h2 id=&#34;directors&#34;&gt;Directors&lt;/h2&gt;
&lt;p&gt;Firstly, you must decide who your directors will be. Directors are the people who are legally responsible for everything the company does, and are the ones who must sign off on every tax return and accounts produced for the company. They are also who propse the amount of dividends to be paid at any time. They must be 16 years old or older and must have an office address in the UK. Their details will be made public on Companies House. The simplest case is just to have yourself be the only director.&lt;/p&gt;
&lt;h2 id=&#34;shareholders&#34;&gt;Shareholders&lt;/h2&gt;
&lt;p&gt;You must then decide on the initial share structure of the company. You assign some number of shares individually to at least one person. Shareholders will receive dividends, and in general have ownership rights proportional to the number of shares they own. Each share has a par value (also called nominal value). This par value sets what your liability is if your company goes bankrupt. You can think of it as a deposit you pay against the company going bankrupt. If the company winds up (the term for closing up shop), with all its debts paid, you&amp;rsquo;ll receive it back alongside the proportion of company assets you are entitled to. If not, then that money goes to whatever creditors you owe. The sum of the par value of all the shares issued is called your share capital. The simplest case is issuing one share to yourself, with a par value of £1.&lt;/p&gt;
&lt;p&gt;You are also allowed to issue many different types of shares, each with different par values, different dividend rights, different voting rights and different priorities for claiming company assets when the company winds up. A common structure is to issue a different type of &amp;ldquo;B-shares&amp;rdquo; which are pretty similary to the ordinary shares, except dividends are paid separately to the &amp;ldquo;B-shares&amp;rdquo; from the ordinary shares. Thus you can tailor how much dividend to pay out to the ordinary shareholder(s) vs the B-shareholder(s).&lt;/p&gt;
&lt;p&gt;If you ever get into the position to have people wanting to invest in your company, then you will need to issue shares to them at a price you set. The price that you sell each share for doesn&amp;rsquo;t have to equal the par value of the share. Any extra amount will be marked as &amp;ldquo;share premium&amp;rdquo;. You cannot issue the shares for a price less than the par value though. The par value acts almost as a floor price that you can issue shares at.&lt;/p&gt;
&lt;h2 id=&#34;form&#34;&gt;Form&lt;/h2&gt;
&lt;p&gt;Once you&amp;rsquo;ve decided on these points, it&amp;rsquo;s merely a case of filling out an online application form &lt;a href=&#34;https://www.tax.service.gov.uk/register-your-company/setting-up-new-limited-company&#34;&gt;here&lt;/a&gt;. Note this application form will at the same time register you for Corporation Tax, which you might as well do since you&amp;rsquo;ll need to do so anyway. In my experience, it took only 12 hours for Companies House to get back to me with a certificate of incorporation, but signing up for Corporation Tax took around 2 weeks for them to get back to me.&lt;/p&gt;
&lt;h1 id=&#34;finances&#34;&gt;Finances&lt;/h1&gt;
&lt;p&gt;Now that you are the director of a limited company, it is your responsbility to keep track of your company finances (or hiring an accountant/bookkeeper to do so). There are many paid software solutions out there, but if you are running a very small company, which doesn&amp;rsquo;t have too many transactions, I found that I can keep track of everything on a simple spreadsheet. They key to every piece of accounting software is the concept known as double-entry accounting, which ensures that all money is always &amp;ldquo;accounted&amp;rdquo; for.&lt;/p&gt;
&lt;h2 id=&#34;the-accounting-equation&#34;&gt;The Accounting Equation&lt;/h2&gt;
&lt;p&gt;The purpose of double-entry accounting is to ensure that transactions are recorded in a way which maintains the truth of the accounting equation. The accounting equation (at year-end) states that: &lt;code&gt;Assets = Liabilities + Equity&lt;/code&gt;. Assets represents the price of all money (both actual and owed to it) and goods that the company has in its possession. Liabilities represents the price of all the money the company owes to other people. The year-end accounting equation simply states that all the assets the company has that isn&amp;rsquo;t being used for liabilities is equity. Equity can be thought of as the value of all the shareholders&amp;rsquo; claims to the company. Equity is the &amp;ldquo;book value&amp;rdquo; of the company.&lt;/p&gt;
&lt;p&gt;When it isn&amp;rsquo;t year-end, then the accounting equation has a longer form as follows: &lt;code&gt;Assets = Liabilities + Equity + Revenue - Expenses&lt;/code&gt;. This is to reflect that in the middle of the year, equity isn&amp;rsquo;t being constantly increased and decreased as money is earned/lost. Instead, everytime money is earned, it is marked up as revenue, and everytime money is lost, it is marked as an expenses. Then at the end of the year, &lt;code&gt;Revenue - Expenses&lt;/code&gt; is zeroed out, and squashed into Equity as &amp;ldquo;Retained Earnings&amp;rdquo; which will be described below.&lt;/p&gt;
&lt;h2 id=&#34;accounts&#34;&gt;Accounts&lt;/h2&gt;
&lt;p&gt;Accounts are the way accountants track where your money is. They include things we normally think of as accounts, such as bank accounts, but also include things we don&amp;rsquo;t normally think of as accounts. Each account has a name and falls under exactly one category: Assets, Liabilities, Equity, Revenue, Expenses. Each account has a value, and summing the account values under the respective categories must lead to the intra-year accounting equation being true. The easiest way to explain accounts is to simply give some examples of what they may look like and the categories they fall under:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bank Account X (Assets)&lt;/li&gt;
&lt;li&gt;Computer Equipment (Assets)&lt;/li&gt;
&lt;li&gt;Cash in Hand (Assets)&lt;/li&gt;
&lt;li&gt;Client Y Accounts Receivable i.e. Money you&amp;rsquo;re owed from Client Y (Assets)&lt;/li&gt;
&lt;li&gt;Savings Account Z (Assets)&lt;/li&gt;
&lt;li&gt;Share Capital (Equity)&lt;/li&gt;
&lt;li&gt;Share Premium (Equity)&lt;/li&gt;
&lt;li&gt;Retained Earnings (Equity)&lt;/li&gt;
&lt;li&gt;Dividends Payable (Equity)&lt;/li&gt;
&lt;li&gt;Bank Loan (Liabilities)&lt;/li&gt;
&lt;li&gt;Supplier A Accounts Payable i.e. Money you owe to Supplier A (Liabilities)&lt;/li&gt;
&lt;li&gt;Trading Revenue Jan 2025 (Revenue)&lt;/li&gt;
&lt;li&gt;Loan Interest (Expenses)&lt;/li&gt;
&lt;li&gt;Admin/Stationery Costs (Expenses)&lt;/li&gt;
&lt;li&gt;Personnel Costs / Salaries (Expenses)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Most likely the only confusion in the list above comes from the accounts falling under Equity. Heres an explanation for those accounts. Share Capital is the sum of all the par values that shareholders paid for their shares when they were issued. In fact, if you incorporated your company with one shareholder, with one share with a par value of £1, you have to actually give your company £1 and have it recorded under share capital. Share Premium is all of the excess amounts above par value that people paid when their shares were issued. This will tend to be £0 until you start selling shares to people. Retained Earnings, as described above, is where the profit (Revenue - Expenses) goes at the end of the year. You can think of it as te profit that the company has chosen to keep for itself, but that still &amp;ldquo;belongs&amp;rdquo; to the shareholders. Dividends Payable represent dividends that have been announced by your company but haven&amp;rsquo;t been paid out yet.&lt;/p&gt;
&lt;h2 id=&#34;double-entry&#34;&gt;Double-Entry&lt;/h2&gt;
&lt;p&gt;Double-Entry is a system of tracking transactions. It says that every transaction must have a &amp;ldquo;Credit Account&amp;rdquo; and a &amp;ldquo;Debit Account&amp;rdquo;, and a fixed numerical value. For example, if I move £10 from Bank Account A to Bank Account B, then the credit account will be Bank Account A, the debit account will be Bank Account B, and the value will be £10. This means that money can never appear or disappear out of nowhere. In order to maintain the intra-year accounting equation, there is a sign convention related to the what category an account falls under. The sign convention states that for accounts falling under &amp;ldquo;Assets&amp;rdquo; or &amp;ldquo;Expenses&amp;rdquo;, then a debit will increase their value and a credit will decrease their value. For accounts falling under &amp;ldquo;Liabilities&amp;rdquo;, &amp;ldquo;Equity&amp;rdquo; or &amp;ldquo;Revenue&amp;rdquo;, a credit will increase their value and a debit will decrease their value. Once again, the easiest way to explain double-entry transactions is just to give some examples and their effects:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Issuing a share of par value £1 at par [This is usually the very first transaction the company makes]
&lt;ul&gt;
&lt;li&gt;Credit: Share Capital (+£1)&lt;/li&gt;
&lt;li&gt;Debit: Bank Account (+£1)&lt;/li&gt;
&lt;li&gt;Value: £1&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Buying a Computer
&lt;ul&gt;
&lt;li&gt;Credit: Bank Account (-£1000)&lt;/li&gt;
&lt;li&gt;Debit: Computer Equipment (+£1000)&lt;/li&gt;
&lt;li&gt;Value: £1000&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Paying Wages
&lt;ul&gt;
&lt;li&gt;Credit: Bank Account (-£5000)&lt;/li&gt;
&lt;li&gt;Debit: Personnel Costs / Salaries (+£5000)&lt;/li&gt;
&lt;li&gt;Value: £5000&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Receiving a Bank Loan
&lt;ul&gt;
&lt;li&gt;Credit: Bank Loan (+£10000)&lt;/li&gt;
&lt;li&gt;Debit: Bank Account (+£10000)&lt;/li&gt;
&lt;li&gt;Value: £10000&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Trading Revenue for January 2025
&lt;ul&gt;
&lt;li&gt;Credit: Trading Revenue Jan 2025 (+£20000)&lt;/li&gt;
&lt;li&gt;Debit: Bank Account (+£20000)&lt;/li&gt;
&lt;li&gt;Value: £20000&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Feel free to check that each of the transactions above maintains the truth of the intra-year accounting equation. This is the magic of double-entry accounting with the appropriate sign convention for debits and credits. Note that, some transactions, especially involving VAT, othe taxes, or foreign currencies may have multiple debits and multiple credits with separate values. However, the golden rule is that the value of the credits must sum to the value of debits.&lt;/p&gt;
&lt;h2 id=&#34;depreciation&#34;&gt;Depreciation&lt;/h2&gt;
&lt;p&gt;You&amp;rsquo;ll see that when you buy an asset, it gets marked at precisely the price you bought it for. However, eventually when you have to dispose of the asset (sell it, or chuck it away because it&amp;rsquo;s worthless), it will look like you are losing lots of money. Depreciation is the process by which you spread the reduction in value of an asset over the course of its useful life. For example, if you buy a computer, which you expect to be useful for 10 years, you can reduce its value by 10% evey year. Thus after 10 years, it will be worthless. Depreciation is just a way to keep track of what the actual value of assets are, and not just what you paidd for them. Depreciation transactions would have the asset in question as the Credit, and then a Depreciation (Expenses) account as the Debit.&lt;/p&gt;
&lt;p&gt;You do not have to worry too much about making your depreciation schemes to be as precise as possible. This is because depreciation doesn&amp;rsquo;t affect how much Corporation Tax you pay. Depreciation isn&amp;rsquo;t considered an expense for the purposes of Corporation Tax (to stop people fudging their numbers too much). Instead, you can claim back Corporation Tax on money you spend on &amp;ldquo;plant and machinery&amp;rdquo; via Capital Allowances. Note that plant is a very general term covering many different things.&lt;/p&gt;
&lt;h2 id=&#34;valid-expenses&#34;&gt;Valid Expenses&lt;/h2&gt;
&lt;p&gt;In general, people who run companies are looking to make as much money as they spend as possible a business expense, as opposed to a person expense. If something is a business expense, then it reduces your corporation tax bill at the end of the year. Unfortunately, HMRC generally only lets you put things down as an expense which are &amp;ldquo;wholly and exclusively&amp;rdquo; used for the business. This means you as a person shouldn&amp;rsquo;t be getting any benefit from it, just your company or you as an employee.&lt;/p&gt;
&lt;p&gt;However, there are specific expenses which HMRC enumerate as being allowed. I&amp;rsquo;ll note a couple of them. Firstly, all employees which work from home are allowed to be paid £26 a month &amp;ldquo;working from home&amp;rdquo; expense to reimburse them for the costs they incur in working from home. This means you as a director and employee can pay yourself this £26 a month tax free. You can actually pay yourself more than this, but only if you have physical proof that the extra costs you incur from working home exceed that amount. This generally means you&amp;rsquo;ll have to show the bills you pay before and after starting working at home and seeing the difference. Secondly you are allowed to expense canteen personnel expenses. You are allowed to treat feeding all your staff + directors as a business expense not incurring any taxation, if it is within the following requirements. It must be a &amp;ldquo;reasonable&amp;rdquo; meal, it must be provided either on your premises/primary place of work or in a proper canteen, and it must be available to all employees and directors based in a given location. There is no minimum company size for this to be applicable, thus if you are the only director and employee, I read the guidance to be clear in allowing your company to pay for reasonable meals during working hours if they are delivered to your primary place of work.&lt;/p&gt;
&lt;h1 id=&#34;annual-requirements&#34;&gt;Annual Requirements&lt;/h1&gt;
&lt;p&gt;Every year, you&amp;rsquo;ll have to do a number of things to keep your company running.&lt;/p&gt;
&lt;h2 id=&#34;confirmation-statement&#34;&gt;Confirmation Statement&lt;/h2&gt;
&lt;p&gt;Every year, you&amp;rsquo;ll have to fill out a confirmation statement and pay ~£20. This is basically just you confirming that everything you filled out on your initial incorporation form is still true, and nothing has changed in the past year.&lt;/p&gt;
&lt;h2 id=&#34;accounts-1&#34;&gt;Accounts&lt;/h2&gt;
&lt;p&gt;You&amp;rsquo;ll also have to submit your accounts. For larger companies, this can be a very arduous process, but if you qualify as a &amp;ldquo;micro-entity&amp;rdquo;, which basically means you are a small enough company, your accounts can be quite heavily abridged. For a template of what has to be included on micro-entity accounts, feel free to search for &amp;ldquo;micro-entity accounts statutory requirements&amp;rdquo;, or view the official standard &lt;a href=&#34;https://media.frc.org.uk/documents/FRS_105_The_Financial_Reporting_Standard_applicable_to_the_Micro-entities_Regime.pdf&#34;&gt;here&lt;/a&gt; called FRS 105. The main contents will be a very basic balance sheet (stating your assets, liabilities and making sure the difference lines up with your equity), and a basic Profit/Loss statement, outlining your revenues and expenses.&lt;/p&gt;
&lt;h2 id=&#34;corporation-tax-ct600&#34;&gt;Corporation Tax (CT600)&lt;/h2&gt;
&lt;p&gt;You&amp;rsquo;ll also have to file your Corporation Tax return, named CT600, and pay the Corporation Tax due. Here you fill out details about your profits, and claim any Capital Allowances you are entitled to, and then pay the Corporation Tax that you owe.&lt;/p&gt;
&lt;h2 id=&#34;vat&#34;&gt;VAT&lt;/h2&gt;
&lt;p&gt;You&amp;rsquo;ll also have to file a VAT return, if you are not exempt from paying VAT. As the company I run is exempt from VAT, I don&amp;rsquo;t have much personal experience on this point. In general, you&amp;rsquo;ll have to outline all of your VAT inputs and outputs (VAT you paid on goods and services you bought versus VAT you charged for goods and services you sold).&lt;/p&gt;
&lt;h1 id=&#34;taking-money-out-of-your-company&#34;&gt;Taking Money out of your Company.&lt;/h1&gt;
&lt;p&gt;Unfortunately, money that your company makes isn&amp;rsquo;t automatically yours to spend as you please, and you can get into real trouble for doing so. You have to officially pay yourself the money, and there are 3 ways to do so.&lt;/p&gt;
&lt;h2 id=&#34;salarypayroll&#34;&gt;Salary/Payroll&lt;/h2&gt;
&lt;p&gt;In this case, you pay yourself as you would pay an employee. This is reported everytime your pay yourself to HMRC via a system known as PAYE. You&amp;rsquo;ll have to register and sign up to PAYE before you use it. Once registered, I use HMRC&amp;rsquo;s own application (which supports Linux) called PAYE Tools to submit PAYE returns. The double entry transaction be simple be Credit: Bank Account (where you pay yourself from) Debit: Salary / Personnel Costs. You may also have to credit some income tax witholding / national insurance witholding Liabilities accounts if your had to pay those. As long as the total sum of the debits equals the total sum of the credits you are fine.&lt;/p&gt;
&lt;p&gt;When you pay yourself, this counts as an expense to your company, so you won&amp;rsquo;t have to pay Corporation Tax on the amount, but you will have to pay Income Tax and both Employees and Employers National Insurance on the amount. You&amp;rsquo;ll be told how much this is when you submit your PAYE return. The general advice is that you should only pay yourself up to your Income Tax Personal Allowance (where you get charged 0% Income Tax). Past that, paying yourself a salary is the most tax-inefficient ways to take money out of your company. If you have more than one employee, you can also qualify for Employment Allowance which reduces your National Insurance liability.&lt;/p&gt;
&lt;h2 id=&#34;dividends&#34;&gt;Dividends&lt;/h2&gt;
&lt;p&gt;In order to pay yourself dividends, you&amp;rsquo;ll have to hold a Director&amp;rsquo;s meeting (which may just be a meeting by yourself in a room), record minutes of the meeting, and vote (by yourself again) to declare a certain dividend amount per share. The simplest form is to declare a dividend amount of £X per share, so that ever shareholder is paid £X per share they own. You&amp;rsquo;ll then have to give yourself a dividends receipt. Note, that dividends can only be declared from any profits you have. Your assets subtracted by your liabilities must be greater than the total amount of dividends you declare. The double entry transaction will be first Credit: Dividends Payable, Debit: Retained Earnings, and then Credit: Bank Account (where you pay the dividends from), Debit: Dividends Payable.&lt;/p&gt;
&lt;p&gt;Dividends are paid from profits, and so you still have to pay corporation tax on whatever diviends you paid out. However, you don&amp;rsquo;t have to pay Income Tax or any kind of National Insurance. Instead, the individual must pay Dividends Tax in their next April tax return (which is lower than Income Tax). Thus overall, dividends is a more tax-efficient way to pay yourself usually.&lt;/p&gt;
&lt;h2 id=&#34;directors-loan&#34;&gt;Director&amp;rsquo;s Loan&lt;/h2&gt;
&lt;p&gt;This isn&amp;rsquo;t really a way of taking money out of a company, but rather of your company loaning you money, which you must pay back. When the company is loaning you money, this is very much a headache and usually never worth doing. You must charge yourself a statutory rate of interest, which counts as profit for the company (resulting in more tax), and you must pay it back within certain time limits and not exceed certain amounts, or pay hefty tax bills.&lt;/p&gt;
&lt;p&gt;However, on the flip side, you can also loan your company money. This does make sense to do when your company is starting out and needs some extra cash to get started. You can charge the company whatever reasonable rate of interest you want (and it makes sense to charge a decent amount), which the company then has to pay back. This way you can net take money out of the company via that interest payment. However note, that that interest payment counts as income, and so you&amp;rsquo;ll have to pay income tax on it. In fact, the company itself has to withold 20% Income tax on it before it pays it to you, using &lt;a href=&#34;https://www.gov.uk/government/publications/corporation-tax-return-of-income-tax-on-company-payments-ct61&#34;&gt;Form CT61&lt;/a&gt;. However, because the interest payments count as an expense for the company (thus no corporation tax), and the income is not liable for any national insurance, it is still very tax efficient. I wouldn&amp;rsquo;t suggest loaning your company money just to get interest payments, but if you company needs the money anyway, it makes sense to charge a reasonable but decent level of interest.&lt;/p&gt;
&lt;h2 id=&#34;winding-up&#34;&gt;Winding Up&lt;/h2&gt;
&lt;p&gt;This is also definitely not really a way of taking money out of a company, but it&amp;rsquo;s useful to keep in mind. If your company is in good shape, has paid all its debts and you want to shut up shop, there are two ways to do so. One is simply by paying yourself via dividends + salary all of the assets that the company has on its books, and then &amp;ldquo;striking off&amp;rdquo; the company from the register. Any assets remaining owned by the company go to the crown. This is the simplest process, but is very tax inefficient.&lt;/p&gt;
&lt;p&gt;The tax efficient way to wind up is to do a members voluntary liquidation (MVL). Unfortunately, this can only be done by an official, registered liquidator, who usually charge a decently large fee to do so. However, when all is said and done, they will distribute all of the assets to the shareholders. When all is said and done, you will only have to pay capital gains tax, on the assets you received (in effect you sold your 1 share back to the company and received all of the assets in return). You also have a £6,000 CGT allowance, as well as Business Asset Dispoal Relief (BADR) which reduces the CGT liability to only 10%. You should keep this in mind as it is almost always better to not pay yourself money where you can avoid it, because in the end, once your company winds up, you&amp;rsquo;ll probably only have to pay 10% on it.&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Advent of Code 2023</title>
		<link>https://izaac.mammadov.co.uk/aoc_2023/</link>
		<pubDate>Mon, 19 Feb 2024 17:59:07 +0000</pubDate>
		
		<guid>https://izaac.mammadov.co.uk/aoc_2023/</guid>
		<description>&lt;p&gt;The &lt;a href=&#34;https://adventofcode.com/2023&#34;&gt;Advent of Code&lt;/a&gt; is an annual programming competition that takes place in the run-up to Christmas (between 1st December and 25th Decemeber), run by &lt;a href=&#34;http://was.tl/&#34;&gt;Eric Wastl&lt;/a&gt;. The challenges start off pretty easy (do-able by anyone who knows the basics of any programming langauge) but scale up in difficulty quickly. There is a leaderboard for the quickest time to solve problems globally (which has some insanely fast times), but I think the most fun is had as part of a private leaderboard between your friends. Unfortunately for those based in Europe, the problems are released at 5am UTC every day.&lt;/p&gt;
&lt;p&gt;I took part last year and got up to Day 22 before I had to give up. I decided to stop the first time I didn&amp;rsquo;t/couldn&amp;rsquo;t solve a problem on the day that it was released. Here are my times on the days that I woke up at 5am to do the problem:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;      --------Part 1--------   --------Part 2--------
Day       Time   Rank  Score       Time   Rank  Score
 22   01:06:29   1519      0   01:22:55   1322      0  [Started 15m late]
 20   00:46:17    812      0   01:21:40    821      0
 19   00:15:45    387      0   01:04:15   1065      0
 18   00:42:51   2437      0   01:54:40   2434      0
 17   00:47:14   1200      0   01:19:54   1474      0
 16   00:27:13   1319      0   00:36:17   1382      0
 11   00:15:43   1313      0   00:38:29   3126      0
 10   00:16:16    324      0   00:48:15    319      0
  4   00:05:35    948      0   00:10:04    361      0
  1   00:03:34   1047      0   00:12:44    702      0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Also if you&amp;rsquo;re interested to see my solutions to the problems, then they&amp;rsquo;re available &lt;a href=&#34;https://github.com/IzaacMammadov/AOC-2023&#34;&gt;here on GitHub&lt;/a&gt;. I found that a lot of time could be saved by pre-coding simple functions to do most of the pre-processing for me. That&amp;rsquo;s probably what I&amp;rsquo;ll work on before this year&amp;rsquo;s set of problems. I encourage everyone who knows how to code to take part this year (in circa 10 months)!&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Install Activated Windows for Free, legally</title>
		<link>https://izaac.mammadov.co.uk/windows-activation/</link>
		<pubDate>Sun, 14 Jan 2024 20:43:46 +0000</pubDate>
		
		<guid>https://izaac.mammadov.co.uk/windows-activation/</guid>
		<description>&lt;h1 id=&#34;introduction&#34;&gt;Introduction&lt;/h1&gt;
&lt;p&gt;The day may unfortunately come when you are required to use the Windows operating system, usually for work obligations. Not only are you forced to use Windows, but Microsoft also tries to pressure you into paying for the &amp;ldquo;privilege&amp;rdquo; of using their operating system. At the time of writing, Windows 11 Home edition is currently being sold for £120.00! There are also many third-party sellers selling Windows Activation Keys for a cheaper price, although a lot of them are scams/unreliable. What most people don&amp;rsquo;t realise is that you can download, install, and activate Windows without ever paying a penny.&lt;/p&gt;
&lt;h1 id=&#34;download&#34;&gt;Download&lt;/h1&gt;
&lt;p&gt;This guide is designed to work for people on Linux distros. Microsoft has a much easier process to download Windows if you already have access to a Windows machine, but this guide works for everyone. You first need to download the Windows Disk Image ISO from &lt;a href=&#34;https://www.microsoft.com/software-download/windows11&#34;&gt;here&lt;/a&gt; on the Microsoft website. This download is very slow from Microsoft, regardless of how quick your internet speeds are, but unfortunately you&amp;rsquo;ll have to wait it out. It took ~2 hours for me to complete. Downloading from a torrent may be much quicker, but I wouldn&amp;rsquo;t trust any public torrent for things like this.&lt;/p&gt;
&lt;p&gt;You then need to flash this ISO onto a USB stick. The particular disk formatting/labelling and partitions that Windows requires is frustratingly precise and very delicate (unlike installing Linux operating systems). Thus I would recommend using a third-party tool like &lt;a href=&#34;https://github.com/WoeUSB/WoeUSB&#34;&gt;WoeUSB&lt;/a&gt; to do the work for you. You simply specify the ISO file, your USB stick&amp;rsquo;s partition, and let it do its thing. With &lt;a href=&#34;https://github.com/WoeUSB/WoeUSB&#34;&gt;WoeUSB&lt;/a&gt;, I&amp;rsquo;d recommend ticking the skip legacy grub bootloader flag to save time. Note that whatever method you use, this flashing process also takes up a lot of time depending on the write speed of your USB stick. You should also ensure that you do not remove your USB stick until you have ran the &lt;code&gt;sync&lt;/code&gt; command.&lt;/p&gt;
&lt;h1 id=&#34;installation&#34;&gt;Installation&lt;/h1&gt;
&lt;p&gt;Once you have flashed Windows onto your USB stick, you can insert it into your computer and then on startup, it will either automatically boot from the USB stick, or you will manually have to interrupt the boot process by spamming F12, Enter, Esc, or some other key and specify that you want to boot from the USB stick. At some stage after hitting &amp;ldquo;Next&amp;rdquo; a few times, Windows will prompt you to enter in a License Key. What most people don&amp;rsquo;t realise is that you can simply click on &amp;ldquo;I do not have a License Key&amp;rdquo;, and the installation process will continue exactly as normal. No purchase required.&lt;/p&gt;
&lt;p&gt;The problem however is that your Windows will be &amp;ldquo;unactivated&amp;rdquo;. This has very little effect for most people, beyond just the fact that you won&amp;rsquo;t be able to change your background wallpaper, and there&amp;rsquo;ll be an ugly activation message in the bottom right hand corner of your Desktop. Luckily, you can also activate your Windows for free and very easily.&lt;/p&gt;
&lt;h1 id=&#34;activation&#34;&gt;Activation&lt;/h1&gt;
&lt;p&gt;Luckily, Microsoft leaves behind a lot of backdoors for Microsoft technicians and their various services to be able to activate Windows even without a valid product key. But any of us can also use those same backdoors. I recommend the program found at &lt;a href=&#34;https://massgrave.dev/&#34;&gt;massgrave.dev&lt;/a&gt; to do this for you. If you follow the instructions on that website, which involve basically just running one command in your terminal, you&amp;rsquo;ll end up with a completely activated Windows installation. It&amp;rsquo;s completely indistinguishable from what most people would have to pay £120 for.&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Making a Website</title>
		<link>https://izaac.mammadov.co.uk/making-a-website/</link>
		<pubDate>Sun, 10 Dec 2023 03:30:25 +0000</pubDate>
		
		<guid>https://izaac.mammadov.co.uk/making-a-website/</guid>
		<description>&lt;h1 id=&#34;overview&#34;&gt;Overview&lt;/h1&gt;
&lt;p&gt;I recommend everyone set up their own personal website as a space on the internet to share their ideas, publicise their work and give updates about their life. The cost is very little and you don&amp;rsquo;t need to be a particularly technical person to get started.&lt;/p&gt;
&lt;p&gt;In creating this website, I followed the &lt;a href=&#34;https://landchad.net/&#34;&gt;LandChad&lt;/a&gt; guide written primarily by &lt;a href=&#34;https://lukesmith.xyz/&#34;&gt;Luke Smith&lt;/a&gt;. It&amp;rsquo;s very detailed and describes the process step by step, starting from scratch all the way to having a running HTTPS website. On this page, I&amp;rsquo;m not going to repeat what&amp;rsquo;s already in the &lt;a href=&#34;https://landchad.net/&#34;&gt;LandChad&lt;/a&gt; guide, but just try to point things I did differently that worked better for me. If you prefer following along with a video, you can see &lt;a href=&#34;https://lukesmith.xyz/&#34;&gt;Luke Smith&lt;/a&gt; roughly following his guide (and a bit more) on YouTube &lt;a href=&#34;https://www.youtube.com/watch?v=3dIVesHEAzc&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h1 id=&#34;dns&#34;&gt;DNS&lt;/h1&gt;
&lt;p&gt;I bought and registered my domain name with &lt;a href=&#34;https://www.godaddy.com/&#34;&gt;GoDaddy&lt;/a&gt;. I don&amp;rsquo;t particularly recommend them over any other registrar, it&amp;rsquo;s just that it was the simplest option for me to go for and they tend to have very reasonable prices (as long as you don&amp;rsquo;t opt-in to any of their extra features garbage). The only annoying thing about &lt;a href=&#34;https://www.godaddy.com/&#34;&gt;GoDaddy&lt;/a&gt; is that they stop you from logging-in if you&amp;rsquo;re using a VPN connection.&lt;/p&gt;
&lt;h1 id=&#34;vps&#34;&gt;VPS&lt;/h1&gt;
&lt;p&gt;Choosing who hosts your VPS is actually an important decision unlike choosing your DNS provider. &lt;a href=&#34;https://lukesmith.xyz&#34;&gt;Luke Smith&lt;/a&gt; is a bit of a &lt;a href=&#34;https://www.vultr.com/&#34;&gt;Vultr&lt;/a&gt; shill (and potentially receives referral fees from them), however I did not have a very good experience with them. Your three main considerations when choosing a VPS are three Ps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Price: If you&amp;rsquo;re not expecting heavy traffic or high usage, then you can find VPSs for less than £20 a month.&lt;/li&gt;
&lt;li&gt;Privacy: You preferably want to have the servers that your VPS runs on in a country which respects privacy (i.e. not &lt;a href=&#34;https://dhitma.neocities.org/html/eyes&#34;&gt;Five Eyes&lt;/a&gt;). A lot of VPS hosts also take payment in &lt;a href=&#34;https://bitcoin.org/&#34;&gt;Bitcoin&lt;/a&gt; or &lt;a href=&#34;https://www.getmonero.org/&#34;&gt;more privacy-protecting cryptocurrencies&lt;/a&gt;, which is always a big plus.&lt;/li&gt;
&lt;li&gt;Ports: If you want to also run your own email server on your VPS, then have to allow it as part of their Terms of Service and be willing to unblock the relevant ports (specifically port 25) on your VPS.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&#34;https://www.vultr.com/&#34;&gt;Vultr&lt;/a&gt; fails mainly on the last P and are generally unwilling to unblock the email port 25 for most people. Many people have &lt;a href=&#34;https://github.com/LukeSmithxyz/emailwiz/issues/172&#34;&gt;complained&lt;/a&gt;, but &lt;a href=&#34;https://lukesmith.xyz&#34;&gt;Luke Smith&lt;/a&gt; still continues to recommend them. Personally, I use &lt;a href=&#34;https://host1.no&#34;&gt;Host1&lt;/a&gt; for my VPS. They&amp;rsquo;re based in Norway and accept payment in &lt;a href=&#34;https://bitcoin.org/&#34;&gt;Bitcoin&lt;/a&gt;. Their current cheapest VPS option is 249 Norwegian Crowns per month, which as of 2023/12/10 translates to £18.20 per month. They also were and potentailly still are the host for &lt;a href=&#34;https://wikileaks.org/&#34;&gt;WikiLeaks&lt;/a&gt;. Be aware that their website is entirely in Norwegian (although they do provide translations) and you will be receiving emails in Norwegian.&lt;/p&gt;
&lt;p&gt;I also chose to have my VPS run &lt;a href=&#34;https://archlinux.org/&#34;&gt;Arch Linux&lt;/a&gt; as opposed to &lt;a href=&#34;https://www.debian.org/&#34;&gt;Debian&lt;/a&gt; which is the typical recommendation, simply because I am running &lt;a href=&#34;https://archlinux.org/&#34;&gt;Arch&lt;/a&gt; on my personal PC and so am more familiar with it. I also found that using &lt;a href=&#34;https://wiki.archlinux.org/title/pacman&#34;&gt;pacman&lt;/a&gt; for installing packages lead to fewer issues. Almost all VPS hosts offer to install both &lt;a href=&#34;https://www.debianorg/&#34;&gt;Debian&lt;/a&gt; and &lt;a href=&#34;https://archlinux.org/&#34;&gt;Arch&lt;/a&gt; on their VPSs.&lt;/p&gt;
&lt;h1 id=&#34;securing-your-vps&#34;&gt;Securing your VPS&lt;/h1&gt;
&lt;p&gt;If you follow the &lt;a href=&#34;https://landchad.net/&#34;&gt;LandChad&lt;/a&gt; guide successfully, you should end up with a simple website, whose files are in &lt;code&gt;/var/www/*website_name*&lt;/code&gt;, being served by &lt;a href=&#34;https://www.nginx.com/&#34;&gt;NGINX&lt;/a&gt;, open to HTTPS connections, whose TLS certificate is signed by &lt;a href=&#34;https://letsencrypt.org/&#34;&gt;Let&amp;rsquo;s Encrypt&lt;/a&gt; via &lt;a href=&#34;https://certbot.eff.org/&#34;&gt;Certbot&lt;/a&gt;. I would then recommend following this &lt;a href=&#34;https://landchad.net/sshkeys/&#34;&gt;SSH Keys LandChad guide&lt;/a&gt; in order to stop chinese hackers constantly trying to guess your &lt;code&gt;root&lt;/code&gt; user password and completely disable password log-in for your VPS.&lt;/p&gt;
&lt;h1 id=&#34;hugo&#34;&gt;Hugo&lt;/h1&gt;
&lt;p&gt;From this point, you can choose to go old-school and write your own HTML and CSS files. Instead, I would recommend using a static-site generator &lt;a href=&#34;https://gohugo.io/&#34;&gt;Hugo&lt;/a&gt;. This allows your to create pages for your website using &lt;a href=&#34;https://www.markdownguide.org/&#34;&gt;Markdown&lt;/a&gt;, and &lt;a href=&#34;https://gohugo.io/&#34;&gt;Hugo&lt;/a&gt; will handle creating the relevant HTML and CSS files. You can also very easily use a wide variety of &lt;a href=&#34;https://themes.gohugo.io/&#34;&gt;Hugo themes&lt;/a&gt;, that will handle how your pages should be displayed and their formatting.&lt;/p&gt;
&lt;p&gt;For this website, I use &lt;a href=&#34;https://lukesmith.xyz&#34;&gt;Luke Smith&amp;rsquo;s&lt;/a&gt; Hugo theme &amp;mdash; &lt;a href=&#34;https://github.com/LukeSmithxyz/lugo&#34;&gt;Lugo&lt;/a&gt;. He has a YouTube video explaining his theme and how to use &lt;a href=&#34;https://gohugo.io/&#34;&gt;Hugo&lt;/a&gt; in general &lt;a href=&#34;https://www.youtube.com/watch?v=ZFL09qhKi5I&#34;&gt;here&lt;/a&gt;. &lt;a href=&#34;https://gohugo.io&#34;&gt;Hugo&lt;/a&gt; leads to the best of both worlds, where you can create good-looking, minimalist websites, which are completely static and don&amp;rsquo;t depend on bloated dynamic content.&lt;/p&gt;
&lt;h1 id=&#34;email-server&#34;&gt;Email Server&lt;/h1&gt;
&lt;p&gt;You can also host your own email server on your VPS. This is more than merely having your own email address domain. It means that programs running on your VPS handle both the sending and receiving of emails, and whatever email client you use connects only to your VPS. The LandChad guide on setting up an email server running &lt;a href=&#34;https://www.dovecot.org/&#34;&gt;Dovecot&lt;/a&gt; and &lt;a href=&#34;https://www.postfix.org/&#34;&gt;Postfix&lt;/a&gt; can be found &lt;a href=&#34;https://landchad.net/mail/smtp/&#34;&gt;here&lt;/a&gt;. The instructions in the guide are quite reliant on starting off with specific default config files, which aren&amp;rsquo;t necessary the case and change with new updates. Thus you&amp;rsquo;ll probably have to do some bug-fixing even after following the guide.&lt;/p&gt;
&lt;h1 id=&#34;latex&#34;&gt;LaTeX&lt;/h1&gt;
&lt;p&gt;Having &lt;a href=&#34;https://www.latex-project.org/&#34;&gt;LaTeX&lt;/a&gt; render properly on &lt;a href=&#34;https://gohugo.io/&#34;&gt;Hugo&lt;/a&gt; websites is actually quite easy using the &lt;a href=&#34;https://katex.org/&#34;&gt;KaTeX API&lt;/a&gt;. I found &lt;a href=&#34;https://mertbakir.gitlab.io/hugo/math-typesetting-in-hugo/&#34;&gt;this guide&lt;/a&gt; by &lt;a href=&#34;https://mertbakir.gitlab.io/&#34;&gt;Mert Bakir&lt;/a&gt; very useful.&lt;/p&gt;
&lt;h1 id=&#34;rss&#34;&gt;RSS&lt;/h1&gt;
&lt;p&gt;One of the great parts of using the &lt;a href=&#34;https://github.com/LukeSmithxyz/lugo&#34;&gt;Lugo&lt;/a&gt; theme is that an &lt;a href=&#34;https://www.rssboard.org/&#34;&gt;RSS&lt;/a&gt; feed is automatically created for your website, which you can see for yourself at the bottom of this page. This means that people using an RSS reader can easily subscribe and be notified when you create any new pages on your website. It&amp;rsquo;s considered old-school tech now-a-days, but if people start using &lt;a href=&#34;https://www.rssboard.org/&#34;&gt;RSS&lt;/a&gt; conscientiously, then most social media websites would become obsolete. Imagine a world where news and updates from your friends or people/projects you care about get aggregated and sent directly to you where you can view and organise everything in one program you run on your PC. No ads, no tracking, no profit-incentive.&lt;/p&gt;
&lt;h1 id=&#34;git&#34;&gt;Git&lt;/h1&gt;
&lt;p&gt;I&amp;rsquo;d recommend version controlling the relevant files for your website using &lt;a href=&#34;https://git-scm.com/&#34;&gt;Git&lt;/a&gt;, and hosting the files somewhere publicly accessible. For example, the files for this website are hosted on &lt;a href=&#34;https://github.com/&#34;&gt;GitHub&lt;/a&gt; &lt;a href=&#34;https://github.com/IzaacMammadov/personal_website&#34;&gt;here&lt;/a&gt;. It allows people to easily make pull requests or issues regarding mistakes or out-of-date information. The best personal websites tend to be collaborative efforts.&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>High-Frequency Trading using a Hedging Desk</title>
		<link>https://izaac.mammadov.co.uk/hedging_desk/</link>
		<pubDate>Sun, 19 Nov 2023 20:58:04 +0000</pubDate>
		
		<guid>https://izaac.mammadov.co.uk/hedging_desk/</guid>
		<description>&lt;p&gt;Here is an article I&amp;rsquo;ve written on using a Hedging Desk in Algorthmic Trading. The original PDF Version is available &lt;a href=&#34;https://izaac.mammadov.co.uk/hedging_desk.pdf&#34;&gt;here&lt;/a&gt;, while the (slightly mangled) HTML Version is available below:&lt;/p&gt;
&lt;h1 id=&#34;utility-functions&#34;&gt;Utility Functions&lt;/h1&gt;
&lt;h2 id=&#34;definition&#34;&gt;Definition&lt;/h2&gt;
&lt;p&gt;Different people have different ideas about how much variance they are
willing to accept in their future wealth for higher expected returns.
This is known as their subjective risk-aversion. For example, if forced
to choose between two real random variables $X_1$ or $X_2$ to set their
total wealth equal to, different people, even behaving completely
rationally, may choose different variables. More concretely, if $X_1$ is
a constant equal to 100, and $X_2 \sim \mathcal{N}(110, 20^2)$, a more
risk-averse person would prefer $X_1$, while a less risk-averse person
would prefer $X_2$.&lt;/p&gt;
&lt;p&gt;Risk-aversion seems on the surface very difficult to quantify in a way
that covers all the choices humans may make between any two arbitrary
distributions representing their wealth. Thankfully in their 1947
seminal work, von Neumann and Morgenstern essentially solved this
problem. They proved the von Neumann-Morgenstern utility theorem, which
states that assuming four very weak &amp;ldquo;rationality&amp;rdquo; assumptions, then
every agent (i.e. person, entity or thing making risk-aversion
judgements) has a utility function $U(x)$. Its choices are always based
on maximising $\mathbb{E}(U(X))$ over the different $X$ it can choose
from.[@VON07] In other words, if an agent is behaving rationally and
consistently, then it must have some utility function $U(x)$ and every
choice it makes between different distributions for its wealth must just
be it choosing the distribution $X$ which maximises $\mathbb{E}(U(X))$.&lt;/p&gt;
&lt;p&gt;We can further stipulate that in a choice between two constants, agents
will always choose the larger constant for their wealth. Hence if
$x \geq y$, then $U(x) = \mathbb{E}(U(x)) \geq \mathbb{E}(U(y)) = U(y)$.
In other words, $U$ must be an increasing function. Secondly, we can
stipulate that for the same expected value, agents prefer certainty over
uncertainty, and so they will always prefer their wealth to be a
constant $pa + (1-p)b$, compared to having a probability $p$ of being
$a$ and a probability $1-p$ of being $b$. Thus
$U(pa + (1-p)b) \geq pU(a) + (1-p)U(b)$, which by definition means $U$
must be concave. Assuming $U$ is twice differentiable, we can simplify
these stipulations to just $U&amp;rsquo;(x) \geq 0$ and $U&amp;rsquo;&amp;rsquo;(x) \leq 0$ for all
$x$.&lt;/p&gt;
&lt;h2 id=&#34;common-utility-functions&#34;&gt;Common utility functions&lt;/h2&gt;
&lt;p&gt;Someone with no risk-aversion at all will simply always maximise their
expected value regardless of variance. If expected values are equal,
then they will have no preference between lower or higher variance. This
is represented by the utility function $U(x) \equiv x$. Actually, it can
be represented by any utility function of the form $U(x) \equiv Ax + B$
with $A &amp;gt; 0$ &amp;mdash; these are all equivalent. In general, utility functions
do not change behaviour under addition by a constant and multiplication
by a positive constant, since
$\mathbb{E}(AU(X) + B) = A\mathbb{E}(U(X)) + B$; maximising
$\mathbb{E}(AU(X) + B))$ is the same as maximising $\mathbb{E}(U(X))$.&lt;/p&gt;
&lt;p&gt;The concavity of the utility function at any point represents in some
sense how risk-averse someone is at that level of wealth, and in the
case of $U(x) \equiv x$, indeed $U&amp;rsquo;&amp;rsquo;(x) \equiv 0$. The Arrrow-Pratt
absolute risk-aversion coefficient, meant to encapsulate this idea of
risk-aversion at a certain point, is defined as
$$A_{\text{abs}}(x) := \frac{-U&amp;rsquo;&amp;rsquo;(x)}{U&amp;rsquo;(x)}.$$ [@ARR65][@PRA64]. Note
that the Arrow-Pratt absolute risk-aversion coefficient is invariant
under addition by a constant and multiplication by a positive constant.
There is also the Arrow-Pratt relative risk-aversion coefficient defined
as: $$A_{\text{rel}}(x) := \frac{-xU&amp;rsquo;&amp;rsquo;(x)}{U&amp;rsquo;(x)},$$ which also has the
feature that it is invariant under multiplicaton and addition of the
utility function by a constant, but now is also dimensionless to the
units of $x$ (it doesn&amp;rsquo;t make a difference if wealth is measured in
Dollars, Pounds or Euros).&lt;/p&gt;
&lt;p&gt;If we assume that a utility function has constant absolute risk-aversion
(CARA), then we are forced to have utility functions of the form
$U(x) \equiv -\mathrm{e}^{-cx}$ up to equivalence for some $c &amp;gt; 0$.&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;
If we assume that a utility function has constant relative risk-aversion
(CRRA), then we are forced to have utility functions of the form
$U(x) \equiv \pm x^C$ for some $C \leq 1$,&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt; or $U(x) \equiv \log(x)$
up to equivalence.&lt;/p&gt;
&lt;h2 id=&#34;application-to-high-frequency-trading&#34;&gt;Application to High-Frequency Trading&lt;/h2&gt;
&lt;p&gt;A high-frequency trading firm will have some concept of wealth (which
can be defined to be its total net assets) and will be making
expected-value/variance trade-offs every second. Von Neumann-Morgenstern
states that (if it is being run rationally and consistently), it must be
maximising some expected utility on its total net assets. A common
misconception is that trading firms have no risk-aversion and are only
trying to maximise expected value ($U(x) \equiv x$), however that would
mean that the company should take infinitely sized positive
expected-value bets and never hedge. Unfortunately, without an infinite
balance sheet, this can only end badly.&lt;sup id=&#34;fnref:3&#34;&gt;&lt;a href=&#34;#fn:3&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;p&gt;What that utility function specifically should be can be a decision left
to the stakeholders of the company and all of the discussion below is
applicable to all choices of utility function. However, out of all the
commonly used utility functions, one stands out as being particularly
ubiquitous. That is the CRRA function $U(x) \equiv \log(x)$. It is the
only CARA/CRRA function with the properties of:
$$\lim_{x \to 0} U(x) = -\infty\text{, and } \lim_{x \to \infty} U(x) = \infty.$$
This means that a net assets of 0 should be treated as infinitely bad
(indeed, typically meaning the company has very little future left), and
that the utility is unbounded in the positive direction, meaning there
is always significantly more expected utility to be gained.&lt;/p&gt;
&lt;p&gt;However, utility functions were originally conceptualised to help think
about trades taken over a fixed time period with risky assets being
marked to market at the end of the time period. This is clearly not a
good assumption in high-frequency trading, where trades are taken at any
time, whenever desired. Thus more care needs to be taken in how utility
functions are used which will be decsribed later on.&lt;/p&gt;
&lt;h1 id=&#34;hedging-desk-behaviour&#34;&gt;Hedging Desk Behaviour&lt;/h1&gt;
&lt;h2 id=&#34;definition-1&#34;&gt;Definition&lt;/h2&gt;
&lt;p&gt;We describe a high-frequency trading set-up as follows. There is a
central internal hedging desk which, for every risky asset traded and
for all volumes, quotes an internal bid/ask. Every single high-frequency
making/taking strategy must immediately (market) trade against the
internal hedging desk whenever it receives a net exposure to any risky
asset. A trade&amp;rsquo;s profit can be precisely defined by the net cash flow in
executing a trade including fees and immediately market trading any
exposures against the internal hedging desk. As can be expected, the
goal of a making/taking strategy is to maximise the sum of profits
across all the trades it executes.&lt;/p&gt;
&lt;p&gt;The internal hedging desk, on the other hand, doesn&amp;rsquo;t try to maximise
its own profits. Instead, its purpose is to provide as tight as spreads
as possible to all of the making/taking strategies while ensuring that
it charges enough spread to compensate for the variance in price of the
risky assets that it holds. The internal hedging desk doesn&amp;rsquo;t actually
execute any external trades but merely quotes internal prices in such a
way as to encourage making/taking strategies to make offsetting trades
where appropriate.&lt;/p&gt;
&lt;h2 id=&#34;uncertainty-from-the-strategys-perspective&#34;&gt;Uncertainty from the strategy&amp;rsquo;s perspective&lt;/h2&gt;
&lt;p&gt;The making/taking strategy faces risk with any trade it executes that
the internal hedging desk price may change in the time it takes to
receive notice from the exchange of the trade going through and passing
on the exposure to the heding desk. For a maker trade, this would be the
time between the last point a limit order could&amp;rsquo;ve been cancelled for a
trade not to go through, and the time the hedging desk receives the
trade. For a taker trade, this would simply be the time between sending
the order and the time the hedging desk receives the trade.&lt;/p&gt;
&lt;p&gt;For the sake of simplicity, let us consider a risky asset &lt;code&gt;XYZ&lt;/code&gt;, whose
mid-price follows a geometric Brownian Motion, and so, its mid-price
$M(t)$ is given by the equation
$$M(t) = M_0 \exp\left(\left(\mu - \frac{\sigma^2}{2}\right)t + \sigma B_t\right),$$
where $B_t$ is a Brownian Motion. We can further assume that we are
working in a risk-neutral probability space and so $\mu=0$, giving us
$$M(t) = M_0 \exp\left(-\frac{\sigma^2t}{2} + \sigma B_t\right).$$ Then,
if we say that our internal hedging desk bid for a volume $V$ of &lt;code&gt;XYZ&lt;/code&gt;
at time $t$ is $B(V, t)$. We decompose this bid as follows:
$$B(V, t) = M(t)\mathrm{e}^{-C(V,t)},$$ where $C(V, t)$ is the credits
of the hedging desk bid for volume $V$ and time $t$. If a taker strategy
sends a fill or kill buy for &lt;code&gt;XYZ&lt;/code&gt; at time $t$ for a volume $V$, price
$\pi$, and then the hedging desk receives a confirmation of the trade at
time $t&amp;rsquo;$, the strategy&amp;rsquo;s profit $P$ can be written as follows:
$$\begin{aligned}
P &amp;amp;= V \times (B(V, t&amp;rsquo;) - \pi) \\
&amp;amp;= V \times \left(M(t&amp;rsquo;)\mathrm{e}^{-C(V,t&amp;rsquo;)} - \pi\right) \\
&amp;amp;= V \times \left(M(t&amp;rsquo;)\mathrm{e}^{-C(V,t&amp;rsquo;)} - M(t)\mathrm{e}^{-C(V,t)} + M(t)\mathrm{e}^{-C(V,t)} - \pi\right) \\
&amp;amp;= V \times \left(M(t&amp;rsquo;)\mathrm{e}^{-C(V,t&amp;rsquo;)} - M(t)\mathrm{e}^{-C(V,t)}\right) + P_0,
\end{aligned}$$ where $P_0$ is the profit that the strategy
sees/predicts at the time $t$ (when the taker trade is sent). For the
sake of simplicity, we assume that $C(V, t&amp;rsquo;) = C(V, t)$, which is a fair
assumption if the internal hedging desk doesn&amp;rsquo;t suddenly have
significant changes in &lt;code&gt;XYZ&lt;/code&gt; exposure or predictions around market
volatility in the timeframe between $t$ and $t&amp;rsquo;$. A more detailed
analysis can be done by considering changes in $C(V, t)$ over this short
timeframe. Using this assumption, the profit $P$ becomes
$$\begin{aligned}
P &amp;amp;= V\mathrm{e}^{-C(V,t)}(M(t&amp;rsquo;) - M(t)) + P_0 \\
&amp;amp;= V\mathrm{e}^{-C(V,t)}M(t)\left(\exp\left(-\frac{\sigma^2(t&amp;rsquo;-t)}{2} + \sigma (B_{t&amp;rsquo;}-B_t)\right) - 1\right) + P_0 \\
&amp;amp;= VB(V, t)\left(\exp\left(-\frac{\sigma^2(t&amp;rsquo;-t)}{2} + \sigma\sqrt{t&amp;rsquo;-t}Z\right) - 1\right) + P_0,
\end{aligned}$$ where $Z$ is a standard normal distribution. Thus:
$$
\frac{P-P_0}{VB(V,t)} + 1 \sim \text{Log-Normal}\left(-\frac{\sigma^2(t&amp;rsquo;-t)}{2}, \sigma^2(t&amp;rsquo;-t)\right).$$&lt;/p&gt;
&lt;p&gt;This precisely defines the distribution of profits expected based on the
size of the trade $V$, the initial seen hedging desk bid $B(V, t)$, the
volatility of the underlying asset $\sigma$ and the time taken from
sending the trade to the hedging desk receiving confirmation $t&amp;rsquo;-t$. We
can thus calculate that the following statistics for $P$ at time $t$:
$$\begin{aligned}
\mathbb{E}(P) &amp;amp;= P_0, \\
\text{Var}(P) &amp;amp;= V^2B(V,t)^2\left(\mathrm{e}^{\sigma^2(t&amp;rsquo;-t)} - 1\right).
\end{aligned}$$&lt;/p&gt;
&lt;p&gt;We use this information to figure out if a given trade is worth doing or
not based on a specified utility function and current net-assets. Say
that a trading firm&amp;rsquo;s current net-assets is given by $X_0$. Then the
trade is worth doing, if at time $t$,
$\mathbb{E}(U(X_0 + P)) \geq \mathbb{E}(U(X_0))$. For a log utility
function, that corresponds to: $$\begin{aligned}
\mathbb{E}(\log(X_0 + P)) &amp;amp;\geq \log(X_0) \\
\log(X_0) + \mathbb{E}\left(\log\left(1 + \frac{P}{X_0}\right)\right) &amp;amp;\geq \log(X_0) \\
\mathbb{E}\left(\log\left(1 + \frac{P}{X_0}\right)\right) &amp;amp;\geq 0. \\
\end{aligned}$$ This can be calculated via numerical integration for the
$P$ as specified in the Equation above, to yield a result of whether a trade is worth doing
based on $X_0$, $\sigma$, $t&amp;rsquo;-t$, $P_0$, $VB(V, t)$. In general, we can
see that as $X_0$ grows, we are more willing to do riskier trades so
long as the expected value is positive.&lt;/p&gt;
&lt;p&gt;Note that in this subsection, we have made some key assumptions. These
include, the mid-price being a geometric Brownian Motion with no drift;
constant hedging desk credits between $t$ and $t$; only considering Fill
or Kill orders; knowing $t&amp;rsquo; - t$ before the trade takes place; and most
incorrectly, the lack of any adverse selection. We will work on dropping
or improving these assumptions later on.&lt;/p&gt;
&lt;h2 id=&#34;uncertainty-from-the-hedging-desks-perspective&#34;&gt;Uncertainty from the hedging desk&amp;rsquo;s perspective&lt;/h2&gt;
&lt;p&gt;A hedging desk faces uncertainty from having exposure to risky assets.
The hedging desk only locks in profit after buying a risky asset and
then selling the risky asset or vice versa. In the time between those
trades, it faces exposure to the risky asset. The longer the time is
between the position-increasing trade, and the position-decreasing
trade, the greater the risk it faces. We consider the hedging desk to be
a first-in, first-out (FIFO) queue, where each position-decreasing trade
hedges against the oldest position-increasing trade still in the queue.&lt;/p&gt;
&lt;p&gt;Let us say that our hedging desk currently has a position in &lt;code&gt;XYZ&lt;/code&gt; of
$+A$ (long) and trades the asset &lt;code&gt;XYZ&lt;/code&gt; at a rate $2r$.&lt;sup id=&#34;fnref:4&#34;&gt;&lt;a href=&#34;#fn:4&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;4&lt;/a&gt;&lt;/sup&gt; If we assume
a symmetrical flow of buys and sells, then hedging trades of &lt;code&gt;XYZ&lt;/code&gt; take
place at a rate of $r$. If the hedging desks further buys an extra $V$
amount of &lt;code&gt;XYZ&lt;/code&gt;, then that new trade will take an average time of
approximately $\frac{2A+V}{2r}$ to hedge. That is calculated from the
fact that it must hedge all of its initial $+A$ position (the hedging
desk is a FIFO queue) which takes time $\frac{A}{r}$, and then it begins
hedging the $V$ amount of &lt;code&gt;XYZ&lt;/code&gt; which completes after $\frac{V}{r}$.
Note that the average time to hedge the trade isn&amp;rsquo;t the same as the time
taken to hedge the entire amount $V$, but rather the time taken to hedge
half of the amount $V$. Because it is a FIFO queue, it doesn&amp;rsquo;t matter if
more buy trades take place before hedging has finished, since those
trades will just go behind this one.&lt;/p&gt;
&lt;p&gt;We work out how much credit to charge for hedging this trade $V$ based
on the distribution of $M(t+\frac{2A+V}{2r})$ given by:
$$M\left(t+\frac{2A+V}{2r}\right) = M(t)\exp\left(-\frac{\sigma^2(2A+V)}{4r} + \sigma\sqrt{\frac{2A+V}{2r}}Z\right),$$
where $Z$ is a standard normal variable. We define the profit from the
trade to be as follows: $$\begin{aligned}
P &amp;amp;= V\left(M\left(t + \frac{2A+V}{2r}\right) - \exp(-C(V, t))M(t)\right) \\
P &amp;amp;= VM(t)\left(\exp\left(-\frac{\sigma^2(2A+V)}{4r} + \sigma\sqrt{\frac{2A+V}{2r}}Z\right) - \exp(-C(V, t))\right),
\end{aligned}$$ from which we can calculate the following statistics for
the profit of a hedging desk trade: $$\begin{aligned}
\mathbb{E}(P) &amp;amp;= VM(t)(1 - \exp(-C(V, t))) \\
\text{Var}(P) &amp;amp;= V^2M(t)^2\left(\exp\left(\frac{\sigma^2(2A+V)}{2r}\right) - 1\right).
\end{aligned}$$ As expected, the expected profit increases with larger
credits, and the variance in profit increases with larger initial
position $A$ and volume of trade $V$, while the variance decreases with
larger hedge rate $r$. As before, we can see whether such a trade is
worth doing based on our utility function framework if
$\mathbb{E}(U(X_0 + P)) \geq \mathbb{E}(U(X_0))$, which for a log
utility function corresponds to: $$\begin{aligned}
\mathbb{E}(\log(X_0 + P)) &amp;amp;\geq \log(X_0) \\
\mathbb{E}\left(\log\left(1 + \frac{P}{X_0}\right)\right) &amp;amp;\geq 0,
\end{aligned}$$ which can once again be calculated via numerical
integration. However, in the case of a hedging desk, our goal is to
quote prices as tight as possible without losing expected utility, in
order to best facilitate the strategies&amp;rsquo; trading. Thus, in this case,
$C(V, t)$ should be chosen to force equality in Equation above.&lt;/p&gt;
&lt;p&gt;In this subsection so far, we have only described the statistics around
a position-increasing trade, however, what should we make of a trade
that reduces our risk? Once again, let us assume that our current
position is $+A$ (long) and we make a trade this time to sell $V$
($V \leq A$) units of &lt;code&gt;XYZ&lt;/code&gt; at a price of $M(t)\mathrm{e}^{C(V, t)}$.
The credits $C(V, t)$ should be chosen so that our expected utility is
equal before and after the trade. This leads to the equation:&lt;/p&gt;
&lt;p&gt;$$\begin{aligned}
\mathbb{E}\left(\log\left(X_0 + AM\left(t + \frac{A}{2r}\right)\right)\right) &amp;amp;= \mathbb{E}\left(\log\left(X_0 + VM(t)\mathrm{e}^C +  (A-V)M\left(t + \frac{A-V}{2r}\right)\right)\right) \\
\mathbb{E}\left(\log\left(1 + \frac{A}{X_0}M\left(t + \frac{A}{2r}\right)\right)\right) &amp;amp;= \mathbb{E}\left(\log\left(1 + \frac{V\mathrm{e}^C}{X_0}M(t) + \frac{A-V}{X_0}M\left(t + \frac{A-V}{2r}\right)\right)\right),
\end{aligned}$$&lt;/p&gt;
&lt;p&gt;where $X_0$ is the net assets not including &lt;code&gt;XYZ&lt;/code&gt;, and
$$M(t + \Delta t) = M(t)\exp\left(-\frac{\sigma^2\Delta t}{2} + \sigma\Delta tZ\right),$$
with $Z$ once again a standard normal random variable.&lt;/p&gt;
&lt;p&gt;Note that our expected utility logic naturally discounts the value of
risky assets held by the hedging desk. This creates natural &amp;ldquo;skewing&amp;rdquo;
behaviour whereby if the hedging desk is significantly long a risky
assset, its bids will have large credits, while its offers will have
small or negative credit. And since strategies make trades based on the
prices quoted by the hedging desk, this will lead to strategies
naturally skewing their bids and offers based on the heding desk&amp;rsquo;s
exposure. No extraneous skewing logic needs to be implemented if your
trading is based on proper risk-discounted valuations for risky-assets,
as we have described above.&lt;/p&gt;
&lt;p&gt;Once again, we need to point out important assumptions in the model
described in this subsection. These are the fact that the mid-price is a
geometric Brownian Motion with no drift; hedging takes place at a
constant rate $r$; treating the entire trade volume as being hedged at
its &amp;ldquo;median&amp;rdquo; hedge time; and once again, most incorrectly, no adverse
selection.&lt;/p&gt;
&lt;h1 id=&#34;implementing-expected-utility&#34;&gt;Implementing Expected Utility&lt;/h1&gt;
&lt;h2 id=&#34;taylor-approximations&#34;&gt;Taylor Approximations&lt;/h2&gt;
&lt;p&gt;Above, we&amp;rsquo;ve made passing references to using numerical integration to
work out values for expected utilities. While that is the only way (for
most utility functions) to come to a highly accurate result, in a
high-frequency trading scenario, a much quicker although imprecise
method is necessary. The solution to this is to use Taylor&amp;rsquo;s Theorem to
approximate our utility functions as small order polynomials. The
smaller the size of the trade in question, the more accurate these
approximations will be, and the fewer terms you&amp;rsquo;ll need to still get an
accurate result.&lt;/p&gt;
&lt;p&gt;Specifically focusing on a log utlity function, we often see an
expression of the form
$$\mathbb{E}(\log(X_0 + Y)) = \log(X_0) + \mathbb{E}\left(\log\left(1 + \frac{Y}{X_0}\right)\right),$$
where $Y$ is some random variable involving a trade and $X_0$ is a
constant representing our net assets. The second term on the right hand
side of the Equation above can be Taylor expanded as follows:
$$\begin{aligned}
\mathbb{E}\left(\log\left(1 + \frac{Y}{X_0}\right)\right) &amp;amp;\approx \frac{1}{X_0}\mathbb{E}(Y) + \mathcal{O}\left(\frac{Y^2}{X_0^2}\right) \\
&amp;amp;\approx \frac{1}{X_0}\mathbb{E}(Y) - \frac{1}{2X_0^2}\mathbb{E}\left(Y^2\right) + \mathcal{O}\left(\frac{Y^3}{X_0^3}\right) \\
&amp;amp;= \sum_{i=1}^{\infty}\frac{(-1)^{i+1}}{iX_0^i} \mathbb{E}\left(Y^i\right),
\end{aligned}$$ with convergence if $|Y| &amp;lt; |X_0|$ almost surely.&lt;sup id=&#34;fnref:5&#34;&gt;&lt;a href=&#34;#fn:5&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;5&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;p&gt;The first-order approximation in the Equation above involves only
considering the expected value of $Y$. In general, this is the
justifcation for why many trading-firms see themselves as solely
in the business of maximising expected value
&amp;mdash; that is what they are doing, though only to a first order
approximation. Another way to think about this, is that if you zoom in
close enough to any (differentiable) utility function at any point, it
will just look like a straight line &amp;mdash; no risk-aversion and solely
maximising expected value. The second-order approximation in the Equation
above has the same expected-value term, but now
subtracts that by a variance term. Indeed, the larger the variance is
relative to $X_0$, the greater this risk-discounting effect is. In
general, each term in the Taylor expansion just involve higher and
higher moments of $Y$, which are usually analytically known.&lt;/p&gt;
&lt;h2 id=&#34;defining-net-assets&#34;&gt;Defining &amp;ldquo;net assets&amp;rdquo;&lt;/h2&gt;
&lt;p&gt;Throughout, we&amp;rsquo;ve made reference to this value $X_0$ and defined it as
the net assets of the trading firm at any point in time. In our context,
that is actually an ambiguous definition, since at any point in time, a
company may have exposures to a wide variety of risky assets. The entire
basis of our system involves not marking risky assets to market, but
rather to mark them to their &amp;ldquo;expected utility&amp;rdquo; at the predicted time
that they get hedged. The net assets value should represent the expected
utility of assets if they are diligently passively liquidated, with no
time-pressure, which certainly isn&amp;rsquo;t mark-to-market.&lt;/p&gt;
&lt;p&gt;Based on this rationale, we propose the following definition for $X_0$:
$$X_0 := \exp\left(\mathbb{E}\left(\log\left(\sum_{a \in R} A_a M_a\left(t_a\right)\right)\right)\right),$$
where $R$ is the set of all assets, $A_a$ is the exposure to asset $a$,
$t_a$ is the expected hedge time for the current position in $a$, and
$M_a(\tau)$ is the mid-price of asset $a$ at time $\tau$. Using the
assumptions about hedging rates as in Subsection &amp;ldquo;Hedging Desk Uncertainty&amp;rdquo;
, we see this can be written as:
$$X_0(t) = \exp\left(\mathbb{E}\left(\log\left(\sum_{a \in R} A_a M_a\left(t + \frac{A_a}{2r_a}\right)\right)\right)\right),$$
where $r_a$ is the hedging rate of asset $a$. Further applying the
drift-free Brownian Motion assumption, this turns the equations into:
$$X_0(t) = \exp\left(\mathbb{E}\left(\log\left(\sum_{a \in R} A_a M_a(t)\exp\left(-\frac{A_a\sigma_a^2}{4r_a} + \sigma_a\sqrt{\frac{A_a}{2r_a}}Z\right)\right)\right)\right),$$
where $\sigma_a$ is the volatility of asset $a$ and $Z$ is a standard
normal random variable.&lt;/p&gt;
&lt;p&gt;Note that if our exposure was only to one or more non-risky assets (e.g.
&lt;code&gt;USD&lt;/code&gt; if that is what profit is measured in), then we return to the
conventional definition of net assets being just the sum of all asset
exposures. That is the reason that we need to take the exponential at
the start of the expression. We also note that in all of the discussion
above, the conditions for whether trades were worth making or not are
precisely equivalent to whether the trade increases this specific
definition of $X_0$.&lt;/p&gt;
&lt;h1 id=&#34;assumption-busting&#34;&gt;Assumption Busting&lt;/h1&gt;
&lt;h2 id=&#34;brownian-motion&#34;&gt;Brownian Motion&lt;/h2&gt;
&lt;p&gt;A very natural assumption to bust is the idea that the Brownian Motion
for the mid-price of an asset has constant volatility $\sigma$. Instead,
we can say that the volatility is function of time and so
$$\mathrm{d}M_t = \sigma(t) \mathrm{d}B_t,$$ where
$M$ is the mid-price and $B$ is a standard Brownian Motion (with
volatility 1). This $\sigma(t)$ can be fit in wide variety of ways. For
example, we may try to fit the volatility to periodic functions with
periods over a day (to model how volatility changes at different times
of the day) and over a week (to model how volatility changes on
different different days of the week). The volatility can also be based
on very recent low-latency observations of market-wide and
asset-specific volatility.&lt;/p&gt;
&lt;h2 id=&#34;constants-r-and-t-t&#34;&gt;Constants $r$ and $t&amp;rsquo;-t$&lt;/h2&gt;
&lt;p&gt;The rate at which hedging trades take place clearly isn&amp;rsquo;t constant and
depend on wide variety of factors, including the periodic factors
mentioned for volatility. This can be modelled and fit based on
historical trading. Another factor that will affect rate of hedging $r$
is the amount of inventory of a certain token available. Once we start
running low on inventory, $r$ should rapidly tend towards 0.&lt;/p&gt;
&lt;p&gt;The time between sending an order and the hedging desk hearing a
confirmation has a very large variance. However, again this can be
modelled based on historical data as a log-normal variable. Then for
every expression involving $t&amp;rsquo;-t$, we can simply take the expected value
averaging over the distribution of $t&amp;rsquo; - t$.&lt;/p&gt;
&lt;h2 id=&#34;no-adverse-selection&#34;&gt;No adverse selection&lt;/h2&gt;
&lt;p&gt;In order to model adverse selection, we have to build on top of the
model given in the equation in the &amp;ldquo;Brownian Motion&amp;rdquo; subsection,
by adding a negative drift term and an
increased variance term. Thus in a short period of time immediately
after a trade on a certain exchange $E$, takes place, the mid-price
follows the stochastic process:
$$\mathrm{d}M_t = \mu_E \mathrm{d}t + (\sigma(t) + \kappa_E)\mathrm{d}B_t,$$
where $\mu_E \leq 0$ and $\kappa_E \geq 0$ can be fitted according to
historical observations. In fact, the &amp;ldquo;short period of time&amp;rdquo; description
can also be fitted so that the $\mu_E$ and $\kappa_E$ decay
exponentially to 0 as time after the trade increases, with exponential
half-life $\tau_E$.&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;Not inclding $A_{\text{abs}}(x) \equiv 0$, where $U(x) \equiv x$
up to equivalence&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;
&lt;p&gt;The $\pm$ sign is there to make the function increasing.&amp;#160;&lt;a href=&#34;#fnref:2&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:3&#34;&gt;
&lt;p&gt;cf. Alameda Research.&amp;#160;&lt;a href=&#34;#fnref:3&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:4&#34;&gt;
&lt;p&gt;Trade rate can have units of dollars per hour, for example.&amp;#160;&lt;a href=&#34;#fnref:4&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:5&#34;&gt;
&lt;p&gt;The proof of this statement follows from Fubini&amp;rsquo;s Theorem. The
details are left as an exercise to the reader.&amp;#160;&lt;a href=&#34;#fnref:5&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
	</item>
	
	</channel>
</rss>
