Often, trading strategies use the current day's highest price of a financial instrument as one of the qualifying conditions before making decisions to place new trades. This data is dynamic in nature as it may change continuously during the live trading hours. This recipe shows how to fetch the current day's highest recorded price of a financial instrument.
Getting ready
Make sure the broker_connection and instrument1 objects are available in your Python namespace. Refer to the Technical requirements section of this chapter to set up broker_connection. Refer to the Attributes of a financial instrument recipe of this chapter to set up instrument1.
How to do it…
Fetch and print the recorded highest price of the day of instrument1:
>>> high_price_day = broker_connection.get_high_price_day(instrument1)
>>> print(f'Highest price today: {high_price_day}')
We get the following output....