Skip to content

.change field is wrong for some symbols when running after hours #55

@Beliavsky

Description

@Beliavsky

The .change field is wrong for some symbols when running the program after hours, returning the last stock price. For example, on Sunday evening, running

from datetime import datetime
from wallstreet import Stock, Call, Put

print("time:", datetime.now().strftime("%A, %Y-%m-%d %H:%M:%S"))
for symbol in ["SPY", "AAPL"]:
    s = Stock(symbol)
    print("\nsymbol:", symbol)
    print("s.price:", s.price)
    print("s.change:", s.change)
    print("s.last_trade:", s.last_trade)

gave

time: Sunday, 2025-01-26 19:38:53

symbol: SPY
s.price: 607.97
s.change: -1.7800293
s.last_trade: 24 Jan 2025 21:00:00

symbol: AAPL
s.price: 222.78
s.change: 222.78
s.last_trade: 24 Jan 2025 21:00:01

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions