Skip to content

Commit d151995

Browse files
committed
removed merge conflicts
2 parents 6d30c28 + 7405e36 commit d151995

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

ranking_client.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,14 @@ def process_ticker(ticker, mongo_client):
6969
try:
7070

7171
current_price = None
72-
73-
while current_price is None:
72+
retries = 0
73+
while current_price is None and retries <= 3:
7474
try:
7575
current_price = get_latest_price(ticker)
7676
except Exception as fetch_error:
7777
logging.warning(f"Error fetching price for {ticker}. Retrying... {fetch_error}")
7878
time.sleep(10)
79+
retries += 1
7980

8081
indicator_tb = mongo_client.IndicatorsDatabase
8182
indicator_collection = indicator_tb.Indicators
@@ -275,13 +276,15 @@ def update_portfolio_values(client):
275276
# Cache should be updated every 60 seconds
276277

277278
current_price = None
278-
while current_price is None:
279+
retries = 0
280+
while current_price is None and retries <= 3:
279281
try:
280282
# get latest price shouldn't cache - we should also do a delay
281283
current_price = get_latest_price(ticker)
282284
except:
283285
print(f"Error fetching price for {ticker}. Retrying...")
284286
time.sleep(120)
287+
retries += 1
285288
# Will sleep 120 seconds before retrying to get latest price
286289
print(f"Current price of {ticker}: {current_price}")
287290
# Calculate the value of the holding

trading_client.py

+9
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,26 @@ def process_ticker(ticker, client, trading_client, data_client, mongo_client, st
9090
try:
9191
decisions_and_quantities = []
9292
current_price = None
93+
<<<<<<< HEAD
9394
count = 0
9495
while current_price is None:
96+
=======
97+
retries = 0
98+
while current_price is None and retries <= 3:
99+
>>>>>>> 7405e36910fffc98319dcd8dd3570b7d0c276822
95100
try:
96101
current_price = get_latest_price(ticker)
97102
except Exception as fetch_error:
98103
count+=1
99104
logging.warning(f"Error fetching price for {ticker}. Retrying... {fetch_error}")
100105
time.sleep(10)
106+
<<<<<<< HEAD
101107
if count == 3:
102108
logging.error(f"Failed to fetch price for {ticker}. Exiting process_ticker function.")
103109
return
110+
=======
111+
retries += 1
112+
>>>>>>> 7405e36910fffc98319dcd8dd3570b7d0c276822
104113
print(f"Current price of {ticker}: {current_price}")
105114

106115
asset_collection = mongo_client.trades.assets_quantities

0 commit comments

Comments
 (0)