Skip to content

Commit

Permalink
some error handling and some printing for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
harisang committed May 18, 2023
1 parent baa804d commit 5a69c9a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/monitoring_tests/quasimodo_ebbo_test/quasimodo_ebbo_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ def get_solver_response(
# + "/solve?time_limit=20&use_internal_buffers=false&objective=surplusfeescosts"
# )
# make solution request to quasimodo
solution = requests.post(
quasimodo_response = requests.post(
solver_url, data=bucket_response_json, timeout=30
).json()
)
if quasimodo_response.ok:
solution = quasimodo_response.json()
else:
solution = {}
# return quasimodo solved solution
return solution, order

Expand Down Expand Up @@ -84,6 +88,8 @@ def solve_orders_in_settlement(
order_id = winning_orders[decoded_settlement.trades.index(trade)]["id"]
solver_solution, order = self.get_solver_response(order_id, bucket_response)

log_msg = "Quasimodo response is :" + str(solver_solution)
print(log_msg)
sell_token = order["sell_token"]
buy_token = order["buy_token"]
# if a valid solution is returned by solver
Expand All @@ -98,7 +104,6 @@ def solve_orders_in_settlement(
buy_token_clearing_price,
order_type,
)
print("Done")
print(winning_surplus, quasimodo_surplus)
# TemplateTest.check_flag_condition(
# winning_surplus - quasimodo_surplus,
Expand Down

0 comments on commit 5a69c9a

Please sign in to comment.