We’ve been watching the recent three day correction of Bitcoin and reading the boards. There is a lot of fear and doubt, but raw numbers don’t lie.
There’s also a good argument in that one of the best ways to trade an emotional market like cryptocurrencies is to look at the price action. Price reflect attitudes.
We wondered ourselves today if we could use our own Gatsiva API to quickly look at the returns after various correction levels for Bitcoin. While producing this visualization for Twitter, we thought we might want to explain how we did it.
What follows is a quick walkthrough of how to look at the correction points for Bitcoin using Python and the Gatsiva API.
Using Python, we decided to use the Gatsiva return profile API call. This call gives us the returns by period after a condition is true. First we imported a bunch of libraries we will need.
We set up our input data, including an iterator to create range of thresholds we were interested in using numpy.
Next we iterated over our values, dynamically constructing a rule to evaluate and putting the results in our list.
Then, utilizing Plot.ly to render the visualization, we add a color scale, create the plots with the appropriate legends, then plot the result.