create account

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

View this thread on: hive.blogpeakd.comecency.com
· @dhimmel ·
$4.41
A Python notebook to visaulize the price history of any Steem/Hive Engine token
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 `history/marketHistory` endpoint that provides daily price summaries (thanks @dalz for [this info](https://peakd.com/@dalz/q9utsq)).

Since I often want to visualize historical price data, I created a [**Python Jupyter notebook on Google Colab**](https://colab.research.google.com/drive/1bFfEii5QAaJEaHLtBmJVq2ctpQJi2MOw?usp=sharing). The user can choose any token symbol, and the notebook does the rest.

![Notebook cell to create an interactive candlestick plot using plotly](https://files.peakd.com/file/peakd-hive/dhimmel/LSccPCOX-image.png)

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.

![STEEM/HIVEP price history with rescaled axes](https://files.peakd.com/file/peakd-hive/dhimmel/A9axU3jD-steem-hivep-history.png)

We can also plot daily volume:

![](https://files.peakd.com/file/peakd-hive/dhimmel/VmTe7BYe-steem-hivep-volume.png)

Looking forward to anyone building off this code and reusing the notebook, so I released it under the open CC BY License!

## Python code

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.

```
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")
```
👍  , , , , , , , , , , , , , , , , , , , , , , , , ,
👎  
properties (23)
authordhimmel
permlinka-python-notebook-to-visaulize-the-price-history-of-any-steem-hive-engine-token
categoryhive-133987
json_metadata"{"app":"peakd/2020.04.5","format":"markdown","description":"Visualizing the STEEM/HIVEP market exchange rate from Steem Engine using Python, Jupyter, Pandas, and Plotly.","tags":["hive-engine","steem-engine","python","plotly","viz","datascience","finance","hive","pandas"],"users":["dalz"],"links":["https://hive-engine.com","https://steem-engine.com","/@dalz","/@dalz/q9utsq","https://colab.research.google.com/drive/1bFfEii5QAaJEaHLtBmJVq2ctpQJi2MOw?usp=sharing"],"image":["https://files.peakd.com/file/peakd-hive/dhimmel/LSccPCOX-image.png","https://files.peakd.com/file/peakd-hive/dhimmel/A9axU3jD-steem-hivep-history.png","https://files.peakd.com/file/peakd-hive/dhimmel/VmTe7BYe-steem-hivep-volume.png"]}"
created2020-05-05 14:36:03
last_update2020-05-05 14:36:03
depth0
children15
last_payout2020-05-12 14:36:03
cashout_time1969-12-31 23:59:59
total_payout_value2.208 HBD
curator_payout_value2.202 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,986
author_reputation39,788,295,023,882
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,201,147
net_rshares8,477,593,610,245
author_curate_reward""
vote details (27)
@blazing ·
interesting this will be to use and analyze thanks for sharing this one :)
properties (22)
authorblazing
permlinkqa5uj8
categoryhive-133987
json_metadata{"app":"hiveblog/0.1"}
created2020-05-11 09:33:09
last_update2020-05-11 09:33:09
depth1
children0
last_payout2020-05-18 09:33:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length74
author_reputation117,662,220,860,076
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,308,153
net_rshares0
@dalz ·
$1.27
Thanks!

Will play around with this. I'm still a Python amateur. Excel got me :)
👍  
properties (23)
authordalz
permlinkq9v4x3
categoryhive-133987
json_metadata{"app":"hiveblog/0.1"}
created2020-05-05 14:43:54
last_update2020-05-05 14:43:54
depth1
children0
last_payout2020-05-12 14:43:54
cashout_time1969-12-31 23:59:59
total_payout_value0.866 HBD
curator_payout_value0.407 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length80
author_reputation1,956,096,362,572,438
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,201,321
net_rshares3,809,366,930,482
author_curate_reward""
vote details (1)
@dexterdev · (edited)
$2.26
Oh I missed this post :(  
Certainly useful piece of code
👍  
properties (23)
authordexterdev
permlinkqbuwkj
categoryhive-133987
json_metadata{"app":"hiveblog/0.1"}
created2020-06-13 08:50:45
last_update2020-06-13 08:51:09
depth1
children0
last_payout2020-06-20 08:50:45
cashout_time1969-12-31 23:59:59
total_payout_value1.132 HBD
curator_payout_value1.132 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length57
author_reputation17,771,704,061,240
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,936,593
net_rshares6,104,240,976,478
author_curate_reward""
vote details (1)
@dhimmel ·
For some reason this post shows up on hive.blog for me but not @peakd:

- https://hive.blog/hive-133987/@dhimmel/a-python-notebook-to-visaulize-the-price-history-of-any-steem-hive-engine-token
- https://peakd.com/hive-133987/@dhimmel/a-python-notebook-to-visaulize-the-price-history-of-any-steem-hive-engine-token
properties (22)
authordhimmel
permlinkq9v58b
categoryhive-133987
json_metadata{"users":["peakd"],"links":["https://hive.blog/hive-133987/@dhimmel/a-python-notebook-to-visaulize-the-price-history-of-any-steem-hive-engine-token","https://peakd.com/hive-133987/@dhimmel/a-python-notebook-to-visaulize-the-price-history-of-any-steem-hive-engine-token"],"app":"hiveblog/0.1"}
created2020-05-05 14:50:36
last_update2020-05-05 14:50:36
depth1
children2
last_payout2020-05-12 14:50:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length313
author_reputation39,788,295,023,882
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,201,422
net_rshares0
@peakd ·
$1.06
Because of the node you're using... some of them have been fixed and some haven't.
👍  ,
properties (23)
authorpeakd
permlinkre-dhimmel-q9vecf
categoryhive-133987
json_metadata{"tags":["hive-133987"],"app":"peakd/2020.05.1"}
created2020-05-05 18:07:30
last_update2020-05-05 18:07:30
depth2
children1
last_payout2020-05-12 18:07:30
cashout_time1969-12-31 23:59:59
total_payout_value0.776 HBD
curator_payout_value0.280 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length82
author_reputation318,691,979,607,012
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,204,983
net_rshares3,474,929,967,607
author_curate_reward""
vote details (2)
@dhimmel ·
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.
properties (22)
authordhimmel
permlinkre-peakd-q9veii
categoryhive-133987
json_metadata{"tags":["hive-133987"],"app":"peakd/2020.04.5"}
created2020-05-05 18:11:09
last_update2020-05-05 18:11:09
depth3
children0
last_payout2020-05-12 18:11:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length169
author_reputation39,788,295,023,882
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,205,034
net_rshares0
@hertor ·
Thank you very much for this tool, I was still wondering how to do it before but now I found thanks to you.
properties (22)
authorhertor
permlinkq9vap8
categoryhive-133987
json_metadata{"app":"hiveblog/0.1"}
created2020-05-05 16:48:45
last_update2020-05-05 16:48:45
depth1
children0
last_payout2020-05-12 16:48:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length107
author_reputation65,541,492,827
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,203,470
net_rshares0
@hivebuzz ·
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><td>You distributed more than 16000 upvotes. Your next target is to reach 17000 upvotes.</td></tr>
</table>

<sub>_You can view [your badges on your board](https://hivebuzz.me/@dhimmel) and compare to others on the [Ranking](https://hivebuzz.me/ranking)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Do not miss the last post from @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"></a></td><td><a href="/revolution/@hivebuzz/hive-revolution-mission-1">Hive Revolution - Mission 1 - Communication</a></td></tr><tr><td><a href="/revolution/@hivebuzz/hive-revolution-call-for-missions"><img src="https://images.hive.blog/64x128/https://i.imgur.com/PcoHyMJ.jpg"></a></td><td><a href="/revolution/@hivebuzz/hive-revolution-call-for-missions">Hive Revolution - Call for missions</a></td></tr></table>

###### [Vote for us as a witness](https://hivesigner.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more badge and upvotes from us with more power!
properties (22)
authorhivebuzz
permlinkhivebuzz-notify-dhimmel-20200509t221950000z
categoryhive-133987
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2020-05-09 22:19:51
last_update2020-05-09 22:19:51
depth1
children0
last_payout2020-05-16 22:19:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,403
author_reputation369,452,242,276,522
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,283,888
net_rshares0
@lokio ·
Programming will always remain a mystery to me
properties (22)
authorlokio
permlinkq9vbaz
categoryhive-133987
json_metadata{"app":"hiveblog/0.1"}
created2020-05-05 17:01:51
last_update2020-05-05 17:01:51
depth1
children0
last_payout2020-05-12 17:01:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length46
author_reputation307,499,373,139
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,203,708
net_rshares0
@mattsanthonyit ·
Thanks for sharing this with us. Gracias
properties (22)
authormattsanthonyit
permlinkre-dhimmel-qadaqb
categoryhive-133987
json_metadata{"tags":["hive-133987"],"app":"peakd/2020.05.3"}
created2020-05-15 10:06:54
last_update2020-05-15 10:06:54
depth1
children0
last_payout2020-05-22 10:06:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length40
author_reputation1,648,149,400,508,362
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,383,477
net_rshares0
@mattsanthonyit ·
Thanks for sharing this informative article with us 
properties (22)
authormattsanthonyit
permlinkre-dhimmel-qam48d
categoryhive-133987
json_metadata{"tags":["hive-133987"],"app":"peakd/2020.05.3"}
created2020-05-20 04:24:57
last_update2020-05-20 04:24:57
depth1
children0
last_payout2020-05-27 04:24:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length52
author_reputation1,648,149,400,508,362
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,478,649
net_rshares0
@mattsanthonyit ·
Thanks for the update...💯💯💯
properties (22)
authormattsanthonyit
permlinkre-dhimmel-qbobzx
categoryhive-133987
json_metadata{"tags":["hive-133987"],"app":"peakd/2020.05.5"}
created2020-06-09 19:40:48
last_update2020-06-09 19:40:48
depth1
children0
last_payout2020-06-16 19:40:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length27
author_reputation1,648,149,400,508,362
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,869,170
net_rshares0
@phortun · (edited)
$1.71
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.
👍  , ,
properties (23)
authorphortun
permlinkq9v76x
categoryhive-133987
json_metadata{"app":"hiveblog/0.1"}
created2020-05-05 15:33:00
last_update2020-05-05 15:34:54
depth1
children2
last_payout2020-05-12 15:33:00
cashout_time1969-12-31 23:59:59
total_payout_value0.854 HBD
curator_payout_value0.855 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length161
author_reputation1,190,564,733,782,207
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,202,139
net_rshares3,766,745,272,679
author_curate_reward""
vote details (3)
@dhimmel · (edited)
$0.21
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.
👍  
properties (23)
authordhimmel
permlinkq9v8g8
categoryhive-133987
json_metadata{"links":["https://hive.blog/@dhimmel/replies"],"app":"hiveblog/0.1"}
created2020-05-05 16:00:09
last_update2020-05-05 16:01:00
depth2
children1
last_payout2020-05-12 16:00:09
cashout_time1969-12-31 23:59:59
total_payout_value0.104 HBD
curator_payout_value0.105 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length135
author_reputation39,788,295,023,882
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,202,628
net_rshares576,929,261,811
author_curate_reward""
vote details (1)
@phortun ·
$1.10
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.
👍  , ,
properties (23)
authorphortun
permlinkq9v8ss
categoryhive-133987
json_metadata{"app":"hiveblog/0.1"}
created2020-05-05 16:07:42
last_update2020-05-05 16:07:42
depth3
children0
last_payout2020-05-12 16:07:42
cashout_time1969-12-31 23:59:59
total_payout_value0.549 HBD
curator_payout_value0.549 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length163
author_reputation1,190,564,733,782,207
root_title"A Python notebook to visaulize the price history of any Steem/Hive Engine token"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,202,747
net_rshares2,572,212,433,678
author_curate_reward""
vote details (3)