pycryptobot
pycryptobot copied to clipboard
UnboundLocalError("local variable 'margin_text' referenced before assignment")
Varaible margin_text is not assigned but it is used sometimes.
Probably here: https://github.com/whittlem/pycryptobot/blob/main/pycryptobot.py#L1092 python goes in to elif before margin_text is assigned (before state.last_action == "BUY") throwing exception.
Simply declaring default function-level variable margin_text will get rid of the issue.
i have defined like this to solve this issue.
####Added Margin_text 1116 if state.last_buy_size > 0: 1117 margin_text = truncate(margin) + "%" 1118 else: 1119 margin_text = "0%"