Skip to content

Commit

Permalink
2.0.0.post2 fix #68
Browse files Browse the repository at this point in the history
  • Loading branch information
DogsTailFarmer committed Nov 24, 2023
1 parent 03cdb1c commit 741a831
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 23 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.0.post2 - 2023-11-24
### Fix
* Exception buffered_orders: 'NoneType' object is not subscriptable #68

## 2.0.0.post1 - 2023-11-23
### Fix
* Fix issue detected by SonarCloud
Expand Down
2 changes: 1 addition & 1 deletion martin_binance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__author__ = "Jerry Fedorenko"
__copyright__ = "Copyright © 2021 Jerry Fedorenko aka VM"
__license__ = "MIT"
__version__ = "2.0.0.post1"
__version__ = "2.0.0.post2"
__maintainer__ = "Jerry Fedorenko"
__contact__ = "https://github.com/DogsTailFarmer"

Expand Down
44 changes: 22 additions & 22 deletions martin_binance/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
__author__ = "Jerry Fedorenko"
__copyright__ = "Copyright © 2021 Jerry Fedorenko aka VM"
__license__ = "MIT"
__version__ = "2.0.0"
__version__ = "2.0.0.post2"
__maintainer__ = "Jerry Fedorenko"
__contact__ = 'https://github.com/DogsTailFarmer'
##################################################################
Expand Down Expand Up @@ -2277,7 +2277,7 @@ def grid_handler(
except AttributeError:
self.message_log("grid_handler: AttributeError raised", LogLevel.WARNING)

if after_full_fill and self.orders_hold and self.order_q_placed:
if after_full_fill and self.orders_hold and self.order_q_placed and not self.grid_remove:
# PLace one hold grid order and remove it from hold list
_, _buy, _amount, _price = self.orders_hold.get_first()
check = (len(self.orders_grid) + len(self.orders_hold)) <= 2
Expand Down Expand Up @@ -2899,26 +2899,26 @@ def on_cancel_order_success(self, order_id: int, cancel_all=False) -> None:
self.part_amount.pop(order_id, None)
self.orders_grid.remove(order_id)
if self.restore_orders:
_order = self.orders_save.get_by_id(order_id)
self.orders_save.remove(order_id)
if self.check_min_amount(amount=_order['amount'], price=_order['price']):
self.orders_hold.orders_list.append(_order)
elif self.orders_save:
_order_saved = list(self.orders_save.get_last())
_order_saved[2] += _order['amount']
self.orders_save.remove(_order_saved[0])
self.orders_save.append_order(*_order_saved)
self.message_log(f"Small restored amount {_order['amount']} was added"
f" to last saved order {_order_saved[0]}", tlg=True)
elif self.orders_hold:
_order_hold = list(self.orders_hold.get_last())
_order_hold[2] += _order['amount']
self.orders_hold.remove(_order_hold[0])
self.orders_hold.append_order(*_order_hold)
self.message_log(f"Small restored amount {_order['amount']} was added"
f" to last held order {_order_hold[0]}", tlg=True)
else:
self.message_log("Too small restore for trade and not saved or held grid for update", tlg=True)
if _order := self.orders_save.get_by_id(order_id):
self.orders_save.remove(order_id)
if self.check_min_amount(amount=_order['amount'], price=_order['price']):
self.orders_hold.orders_list.append(_order)
elif self.orders_save:
_order_saved = list(self.orders_save.get_last())
_order_saved[2] += _order['amount']
self.orders_save.remove(_order_saved[0])
self.orders_save.append_order(*_order_saved)
self.message_log(f"Small restored amount {_order['amount']} was added"
f" to last saved order {_order_saved[0]}", tlg=True)
elif self.orders_hold:
_order_hold = list(self.orders_hold.get_last())
_order_hold[2] += _order['amount']
self.orders_hold.remove(_order_hold[0])
self.orders_hold.append_order(*_order_hold)
self.message_log(f"Small restored amount {_order['amount']} was added"
f" to last held order {_order_hold[0]}", tlg=True)
else:
self.message_log("Too small restore for trade and not saved or held grid for update", tlg=True)
if not self.orders_save:
self.restore_orders = False
self.orders_hold.sort(self.cycle_buy)
Expand Down

0 comments on commit 741a831

Please sign in to comment.