A Custom Strategy That Uses The Baltic Dry Index (BDI) As An Indicator
The Baltic Dry Index (ticker: BDIY Index) provides a benchmark for the price of moving raw materials by sea. It's a composite index for the rates for 'capesize', 'panamax' and 'supramax' vessels that ferry dry bulk commodities. Despite the name, it's not restricted to Baltic Sea countries (it's just reported daily by the Baltic Exchange in London). It takes into account 23 different shipping routes carrying coal, iron ore, grains and many other commodities.
After the '08 financial crisis, some interest was generated in BDI as an economic indicator. This has some merits in theory - the price of shipping can give some idea of the demand for those raw materials, which in turn gives an idea of the confidence of manufacturers using those raw materials and their expected demand for their products. In practice, the 2008/2009 economic downturn was heralded by a precipitous fall in BDIY Index, but since then there has been significant vol in BDI, making its usefulness less certain. My own interest in the predictive power of BDI was rekindled in February of this year when I heard that the demand for shipping to and from Shanghai and Shenzhen (two of the world's largest ports) had fallen massively as a result of the Covid-19 induced lockdown in China. Indeed, on inspection of BDIY Index's history, the size and speed of the fall earlier this year had not been seen since 2008.
To test whether there's a potential investment strategy here, we'll run a preliminary investigation with an extremely simple 'switcher' strategy where if BDI has taken a big hit we'll switch out of equities and into bonds.
Firstly we'll need to import some classes from ALPIMA's quant API library 'pytau', and authenticate our user
Next, we can define our allocation engine: this is what will determine our weights at each rebalance. Our new allocation engine must inherit from the parent class 'AlpimaEngine' and we need to define a 'get_weights' method that returns the rebalance weights.
Now we pass the engine, along with some additional parameters like the observation window, rebalancing frequency and the constituents to the quant API for the strategy calculation. The ALPIMA backend calculates the strategy performance using our custom weights, with customisable fees and rebalancing costs.
We now have a pytau.Strategy object (simple_bdi_drawdown_strategy) with weights and performance history which we can analyse. As an example analysis, I'll get the last five data points for the 30d rolling avg of the daily return
The pytau.Strategy object also comes with some built-in methods to plot the weights and the performance, for example I can plot the strategy against a benchmark with:
The real beauty of the quant API though, comes through the seamless linkage of the strategy on the ALPIMA platform. We can instantly visualise this strategy and explore scenarios:
examine the performance contribution and rolling metrics:
compare this strategy with other strategies and instruments, and much more.
In this brief notebook, we've used some of the functionality of ALPIMA's powerful quant API, Tau, to investigate a simple trading idea, and we've seen how Tau links with the visualisation and analytics of ALPIMA's front-end.
The power of ALPIMA's platform lies in letting you rapidly prototype and experiment with a strategy - now we've defined this custom allocation engine, it would only take a moment to explore different versions of this idea. We can see whether this strategy is robust to different geographies by iterating over different pairs of constituents, or we can apply this methodology to new indicators in the search for strong estimators of future performance.
Contact us at email@example.com to find out more.