Posts

First-Principles Derivation of A Bank

What is a Bank? A bank borrows money from people with money but low-risk appetite, and lends money to people who need money to take potentially rewarding risks. Say we live in a toy society with $10 in circulation and 2 people (a farmer and a cook). In this society, the farmer grows vegetables and the cook processes vegetables for food – both activities essential for survival. Assume that both parties start with $5 each. The farmer sells vegetables for $1 per serving and can produce 2 servings per day. The cook prepares food for $2 per serving and also has the capacity to produce 2 servings per day. Every day, the farmer sells 2 servings of vegetables to the cook for a total of $2 . Then, the cook prepares 2 servings of food and sells 1 serving to the farmer for $2 . In this perfectly balanced society, everybody eats, and money never needs to “rest.” Let's break the above equilibrium by adding a time component. In this society, vegetables take thr...

I'm looking For a Man In Finance... Wait what is Finance?

My girlfriend showed me a music remix of a viral video where a woman says that she is looking for a man in finance who is 6' 5", has blue eyes, and is affiliated with a trust fund. This got me thinking: What does a man in finance do? What is finance even? What service does this "man in finance" provide that this woman needs to access? After some thinking and reading, I've decided to try my hand at explaining what is finance. Finance seems to be the study of how to keep track of who owns what, and a financial system seems to be a system that keeps track of who owns what. In the early prehistoric days, the financial system was quite simple: You own what you can defend. If you thought you owned a nice rock, you kept track of it by holding it and attacking whoever tried to take it. Trading ownership meant handing your rock to another caveman, and simultaneously they would hand you a fish or something you wanted to trade for. These were simple times, but you could onl...

How did modern markets develop? (A Tulip Market Analogy)

I've been interested in how our modern stock markets work for a while now, and recently I've been trying my best to understand all these fancy terms, like "T+1", "clearing firm", "broker-dealer', etc. Here's a situation that I came up with, that helped me understand how markets may have evolved. Imagine you're living in 17th century Amsterdam, and you're looking to buy a lot of tulips. How would you do this? You need to find a seller, you need to know the price. Then, if you choose to buy at that price, you need to sign an agreement to exchange money for tulips at a later date that's convenient for the two of you. Where can you find a seller? You heard there's a tulip market where the tulip buyers and sellers hang out. It runs weekdays from 9:30AM to 4:00PM. There's also a pre-market and a post-market, but there aren't too many people there, so it's a lot less liquid outside of the main hours. This place is called an ...

The Very Basics of Android: Starting Activities

Image
When you click on a link on a webpage to navigate to another webpage, what do you need to tell the backend in order for it to fetch the right page for you? First, you have to tell the backend which page you want to see. Second, you have to tell the backend any extra information it might require. You take these two pieces of information, package them into a nice bundle of data called a URL and send it off to the backend. When we launch an activity, we do a very similar thing. First, we get the name of which activity we want to open. Then we package together any extra information we might need to show this page into a nice bundle. We package these two pieces of information together into an object called an Intent  and then we send it off to the Android OS using the very aptly named `startActivity` command. Here's what an Intent  looks like in code: Intent(context, SearchActivity::class.java) .apply { putExtra("q", "duolingo") } Ignoring the context for now, t...

The Very Basics of Android: Tasks, Activities, and the Backstack

Image
Welcome to The Very Basics of Android ! This series is aimed at folks just starting out on Android, and the goal is by the end of the series, you should be familiar enough with common Android topics to be able to go on to other intro materials. To start, this first article will discuss the terminology we use when talking about the UI of the app: Tasks, Activities, and the Backstack. Go onto your Android phone, and click on the small square button at the bottom of the screen. This screen represents all of the tasks running that you have opened! Here's what it looks like on my screen: As you can see, I most recently opened Duolingo and second most recently opened the calculator app, so I have a Duolingo task as well as a calculator task. Each one of these tasks is just a stack of "webpages", called the backstack . Each one of these "webpages" we call an activity . Here's my artist's rendition of what this looks like: When browsing a webpage, you are clicki...

Reading "The Design of Everyday Things"

Life so far It's been a tough 2022 so far. I'm burned out at work, my grandpa is ill, my old car broke down, etc. Hence the general lack of motivation to write anything. I feel like this year will be learning year for me, where I get my ass handed to me by life, and I come out of it battered but more mature. In this vein of learning, I've been trying to institute a few changes in my life to help alleviate some of the things that are going on in my life. Basically, try to stay in control of my life as much as I can. A few basic ones: Work exactly 8 hours a day and push back on deadlines that would require working more than 8 hours a day. Write every so often. In my blog, in my random notebooks. Keep in contact with family. Keep my girlfriend in the loop about my stresses and struggles (she's a psych major!) Always be learning something new. Let's hope everything works out! *knock on wood* Reading "The Design of Everyday Things" In terms of my goal to always...

Thinking about fuzzy logic and implementing black boxes

Today, Google did a doodle about Dr. Lotfi Zadeh who published a paper that proposed fuzzy logic. It feels like it's been forever since I studied anything that has to do with machine learning so I decided why not, let me learn a bit about this. It turns out, fuzzy logic is actually really applicable to my job (which involves no machine learning at all) not because I need to implement a bunch of ambiguous things on the app (although dealing with ambiguity is a big part of the job) but it proposes a really neat way to think about constructing a black box. First, my understanding of a fuzzy system. It is effectively a black box, with rules that you can configure. You feed in your raw data on one end, it goes through the "fuzzifier", the "inference engine", the "defuzzifier" and some new data emerges from the other end. The core of this box is the inference engine. Basically, this part of the system holds the rules that you and your product folks come up w...