Skip to content

Commit

Permalink
3.0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
DogsTailFarmer committed Aug 13, 2024
1 parent 0258b68 commit c6e77ec
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 3.0.12 - 2024-08-13
### Fix
* Calculating`self.reverse_price` before immediately starting Reverse cycle also. It can be used later in
`on_balance_update_ex`
* `on_balance_update_ex`: initial balance update logic

## 3.0.11 - 2024-07-13
### Added new features
* [Maintaining a supply of BNB in sub-account to pay fees](https://github.com/DogsTailFarmer/martin-binance/wiki/How-it's-work#maintaining-a-supply-of-bnb-in-a-sub-account-to-pay-fees)
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__ = "3.0.11"
__version__ = "3.0.12"
__maintainer__ = "Jerry Fedorenko"
__contact__ = "https://github.com/DogsTailFarmer"

Expand Down
18 changes: 8 additions & 10 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__ = "3.0.11"
__version__ = "3.0.12"
__maintainer__ = "Jerry Fedorenko"
__contact__ = 'https://github.com/DogsTailFarmer'
##################################################################
Expand Down Expand Up @@ -1825,13 +1825,13 @@ def reverse_after_grid_ending(self):
self.message_log(f"For Reverse cycle set target return amount: {self.reverse_target_amount}"
f" with profit: {tp.get('profit')}%", color=Style.B_WHITE)
self.debug_output()
self.reverse_price = self.get_buffered_ticker().last_price
if (self.cycle_buy and trend_down) or (not self.cycle_buy and trend_up):
self.message_log('Start reverse cycle', tlg=True)
self.reverse = True
self.command = 'stop' if REVERSE_STOP else None
else:
self.message_log('Hold reverse cycle', color=Style.B_WHITE)
self.reverse_price = self.get_buffered_ticker().last_price
self.reverse_hold = True
self.place_profit_order()
if not self.reverse_hold:
Expand Down Expand Up @@ -2281,10 +2281,10 @@ def on_balance_update_ex(self, balance: Dict) -> None:
if delta > 0:
self.shift_grid_threshold = None
deposit_add = self.round_truncate(delta * self.avg_rate, base=False)
self.deposit_second += deposit_add
if self.reverse:
profit = (self.reverse_target_amount - self.reverse_init_amount) / self.reverse_init_amount
self.deposit_first += delta
self.deposit_second += deposit_add
self.initial_reverse_second += deposit_add
self.reverse_init_amount += delta
self.reverse_target_amount = self.round_truncate(
Expand All @@ -2293,13 +2293,12 @@ def on_balance_update_ex(self, balance: Dict) -> None:
_rounding=ROUND_CEILING
)
else:
self.deposit_second += deposit_add
self.initial_second += deposit_add

self.update_sum_amount(-delta, -deposit_add)
self.place_profit_order()

self.initial_first += delta
else:
self.initial_first += delta
else:
if asset == self.f_currency:
restart = True
Expand Down Expand Up @@ -2331,9 +2330,9 @@ def on_balance_update_ex(self, balance: Dict) -> None:
if delta > 0:
self.shift_grid_threshold = None
deposit_add = self.round_truncate(delta / self.avg_rate, base=True)
self.deposit_first += deposit_add
if self.reverse:
profit = (self.reverse_target_amount - self.reverse_init_amount) / self.reverse_init_amount
self.deposit_first += deposit_add
self.deposit_second += delta
self.initial_reverse_first += deposit_add
self.reverse_init_amount += delta
Expand All @@ -2343,13 +2342,12 @@ def on_balance_update_ex(self, balance: Dict) -> None:
_rounding=ROUND_CEILING
)
else:
self.deposit_first += deposit_add
self.initial_first += deposit_add

self.update_sum_amount(-deposit_add, -delta)
self.place_profit_order()

self.initial_second += delta
else:
self.initial_second += delta

self.debug_output()

Expand Down

0 comments on commit c6e77ec

Please sign in to comment.