Posts

HeyStack progress! - 17th December

avatar of @miniature-tiger
25
@miniature-tiger
·
0 views
·
3 min read

Well, this was supposed to be an update for the second week of December but delays, delays, delays and here we are on Thursday. So what have I been working on?

Coin price storage

I get all the crypto price data I need for HeyStack from CoinGecko. It has a pretty comprehensive API, although all I really need are price histories and current prices for the coins that a user has traded or currently holds in their portfolio.

To date I have been loading in all this price data each time I launch HeyStack. But in this update I overhauled all the coin price code and finally got around to storing the historic price data in an indexedDB database (the same kind of system that holds the imported trade data and Hive transaction data). So that's a big step forwards!

At the moment I'm just using daily data but at some point I will probably extend to hourly data for the previous week. I also pull in the current prices.

Now each time HeyStack is opened it will:

  • Check whether it has all the daily data it needs for the user - this will be the case if it's the same day - and extract this stored data from the database.
  • Fetch from CoinGecko any historic daily data that is missing in the database - for example if HeyStack is opened again after a few days.
  • Combine the two sets of data above to produce complete daily price histories.
  • Fetch the current prices from CoinGecko.
  • Apply these prices to the current user coin balances and historic coin balances (and wherever else they are needed).

The best place to see this is on the Stacks page, which is the user's portfolio summary page. This page combines the trade data from exchanges and the transaction data from Hive to produce overall portfolio information:

The data here is from my miniature-tiger account for Hive transactions combined with a couple of fabricated exchange deposits and trades to bring in some other coins.

So the current prices are applied in the current portfolio table (still getting used to BTC above 20k!):

While the daily prices are used in the historic portfolio chart (to the moon!):

Getting the current prices into the end of the historic chart was much faff.

Profit and Loss

The other item I worked on over this couple of weeks was a new profit and loss chart. This was much easier to set up - it just tracks the change in the overall portfolio value from one day to the next. Still, it's a good place to start thinking on how to break down all the income and realised gains and unrealised gains. Lots to do there - but in the future, after the first version of HeyStack is complete.

Looks like this. Lots of profits this week!

Roadmap

I still need to do this!

But anyway the next thing is to sort out is the Steem balances. I no longer have the 5k Steem the portfolio table suggests. I have about 1k floating about.

The Steem balances are currently generated from the Hive transaction data up to the Hive-blockchain-creation-HF. However there's no Steem data loaded for transactions after this HF. So HeyStack doesn't know that I sold it. I'll work on that next week!

### What is HeyStack?

HeyStack is a Hive-orientated crypto portfolio tracker project. It was my entry to the STEMGeeks Hackathon that took place back in the spring. I am still working on it. Note to self - if it's a two week contest, choose a project that takes two weeks to build.

There are many crypto portfolio trackers out there but none of them allow for the multitude of complexities that arise from the Hive blockchain. The aim of HeyStack is thus to provide Hive users with their own tailor-made system.

This will combine all the elements that you would expect from a typical portfolio tracker:

  • Coin balances and holdings breakdown;
  • Portfolio growth over time;
  • Trade histories;
  • Realised / unrealised gains and losses; and
  • Pretty charts.

But also all the financial transactions peculiar to Hive:

  • Author and curation rewards;
  • Transfers;
  • Power ups and downs;
  • Trades, conversions etc.

Posted with STEMGeeks