A Python notebook to visaulize the price history of any Steem/Hive Engine token

in Hive Statistics5 years ago

history/marketHistorythis info).One feature that I haven't seen available at https://hive-engine.com or https://steem-engine.com is how to view historical market price charts for a token. Ironically, while working on this post, I started seeing the candlestick plots on Steem Engine. Nonetheless, the APIs have a endpoint that provides daily price summaries (thanks @dalz for

<p dir="auto">Since I often want to visualize historical price data, I created a <a href="https://colab.research.google.com/drive/1bFfEii5QAaJEaHLtBmJVq2ctpQJi2MOw?usp=sharing" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link"><strong>Python Jupyter notebook on Google Colab. The user can choose any token symbol, and the notebook does the rest. <p dir="auto"><img src="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/dhimmel/LSccPCOX-image.png" alt="Notebook cell to create an interactive candlestick plot using plotly" srcset="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/dhimmel/LSccPCOX-image.png 1x, https://images.hive.blog/1536x0/https://files.peakd.com/file/peakd-hive/dhimmel/LSccPCOX-image.png 2x" /> <p dir="auto">Since the figures are created using Plotly, they're interactive. For example, you can zoom in to reduce the y-axis to trading following the initial HIVEP volatility. <p dir="auto"><img src="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/dhimmel/A9axU3jD-steem-hivep-history.png" alt="STEEM/HIVEP price history with rescaled axes" srcset="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/dhimmel/A9axU3jD-steem-hivep-history.png 1x, https://images.hive.blog/1536x0/https://files.peakd.com/file/peakd-hive/dhimmel/A9axU3jD-steem-hivep-history.png 2x" /> <p dir="auto">We can also plot daily volume: <p dir="auto"><img src="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/dhimmel/VmTe7BYe-steem-hivep-volume.png" srcset="https://images.hive.blog/768x0/https://files.peakd.com/file/peakd-hive/dhimmel/VmTe7BYe-steem-hivep-volume.png 1x, https://images.hive.blog/1536x0/https://files.peakd.com/file/peakd-hive/dhimmel/VmTe7BYe-steem-hivep-volume.png 2x" /> <p dir="auto">Looking forward to anyone building off this code and reusing the notebook, so I released it under the open CC BY License! <h2>Python code <p dir="auto">Programming in Python is lot's of fun, since you can accomplish a lot with little code. For example, here's a snippet of just the code to retrieve the market history data and transform it into a dataframe (tabular data structure) and convert the dates to a more human-friendly encoding. <pre><code>symbol = "HIVEP" url = "https://api.steem-engine.com/history/marketHistory" response = requests.get(url, params=dict(symbol=symbol)) response.raise_for_status() market_history_df = pandas.json_normalize(response.json()) market_history_df.timestamp = pandas.to_datetime(market_history_df.timestamp, unit="s")
Sort:  

Oh I missed this post :(
Certainly useful piece of code

All Greek to me to be honest but I am sure you just created something cool and useful :)

Btw hive.blog has been buggy too today... Probably all Hive front ends.

Yeah, now I'm not even seeing this post on hive.blog. But I can see your comment at https://hive.blog/@dhimmel/replies and reply to it.

Yeah. It looks like the front ends kind of got stuck in a 5 hour old time loop and they now randomly switch between the loop and the actual reality :) Interesting.

Thanks!

Will play around with this. I'm still a Python amateur. Excel got me :)

Because of the node you're using... some of them have been fixed and some haven't.

Makes sense! Are there any posts or GitHub/GitLab issues or pull requests about the bug? I'm always interested in learning about why the blockchain / APIs malfunctioned.

Thank you very much for this tool, I was still wondering how to do it before but now I found thanks to you.

Programming will always remain a mystery to me

Congratulations @dhimmel! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

<table><tr><td><img src="https://images.hive.blog/60x70/http://hivebuzz.me/@dhimmel/upvotes.png?202005092209" /><td>You distributed more than 16000 upvotes. Your next target is to reach 17000 upvotes. <p dir="auto"><sub><em>You can view <a href="https://hivebuzz.me/@dhimmel" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">your badges on your board and compare to others on the <a href="https://hivebuzz.me/ranking" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Ranking<br /> <sub><em>If you no longer want to receive notifications, reply to this comment with the word <code>STOP <p dir="auto"><strong><span>Do not miss the last post from <a href="/@hivebuzz">@hivebuzz: <table><tr><td><a href="/revolution/@hivebuzz/hive-revolution-mission-1"><img src="https://images.hive.blog/64x128/https://i.imgur.com/76uSoLw.png" /><td><a href="/revolution/@hivebuzz/hive-revolution-mission-1">Hive Revolution - Mission 1 - Communication<tr><td><a href="/revolution/@hivebuzz/hive-revolution-call-for-missions"><img src="https://images.hive.blog/64x128/https://i.imgur.com/PcoHyMJ.jpg" /><td><a href="/revolution/@hivebuzz/hive-revolution-call-for-missions">Hive Revolution - Call for missions <h6><a href="https://hivesigner.com/sign/account-witness-vote?witness=steemitboard&approve=1" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Vote for us as a witness to get one more badge and upvotes from us with more power!

interesting this will be to use and analyze thanks for sharing this one :)

Thanks for sharing this with us. Gracias

Thanks for sharing this informative article with us

Thanks for the update...💯💯💯