You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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()
outputs
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.
The text was updated successfully, but these errors were encountered:
outputs
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.
The text was updated successfully, but these errors were encountered: