Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using plotille for stock market charts #60

Open
pannet1 opened this issue Mar 29, 2024 · 0 comments
Open

using plotille for stock market charts #60

pannet1 opened this issue Mar 29, 2024 · 0 comments

Comments

@pannet1
Copy link

pannet1 commented Mar 29, 2024

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
plotille

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant