Skip to content

Commit

Permalink
MargPOptimizer: division by zero [v5.1.1]
Browse files Browse the repository at this point in the history
  • Loading branch information
sklbancor committed Aug 27, 2023
1 parent 21dad6c commit 4b3e0d0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fastlane_bot/tools/optimizer/margpoptimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,11 @@ def dtknfromp_f(p, *, islog10=True, asdct=False, quiet=False):

sum_by_tkn = {t: 0 for t in alltokens_s}
for pair, (tknb, tknq) in zip(pairs, pairs_t):
price = get(p, tokens_ix.get(tknb)) / get(p, tokens_ix.get(tknq))
if get(p, tokens_ix.get(tknq)) > 0:
price = get(p, tokens_ix.get(tknb)) / get(p, tokens_ix.get(tknq))
else:
#print(f"[dtknfromp_f] warning: price for {pair} is unknown, using 1 instead")
price = 1
curves = curves_by_pair[pair]
c0 = curves[0]
dxdy = tuple(dxdy_f(c.dxdyfromp_f(price)) for c in curves)
Expand Down

0 comments on commit 4b3e0d0

Please sign in to comment.