Uh oh!
There was an error while loading. Please reload this page.
Conversation
There is btw a similar issue with the following code (set the spreadlend & gaptop to high values to reproduce): # increase limit for currency to get a more accurate response loanOrdersRequestLimit[activeCur] += defaultLoanOrdersRequestLimit log.log( activeCur + ': Not enough offers in response, adjusting request limit to ' + str(loanOrdersRequestLimit[activeCur])) When the end of the loan book is reached, the bot increases the loan book size and effectively repeats the lending function, but ignores the fact that it may already have placed offers (e.g. the first two offers in the spreadLend were placed, then on the third offer we reached the end of the loan book). This causes the bot to attempt to lend out more funds that it has, and raises the API error + sleep timeout issue. |
Evanito
left a comment
There was a problem hiding this comment.
I have personally seen this error in the past, and have not seen it at all since using this PR. Thats enough of a reason to merge it as any.
If a loan offer is taken some time in between the "returnOpenLoanOffers" and "cancelLoanOffer" calls, the attempt to cancel the order will raise an error since it's already taken.
When this happens, the uncaught exception propagates to the main loop and causes the bot to not lend out its funds for as long as sleepTime.
This issue will be more likely to occur the higher the "spreadLend" parameter is.
2016-09-08 15:56:21 Canceling all BTC orders... Loan offer canceled. 2016-09-08 15:56:22 Canceling all BTC orders... Loan offer canceled. 2016-09-08 15:56:22 Canceling all BTC orders... Loan offer canceled. 2016-09-08 15:56:22 Canceling all BTC orders... Loan offer canceled. 2016-09-08 15:56:23 ERROR: Error canceling loan order, or you are not the person who placed it. Traceback (most recent call last): File "lendingbot.py", line 461, in cancelAndLoanAll() File "lendingbot.py", line 290, in cancelAndLoanAll msg = bot.cancelLoanOffer(cur,offer['id']) File "/home/scrawl/Dev/poloniexlendingbot/poloniex.py", line 157, in cancelLoanOffer return self.api_query('cancelLoanOffer',{"currency":currency,"orderNumber":orderNumber}) File "/home/scrawl/Dev/poloniexlendingbot/poloniex.py", line 68, in api_query jsonRet = _read_response(ret) File "/home/scrawl/Dev/poloniexlendingbot/poloniex.py", line 38, in _read_response raise PoloniexApiError(data['error']) PoloniexApiError: Error canceling loan order, or you are not the person who placed it.The fix is to catch exceptions when attempting to cancel orders, and assume the order is already filled if the cancellation fails.