In this task, modifications were made to client3.py
to correct inaccuracies in stock price and ratio calculations. The changes address the following issues:
- Issue 1: Ratio output in the client was always 1.
- Issue 2: Stock prices were identical to bid prices.
- Updated to compute the average price using
(bid_price + ask_price) / 2
for accurate stock pricing.
- Corrected to return the ratio of
price_a
toprice_b
and handle division by zero.
- Implemented a dictionary to store stock prices and used it to correctly calculate and print the stock ratio.
- Verified correct stock prices and ratio calculations.
- Ensured output reflects accurate stock data.