How to Automate Crypto On-Chain Metric Alerts in Python

Armani Allie
4 min readApr 21, 2021

--

Recently I’ve been learning a lot about crypto-economics as cryptocurrency gains more traction in popularity. I have come across important fundamentals that have become relevant market indicators. Trading these volatile assets can be stressful and I’ve really focused on the idea of optimal buying and selling times on a week to month basis opposed to short term profits throughout the day. In this article I will go over how to automate sending fundamental metrics to your email using Python.

I like to use a cloud platform pythonanywhere.com. They provide a bash console where you can install packages. From there I work on a Jupyter Notebook and start off importing the necessary packages.

The next step is to initiate the coinmetrics class which contains methods that can obtain the market data needed.

The asset I want to focus on Ethereum. I am a big fan of this token and its use case as “digital oil” backing decentralized finance. We initiate this asset with the line:

We can run a method that allows us to see the available datasets CoinMetrics has for Ethereum with the Community tier API. There are more datasets available with a paid subscription called Pro.

We will focus on using ‘CapMrktCurUSD’ & ‘TxTfrValAdjUSD’ to create the NVT Signal. The NVT Signal is a trading indicator based off of the Network Value-to-Transaction Ratio which is used to value tokens and equates stocks Price-to-Earnings Ratio. It is created by dividing the market cap by transaction value. More information about this signal can be read at https://woobull.com/nvt-signal-a-new-trading-indicator-to-pick-tops-and-bottoms/ & https://woobull.com/introducing-nvt-ratio-bitcoins-pe-ratio-use-it-to-detect-bubbles/.

To obtain the data we have to set up the correct starting and ending dates for the method.

The following steps go over setting the coinmetrics method to obtain the market cap data, manipulate the dataset to obtain the current market cap.

Next steps bring in the Transaction Value

The NVT Signal is computed dividing the network value (market cap) by the 90 day Transaction Value.

Email account and email message components is initiated. This required going into Gmail settings to enable authentication.

We can now send our email if the NVT Signal enters our thresholds!

This is one of many useful long term indicators to use in this volatile market. I plan on showcasing other long term indicators such as Network Momentum and Difficulty Ribbon. There are so many other factors that can affect a price in the shorter term such as perpetual futures funding rates, open interest, institutional demand, dollar index, & bitcoin dominance. Stay tuned for more content as I work towards creating a dashboard displaying this useful data!

--

--

Armani Allie

Originally from South Jersey || recent Southern California native || Geospatial Data Science || Crypto Enthusiast