Skip to content

Commit

Permalink
1.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
DogsTailFarmer committed Sep 30, 2023
1 parent 135f755 commit a6cb0b4
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 39 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.3.7 - 2023-09-30
### Update
* Up requirements for exchanges-wrapper==1.3.7.post2

## 1.3.7b1 2023-09-26
### Added for new features
* Save trading (filling orders) and transfer asset history into a file `~/.MartinBinance/log/X_AAABBB.csv`
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.7b2"
__version__ = "1.3.7"
__maintainer__ = "Jerry Fedorenko"
__contact__ = "https://github.com/DogsTailFarmer"

Expand Down
11 changes: 3 additions & 8 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.6.post1"
__version__ = "1.3.7"
__maintainer__ = "Jerry Fedorenko"
__contact__ = 'https://github.com/DogsTailFarmer'
##################################################################
Expand Down Expand Up @@ -3450,7 +3450,7 @@ def on_place_order_error_string(self, place_order_id: int, error: str) -> None:
if order:
self.message_log(f"Order {place_order_id} placed", tlg=True)
self.on_place_order_success(place_order_id, order)
elif 'FAILED_PRECONDITION' not in error:
else:
self.message_log(f"Trying place order {place_order_id} one more time", tlg=True)
if self.orders_init.exist(place_order_id):
_order = self.orders_init.get_by_id(place_order_id)
Expand All @@ -3466,12 +3466,7 @@ def on_place_order_error_string(self, place_order_id: int, error: str) -> None:
elif place_order_id == self.tp_wait_id:
self.tp_wait_id = None
self.tp_error = True
else:
self.message_log(f"Order {place_order_id} can't be placed. Check it manually", LogLevel.ERROR, tlg=True)
if self.orders_init.exist(place_order_id):
self.orders_init.remove(place_order_id)
elif place_order_id == self.tp_wait_id:
self.tp_wait_id = None


def on_cancel_order_success(self, order_id: int, canceled_order: Order, cancel_all=False) -> None: # noqa
if order_id == self.cancel_grid_order_id:
Expand Down
49 changes: 25 additions & 24 deletions martin_binance/margin_wrapper.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.7b2"
__version__ = "1.3.7"
__maintainer__ = "Jerry Fedorenko"
__contact__ = "https://github.com/DogsTailFarmer"

Expand All @@ -21,9 +21,8 @@
import pandas as pd
import shutil
import psutil
import aiofiles
import csv

from aiocsv import AsyncWriter
from colorama import init as color_init
from decimal import Decimal, ROUND_FLOOR
from pathlib import Path
Expand Down Expand Up @@ -549,6 +548,8 @@ def place_limit_order(self, buy: bool, amount: Decimal, price: Decimal) -> int:
color=ms.Style.B_YELLOW)
loop.create_task(place_limit_order_timeout(cls.order_id))
loop.create_task(create_limit_order(cls.order_id, buy, any2str(amount), any2str(price)))
if cls.exchange == 'huobi':
time.sleep(0.02)
return cls.order_id

def get_buffered_completed_trades(self, _get_all_trades: bool = False) -> List[PrivateTrade]:
Expand Down Expand Up @@ -621,28 +622,28 @@ def transfer_to_master(symbol: str, amount: str):
async def save_to_csv() -> None:
cls = StrategyBase
file_name = Path(ms.LOG_PATH, f"{ms.ID_EXCHANGE}_{ms.SYMBOL}.csv")
async with aiofiles.open(file_name, mode="a", encoding="utf-8", newline="") as afp:
writer = AsyncWriter(afp, dialect="unix")
await writer.writerow(["TRADE",
"transaction_time",
"side",
"order_id",
"client_order_id",
"trade_id",
"order_quantity",
"order_price",
"cumulative_filled_quantity",
"quote_asset_transacted",
"last_executed_quantity",
"last_executed_price",
])
await writer.writerow(['TRANSFER',
"event_time",
"asset",
"balance_delta",
])
with open(file_name, mode="a", buffering=1) as fp:
writer = csv.writer(fp)
writer.writerow(["TRADE",
"transaction_time",
"side",
"order_id",
"client_order_id",
"trade_id",
"order_quantity",
"order_price",
"cumulative_filled_quantity",
"quote_asset_transacted",
"last_executed_quantity",
"last_executed_price",
])
writer.writerow(['TRANSFER',
"event_time",
"asset",
"balance_delta",
])
while cls.strategy:
await writer.writerow(await save_trade_queue.get())
writer.writerow(await save_trade_queue.get())
save_trade_queue.task_done()


Expand Down
4 changes: 1 addition & 3 deletions 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.post1",
"exchanges-wrapper==1.3.7.post2",
"margin-strategy-sdk==0.0.11",
"jsonpickle==3.0.2",
"psutil==5.9.5",
Expand All @@ -33,8 +33,6 @@ dependencies = [
"inquirer==3.1.3",
"scikit-learn~=1.3.1",
"tqdm==4.66.1",
"aiofiles~=23.2.1",
"aiocsv~=1.2.4",
]

[tool.flit.module]
Expand Down
4 changes: 1 addition & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exchanges-wrapper==1.3.7.post1
exchanges-wrapper==1.3.7.post2
margin-strategy-sdk==0.0.11
jsonpickle==3.0.2
psutil==5.9.5
Expand All @@ -14,5 +14,3 @@ future==0.18.3
inquirer==3.1.3
scikit-learn~=1.3.1
tqdm==4.66.1
aiofiles~=23.2.1
aiocsv~=1.2.4

0 comments on commit a6cb0b4

Please sign in to comment.