Bitcoin Treasury Charts

In honor of Bitcoin hitting $50,000 for the first time a couple weeks ago, I wanted to share a cool Bitcoin Retool project with you guys that I’ve been working on :slight_smile:

You can check out the project here: https://www.bitcointreasurycharts.com/

Recently, Bitcoin has seen more and more corporate interest, and this will most likely be pivotal to its growth moving forward.

The general sentiment is that, as more companies add Bitcoin to their balance sheets, it’ll create a positive feedback loop - the price of Bitcoin will increase and as it does so, more & more companies will be enticed to buy BTC, further increasing the currency’s price and signaling to other companies that it’s a sound investment. However, having a volatile asset on your balance sheet means potentially increasing the volatility of your stock price. Thus, the general correlation between BTC and a stock price is important for shareholders, and those looking to gain exposure to Bitcoin through these companies, as well as CFOs looking for empirical data about other companies who’ve added BTC to their balance sheet. Additionally, stocks with Bitcoin on their balance sheet can act as an intermediary for those looking to participate in options on Bitcoin.

I couldn’t find any sites that charted theses correlations so I decided to take a stab at it using Retool!

How

1. The Backend setup
Knowing that, I wanted to make this project as dynamic and as quick as possible, I decided to move the calculations and complexity to Google sheets. I chose Google sheets because I knew that I didn’t have that much complex or unstructured data and wanted quick access to it, as I didn’t plan to update it using Retool, nor wanted to faff around with editing more complex databases. I also knew that I could use Google finance equations to chart daily stock prices & have them automatically updated every 20 minutes.


Above is my main sheet - to keep things as quick & neat as possible, this sheet uses sheet references to pull in information from separate sheets (say sheet one more time), each named after one of the companies invested in BTC. My Retool table only pulls in information from this main sheet. This way my front end doesn’t get overloaded with data and my Retool app stays super speedy :cloud_with_lightning: :cloud_with_lightning:

I make use of a pretty common & useful Retool dashboard layout as my front end (see first picture). As mentioned, I use a single Google sheets read query to pull in my main table. When a user selects a row in the table, I use a second query to pull in the associated Sheet by the Companies name. Here is a screenshot of my second query:


Below shows you what it looks like in my Google Sheet tabs. I’ll probs have to change my setup (like changing to an actual DB) when more than ~50 companies add Bitcoin to their balance sheets, but this works for now :slight_smile:

In my first iteration of the app, I pulled in nearly all information (including stock points) in one query which took maybe 9 or 10 seconds to load. This two query strategy shortens it to 1 or 2 seconds and might be helpful in your Retool apps in some fashion if they have a large amount of data.

As for the company pages, I pretty much just dump all of the information that I’d like to have into separate columns. Here is an example below.

For the stock price charts, I use a simple Google Finance formula to display the stocks price for each day since the purchase of Bitcoin: =GOOGLEFINANCE(E2,“price”,L2,TODAY()). The rest of the information I scrounged from the web :slight_smile:. I’m still missing quite a bit, but Retool has enabled me to focus on collecting the data instead of debugging/creating the app.

Using my second query, I pull this information to be used on Retool!

Front End

My Retool app is fundamentally only two components, the table with data about each company and a container to display more details about the selected company. I’ll walk through a couple sections of the front end setup for those that are curious.

Dynamic Plotly Chart
While Retool still advertises their Plotly component as a beta feature, I’ve found that these are some of the most useful components in my apps. To make the chart comparing the selected company’s stock price to BTC while also displaying their purchases, I started with a basic plotly chart, and edited the JSON according to the Plotly Javascript Docs.

Here is my data Tab:

Click to View

[{
x: {{ _.keys(btc.data.bpi) }},
y: {{ _.values(btc.data.bpi) }},
name: ‘BTC:USD’,
type: ‘scatter’,
},{ x: {{dateFormatting.value}},
y: {{yaxis.value}},
name: {{table1.selectedRow.data.Symbol}},
yaxis: ‘y2’,
type: ‘scatter’},{ x: {{dateadded1.value.Date}},
‘y’: {{dateadded1.value.Amt}},
name: “Bitcoin Holding History”,
yaxis: ‘y3’,
type: ‘linear’,mode:“markers”}]

For this to work properly, I had to change the dating format to be the same across the board: I did this in a transformer using moment, a JS library that Retool makes available:> var x = {{companyselecttable1.data.map(d=>d.Date)}}

return x.map((i) => moment(i).format(‘YYYY-MM-DD’))

Here is my Layout Tab

Click to View

Here is my layout tab: “title”: {
“text”: “{{table1.selectedRow.data.CompanyName}} Charts”,
“font”: {
“color”: “#3D3D3D”,
“size”: 16
}
},
“font”: {
“family”: “Inter”,
“color”: “#979797
},
“autosize”:true,
“showlegend”: “true”,
“legend”: {
“xanchor”: “free”,
“x”: 0.45,
“y”: -.2,
“orientation”: “h”
},
“margin”: {
“l”: 60,
“r”: 70,
“t”: 64,
“b”: 32,
“pad”:1
},
“hovermode”: “closest”,
“clickmode”: “select+event”,
“dragmode”: “select”,
“xaxis”: {
“title”: {
“text”: “”,
“standoff”: 16,
“font”: {
“size”: 12
}
},
“type”: “-”,
“tickformat”: “”,
“gridcolor”: “#fff”,
“zerolinecolor”: “#fff
},
“yaxis”: {
“title”: {
“text”: “BTC/USD”,
“standoff”: 6,
“font”: {
“size”: 12
}
},
“showgrid”:false,
“type”: “linear”,
“tickformat”: “”,
“automargin”: true,
“fixedrange”: true,
“zerolinecolor”: “#DEDEDE
},“yaxis2”:{
“title”: {
“text”: “{{table1.selectedRow.data.Symbol}}”,
“standoff”: 6,
“font”: {
“size”: 10
}
},
showgrid:false,
fixedrange:true,
type: “linear”,
tickformat: “”,
zerolinecolor: “#FFA500”,
overlaying: ‘y’,
side: ‘right’,
position: 1
}, “yaxis3”:{
“title”: {
“text”: “BTC Held”,
“standoff”: 10,
“font”: {
“size”: 10
}
},
showgrid:false,
fixedrange:false,
type: “linear”,
tickformat: “”,
zerolinecolor: “#FFA500”,
overlaying: ‘y’,
side: ‘right’,
position:1,
visible : false,
}
}

This was taken all from plotly’s docs - mainly this: https://plotly.com/javascript/multiple-axes/

Key Value Map

This data pulls directly from the table and dynamically changes according to the selected row.

Here is its Data Value:

Click to View

{
“Bitcoin”: {{table1.selectedRow.data.Bitcoin}},
“Percent Bitcoin”: {{table1.selectedRow.data.Percent_BTC}},
“Percent Increase in Value”: {{table1.selectedRow.data.Percent_Increase_In_Value}}, “Today’s Value”: {{table1.selectedRow.data.TodaysValue}}, “Percent of Total BTC”:{{table1.selectedRow.data.Percent_TotalBTC}}, “+/- in Value”: {{table1.selectedRow.data[‘Increase/Decrease In Value’]}}, “Basis Price”: {{table1.selectedRow.data[‘BasisPriceUSD’]}},“Market Cap”:{{table1.selectedRow.data[‘Market Cap’] }}
}

App Tricks

  • Displayed Columns Option - This feature allows users to select the columns they’d like to display in the table. To do this in your own app, you’ll want to add a multiselect component & set the values to be equal to the column names of your table. Next, set each table column to “Dynamically show key” and set the value to be: {{_.includes(multiselectcomponentname.value,“ColumnName”)}}. This makes it so that whenever your column name is selected, it appears in the table- ultimately giving users the ability to show/hide a table’s column.

  • Full Screen - I knew that I wanted the app to be full width so I set a text element to: ".retool-canvas { max-width: none !important; } " - you can check out a post I did about custom CSS HERE and Retool’s CSS post HERE

General Takeaways & Thoughts
All-in-all, what I think this project highlights best is the speed at which you can create apps with Retool. From start to finish this project only took about ~20 hours to make - most of that was collecting data for my app to display. I was also able to create this app using only a limited amount of JavaScript - only fixing small formatting problems or adding references.

As for negatives, the only sticking points I’m finding with my apps is query times and the lack of customization with some pre-made components.

On a different note, I think that Retool could help empower traditional small- to medium-sized companies ,who currently face an increasingly saturated market of software products that are aimed to improve their business and internal processes. The common penny-wise pound-foolish piecemeal approach of uncalculated tech adoption often sees these non-technical companies choosing inappropriate tech solutions, ultimately leading to overly complicated processes and additional cost. When the person who feels the pain is also the one empowered to be a part in building the solution (which low-code environments like Retool enable), I think that unique and extraordinarily powerful tools (and ultimately successful companies) would be the result. As services like Retool keep reducing their learning curve, I feel that more & more non-technical companies will forego these expensive software solutions and just build their own personalized tool based off of their own intuition & needs. If its as easy as plopping a table down, connecting a query and making an action (also not having to navigate someone else’s UI), companies would be silly not to use it. IDK how far we are off from that, but I feel like Retool is a step in the right direction.

I also think that there are a lot of opportunities for different forms of Retool first entrepreneurship outside of the internal tools space.

Hope this quick write up can be of use to somebody!

6 Likes

Wow @JoeyKarczewski this is crazy cool! Nice work :clap:

1 Like

This is just great. Love it, smart design decisions, have been looking at plotly so good to have a ‘reference case’.

Totally agree about the small business angle, whilst it’s tempting for them to use SaaS products like Xero accounting, or Hubspot CRM, they’re often overkill, and then they’re faced with integrating them. In the old days there used to be a breed of independent ‘business developers’ who went around small businesses with a bunch of template MS access databases, and just did some minor tailoring to fit the main problem sets customers had (like, customer database, orders, products, HR, helpdesk, whatever). I think there’s an opportunity for a similar model now with ReTool (and other similar no/low-code platforms), but supercharged by the availability of community driven content, and remote access to a developer network (in the past you were really ‘tied in’ to the one guy who built the stuff, which was part of the appeal from a consultant perspective - you implement basically the same platform at ~50 clients and have a constant stream of minor changes…). Of course you can never escape the basic dynamics of software development, in terms of competing demands for change, QA, infrastructure and platform housekeeping, info sec, technical debt…

Cool stuff.

One thing: your link to the custom CSS HERE and Retool’s CSS post HERE
is broken, could you share?

Thanks

2 Likes

@alex Thanks a bunch!

@domjammoo

Thanks a bunch!!

Great insights - I totally agree with what you said. Building an app on Retool is more accessible, cost effective, transparent and quick compared to its other software solution counterparts - definitely a growing space for a new breed of speedier, low-code independent “business developers”.

Oops sorry must have forgotten to link these: this is the generator I’ve been working on: HERE

This is the Retool CSS post: HERE

1 Like

great - thanks !

Such great points @domjammoo. The growing network of users in digital communities + distributed network of developers is a power combo to glean the business needs that exist in the market... as well as the low-cost viable solutions to address them. I am very excited to see how this space develops!

@JoeyKarczewski this is super cool. I've been aggregating Retool use cases across the user base and this is one of the most unique ones I've seen yet!

1 Like

Ay Thanks @shukla15 !

It was really fun to make & a great exercise in learning how to be creative in Retool. Unfortunately I've been too busy to update it haha

I'm curious - why are you aggregating Retool use cases?

1 Like