Skip to content

Commit

Permalink
1.3.7.post3
Browse files Browse the repository at this point in the history
  • Loading branch information
DogsTailFarmer committed Oct 9, 2023
1 parent 5fae85a commit 3ec2e51
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 1.3.7.post3 - 2023-10-09
### Fix
* calc_profit_order(): rounding issue when correction tp amount on step_size

### Update
* Up requirements for exchanges-wrapper==1.3.7.post4

## 1.3.7.post2 - 2023-10-05
### Fix
* Fix: Refine exception handling when deleting a grid of orders, one of which is partially filled
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__ = "1.3.7.post2"
__version__ = "1.3.7.post3"
__maintainer__ = "Jerry Fedorenko"
__contact__ = "https://github.com/DogsTailFarmer"

Expand Down
9 changes: 4 additions & 5 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__ = "1.3.7.post2"
__version__ = "1.3.7.post3"
__maintainer__ = "Jerry Fedorenko"
__contact__ = 'https://github.com/DogsTailFarmer'
##################################################################
Expand Down Expand Up @@ -1911,8 +1911,7 @@ def round_truncate(self, _x: Decimal, base: bool = None, fee=False, _rounding=RO
round_pattern = "1.01234567"
else:
round_pattern = self.round_base if base else self.round_quote
xr = _x.quantize(Decimal(round_pattern), rounding=_rounding)
return xr
return _x.quantize(Decimal(round_pattern), rounding=_rounding)

def round_fee(self, fee, amount, base):
return self.round_truncate(fee * amount / 100, base=base, fee=True, _rounding=ROUND_CEILING)
Expand Down Expand Up @@ -2422,9 +2421,9 @@ def calc_profit_order(self, buy_side: bool, by_market: bool = False) -> Dict[str
self.tp_amount = self.sum_amount_first
profit = self.set_profit(self.sum_amount_second, by_market)
target_amount_first = self.sum_amount_first + profit * self.sum_amount_first / 100
target_amount_first = self.round_truncate(target_amount_first, base=True, _rounding=ROUND_FLOOR)
if target_amount_first - self.tp_amount < step_size_f:
target_amount_first = self.tp_amount + step_size_f
target_amount_first = self.round_truncate(target_amount_first, base=True, _rounding=ROUND_FLOOR)
amount = target = target_amount_first
# Calculate depo amount in second
amount_s = self.round_truncate(self.sum_amount_second, base=False, _rounding=ROUND_FLOOR)
Expand All @@ -2435,9 +2434,9 @@ def calc_profit_order(self, buy_side: bool, by_market: bool = False) -> Dict[str
self.tp_amount = self.sum_amount_second
profit = self.set_profit(self.sum_amount_first, by_market)
target_amount_second = self.sum_amount_second + profit * self.sum_amount_second / 100
target_amount_second = self.round_truncate(target_amount_second, base=False, _rounding=ROUND_CEILING)
if target_amount_second - self.tp_amount < step_size_s:
target_amount_second = self.tp_amount + step_size_s
target_amount_second = self.round_truncate(target_amount_second, base=False, _rounding=ROUND_CEILING)
# Calculate depo amount in first
amount = self.round_truncate(self.sum_amount_first, base=True, _rounding=ROUND_FLOOR)
price = f2d(tcm.round_price(float(target_amount_second / amount), RoundingType.CEIL))
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dynamic = ["version", "description"]
requires-python = ">=3.8"

dependencies = [
"exchanges-wrapper==1.3.7.post3",
"exchanges-wrapper==1.3.7.post4",
"margin-strategy-sdk==0.0.11",
"jsonpickle==3.0.2",
"psutil==5.9.5",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exchanges-wrapper==1.3.7.post3
exchanges-wrapper==1.3.7.post4
margin-strategy-sdk==0.0.11
jsonpickle==3.0.2
psutil==5.9.5
Expand Down

0 comments on commit 3ec2e51

Please sign in to comment.