Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Price graph #2

Closed
miohtama opened this issue Sep 23, 2016 · 0 comments
Closed

Price graph #2

miohtama opened this issue Sep 23, 2016 · 0 comments

Comments

@miohtama
Copy link
Contributor

miohtama commented Sep 23, 2016

Here is Python Jupyter notebook I used to plot the crowdsale 1ST:ETH price to verify it matches given terms and conditions by emulating price() function in Python:

screen shot 2016-09-23 at 17 26 01

Note that there is slight duration in the end block numbers, as hour exact dates.

It matches what you claim here https://firstblood.io/sale/index.html#

Code:

import matplotlib
import matplotlib.pyplot as plt
import numpy as np

blocks_per_second = 12/60
startBlock = 1000
endBlock = startBlock + 24*3600*30 * blocks_per_second  # 30 days, 12/60 blocks per

print(endBlock, int(endBlock))

endBlock = int(endBlock)

def price(block_number):

        if (block_number>=startBlock and block_number<startBlock+250):
            return 170 #power hour

        if (block_number<startBlock or block_number>endBlock):
            return 100 #default price
        return 100 + 4*(endBlock - block_number)//(endBlock - startBlock + 1)*67//4 #crowdsale price

print("Start block {}, end block {}".format(startBlock, endBlock))
# Step one day at a time
x = range(startBlock - 10000, endBlock + 10000, 249)
y = []
for xx in x:
    p = price(xx)
    assert type(p) == int
    y.append(p)
    if xx % 100 == 0:
        minutes = (xx-startBlock*60/12)
        print("Price at {} ({} minutes) is {} ETH".format(xx, minutes, p))

line, = plt.plot(x, y, "--", linewidth=2)

plt.ylim(0,200)
plt.show()
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant