Develop a plan and adhere to it.

Crypto for dummies in Coda

Greed is detrimental.

Christiaan Huizer

--

Like many, I’ve been watching the cryptocurrency world, particularly Bitcoin, with a mix of curiosity and skepticism for years. For a long time, it felt like gambling, something I steered clear of. Then, a while ago, I decided to dip my toes in, but with a firm commitment to investing, not gambling. The key difference, as I see it, lies in managing expectations and ego. A gambler believes they can predict the market, boasting about their supposed ability to time the perfect entry and exit. An investor, on the other hand, acknowledges the inherent risks and focuses on long-term growth. They accept that intuition plays a role, but that decisions should be grounded in a sound, if partially subjective, strategy.

This post explores how to develop code that supports a disciplined investment policy, moving beyond the thrill of the gamble to a more calculated approach, doc here.

After selecting a cryptocurrency, I establish a target growth expectation — perhaps doubling, tripling, or quadrupling its value. This highlights the difference between a gambler and an investor. A gambler waits for that specific target to be achieved. An investor, understanding the risk of unmet expectations, acts differently. I incorporate a margin of safety, especially on the upside (the focus here for simplicity). In this post, I’ll share some Coda suggestions for developing your own plan

This is my second attempt at this blog post. My initial, straightforward solution used SumProduct() applied to the uncorrected values, based on a spreadsheet example.

a simple but failed solution

Although similar to typical crypto spreadsheet practices, it didn’t accurately represent profit-taking. Applying percentages to unadjusted amounts led to incorrect calculations. For example, withdrawing 10% from 2000 tokens (assuming one token equals one dollar) leaves 1800, not 2000, as shown in many spreadsheets I reviewed.

the excel logic I reproduced in coda as example

An alternative — and in my opinion also a better — calculation follows a slightly different approach. Imagine you begin with 1,000 tokens, initially worth €1 each, and your goal is to sell them in stages, reaching a final price of €5 per token. The strategy is to sell a percentage of your remaining tokens at each price point. First, when the tokens reach €2 each, you sell 10% (100 tokens), leaving you with 900 tokens and generating €200. You now have €200 plus the remaining tokens’ value (€900 * €2 = €1,800). Next, at €3 per token, you sell 20% of your remaining 900 tokens (180 tokens), yielding €540 (€180 * €3). You’re left with 720 tokens. At €4 per token, you sell 30% of the 720 tokens (216 tokens), for a total of €864 (€216 * €4). This leaves 504 tokens. Finally, you sell these remaining 504 tokens at €5 each, earning €2,520. Summing the proceeds from each sale (€200 + €540 + €864 + €2,520), the total is €4,124.

The discrepancy in results might seem negligible with smaller trading volumes. However, with larger volumes, such as 10,000 instead of 1,000, the difference becomes significant.

I’ve created two solutions for the same challenge, both achieving the same result. I’ll demonstrate the simpler one. I’ll skip explaining how a button adds rows to a table based on a multiplier (e.g., 5 rows for a multiplier of 5, 3 rows for 3, and 10 rows for 10) and focus on the receiving table’s behavior.

Our set up:

the set up we start with

First, I apply a filter to create a list of percentages. This list is then used in our product() function for the multiplication.

using a filter to only take the matching percentages

We use this code to calculate the remaining tokens after taking profit. The percentages are inverted by subtracting each from 1. For example, 1–0% = 1, 1–10% = 90%, 1–20% = 80%, and so on. This result is then multiplied by the investment amount of $1000 (or €1000) for each row.

the tokens we still have after taking profit

Next, we link the remaining tokens to the multiplier. Our proposed logic simulates an investor’s approach. Upon reaching the first multiplier (2x), 10% of the margin is withdrawn, along with 10% of the tokens sold to achieve that margin. This leaves us with 10% less than the initial amount. Similarly, at level 3, when 20% is withdrawn, it’s 20% of the remaining 90%. The product() function efficiently handles this calculation.

getting the value after the profit taking and the multiplier

We now have a value of 2520 in our last row. This will be used in our final step, as we plan to sell all tokens when the 5x multiplier is reached. This target is crucial and influences our calculations.

getting all the margin

As shown, if the multiplier is the highest (determined using the Max() function), we multiply the remaining tokens (504) by the highest multiplier value (5). Otherwise, we subtract the tokens remaining after applying the multiplier from the value calculated in the previous step.

General technical comment

The code snippets omitted a crucial element for project cohesion. I utilize a “created on” date filter. I initially overlooked this, but it’s an important addition when creating your own setup. Example below on profit:

apply a criterium to keep your project together via a filter

What is next?

We now have a straightforward approach (I hope this post has made it clear) that can be a valuable tool for tracking investments. There’s much more to discuss regarding smart trading setups in Coda, but unfortunately, I won’t have time to cover everything.

I recommend anyone venturing into cryptocurrency trading to establish a similar logic. Greed is prevalent but rarely beneficial. While reaching the 5x multiplier won’t yield $5000, this approach ensures some profit even if levels 4 or 5 aren’t reached. Instead of potentially losing everything, we secure some returns.

Hopefully, this post has shed some light on this common Coda challenge and empowered you to create more interactive and insightful data experiences. On a personal note, creating these in-depth posts takes a lot of time and effort. While I love sharing my knowledge, a little support goes a long way. If you found this helpful, what about a donation or sharing this post with your fellow Coda enthusiasts? Every bit of encouragement helps!

My name is Christiaan, and I regularly blog about Coda. While this article is free, my professional services (including consultations) are not, but I’m always happy to chat and explore potential solutions. You can find my free contributions in the Coda Community and on X. The Coda Community is a fantastic resource for free insights, especially when you share a sample doc.

--

--

Christiaan Huizer
Christiaan Huizer

Written by Christiaan Huizer

I write about how to Coda . You find blogs for beginners and experienced makers. I publish about 1 / week. Welcome!

No responses yet