using plotille for stock market charts
Opened this issue · 0 comments
pannet1 commented
def tick(min, max, axis=None):
"""
trying to mimic a stock market ticker
"""
if axis == "X":
return datetime.datetime.now().strftime("%H:%M:%S")
else:
min = int(min)
max = 100
return randint(min, max)
def main():
X = []
Y = []
fig = plt.Figure()
fig.plot(X, Y)
fig.set_x_limits(min_=0)
fig.set_y_limits(min_=0, max_=100)
while True:
fig.x_ticks_fkt = partial(tick, axis="X")
fig.y_ticks_fkt = partial(tick)
__import__('time').sleep(1)
print(fig.show())
if __name__ == '__main__':
main()
honestly i was surprised by the end result. i just a have an incoming ticker which has a changing price and datetime.seconds. i want just to append it to the x axis and show the new y value (price of the stock). can you please help me.