Publish0x: ETH Tipping Data Visualization (50/50)

in blurtech •  4 years ago 

5s4dzrwnvbzgj7bkbpx3rcughmbgl25mrsrvrkbr2srtuhe2bxuapwzjypl9a8dypbq7xapikdgwbfaevbbmi5efdywnc2eprzryicbuefnavm8q2crdgukxkkxrthwft4bkxmxjn7fmqh5r3bmyypqyi8fytcdfvjth4ml.jpg
source

On publish0x platform, you can change tipping % so I am going to do 3 visualization.

Publish0x is a ETH tipping blogging platform.
popup.png

  • 20% to author / 80% to me (Result here)
  • 50% to author / 50% to me (This post)
  • 80% to author / 20% to me (Next post)
    to see how ETH tipping value is going to be affected.
    (also BAT and LRC tokens)

1.png
This time I have done, 50% to author / 50% to me for 1 week and see what happened.
I personally hate this % because it is a lot of work to slide up and down to make it 50/50.
It is way too much work to tip a few cents 🙊

Here is the data I have collected and it looks like this 👇

# 50/50
tipping_data = {
    '1': {
        'eth': [0.00003733, 0.00001867, 0.00001867],
        'bat': [0.0468, 0.0117],
        'lrc': [0.0212, 0.0208]
    },
    '2': {
        'eth': [0.00003758, 0.00001879],
        'bat': [0.0128, 0.0128],
        'lrc': [0.0875, 0.0220]
    },
    '3': {
        'eth': [0.00003642, 0.00001831],
        'bat': [0.04969, 0.0117, 0.0117],
        'lrc': [0.0215, 0.0215]
    },
    '4': {
        'eth': [0.00003614, 0.00001807, 0.00001795],
        'bat': [0.0117, 0.0116],
        'lrc': [0.0804]
    },
    '5': {
        'eth': [0.00001679, 0.00001690],
        'bat': [0.0238, 0.0118],
        'lrc': [0.0696, 0.0174, 0.0177]
    },
    '6': {
        'eth': [0.00006639, 0.00001660, 0.00001661, 0.00001661, 0.00001661],
        'bat': [0.0236],
        'lrc': [0.0192]
    },
    '7': {
        'eth': [0.00001537, 0.00001537],
        'bat': [0.0246],
        'lrc': [0.0730, 0.0183, 0.0183, 0.0189]
    },
}

And the feed this data into my python plotly script. Looks like this 👇
2.png

You can also see the graph here.
https://floating-meadow-28045.herokuapp.com/chart-50-50
https://tomoyan.github.io/chart-50-50

Tipping earning avg is about ~$0.05 a day.
1 week Average: $0.056
ETH Average: $0.028
BAT Average: $0.012
LRC Average: $0.016

I am kind of surprised because I thought I would get more BAT or LRC than ETH, but nice to see that ETH is still the top tipping token.

Next week will be 80/20.
Here is my plotly script.

from tip_data import tipping_data
import plotly.graph_objects as go
import requests
import statistics


def get_price(id):
    # Call coingecko API to get usd price
    base_url = 'https://api.coingecko.com/api/v3/simple/price'
    eth_url = '?ids=ethereum&vs_currencies=usd'
    bat_url = '?ids=basic-attention-token&vs_currencies=usd'
    lrc_url = '?ids=loopring&vs_currencies=usd'

    if id == 'ethereum':
        try:
            r = requests.get(base_url + eth_url, timeout=3)
            r.raise_for_status()
        except Exception as err:
            print("Exception Error:", err)
            return 0.0
    elif id == 'basic-attention-token':
        try:
            r = requests.get(base_url + bat_url, timeout=3)
            r.raise_for_status()
        except Exception as err:
            print("Exception Error:", err)
            return 0.0
    elif id == 'loopring':
        try:
            r = requests.get(base_url + lrc_url, timeout=3)
            r.raise_for_status()
        except Exception as err:
            print("Exception Error:", err)
            return 0.0
    else:
        return 0.0

    return r.json()[id]['usd']


def main():
    eth_price = get_price('ethereum')
    bat_price = get_price('basic-attention-token')
    lrc_price = get_price('loopring')

    eth_amount = 0.0
    bat_amout = 0.0
    lrc_amount = 0.0
    days = []
    eth_data = []
    bat_data = []
    lrc_data = []
    total_data = []

    for key in tipping_data:
        eth_amount = f"{sum(tipping_data[key]['eth']) * eth_price:.3f}"
        bat_amout = f"{sum(tipping_data[key]['bat']) * bat_price:.3f}"
        lrc_amount = f"{sum(tipping_data[key]['lrc']) * lrc_price:.3f}"

        days.append('Data ' + key)
        eth_data.append(eth_amount)
        bat_data.append(bat_amout)
        lrc_data.append(lrc_amount)
        tip_total = float(eth_amount) + float(bat_amout) + float(lrc_amount)
        total_data.append(tip_total)

    avg_total = f"${statistics.mean(total_data):.3f}"
    print(avg_total)

    eth_data = list(map(float, eth_data))
    avg_eth = f"${statistics.mean(eth_data):.3f}"
    print('AVG_ETH: ' + avg_eth)

    bat_data = list(map(float, bat_data))
    avg_bat = f"${statistics.mean(bat_data):.3f}"
    print('AVG_BAT: ' + avg_bat)

    lrc_data = list(map(float, lrc_data))
    avg_lrc = f"${statistics.mean(lrc_data):.3f}"
    print('AVG_LRC: ' + avg_lrc)

    # Daily tipping bar chart
    fig = go.Figure(data=[
        go.Bar(name='BAT', x=days, y=bat_data),
        go.Bar(name='ETH', x=days, y=eth_data),
        go.Bar(name='LRC', x=days, y=lrc_data)],
        layout_title_text=f"""
        Publish0x Tip 50% Author 50% Me Earning Avg: {avg_total}
        """
    )
    fig.update_traces(texttemplate='%{y:.3f}', textposition='outside')

    fig.add_trace(
        go.Scatter(
            name='Tip Total',
            x=days,
            y=total_data
        )
    )

    # Change the bar mode
    fig.update_layout(
        # barmode='stack',
        xaxis_title="Tip Data",
        yaxis_title="$ Amount",
        legend_title="Crypto Tips",
    )
    # fig.write_html('chart-20-80.html', auto_open=True)
    fig.write_html('chart-50-50.html', auto_open=True)
    fig.show()


if __name__ == '__main__':
    main()


Get Rewarded For Browsing! Are you Brave?

happy tears
➡️ Website
➡️ Twitter

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE BLURT!