Skip to content

Commit

Permalink
1.4.14
Browse files Browse the repository at this point in the history
  • Loading branch information
DogsTailFarmer committed Feb 19, 2024
1 parent 0b6772f commit c34b7dc
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 29 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.4.14 2024-02-19
### Fix
* Exception in fetch_order: 'KeyError': 'commission'
* `fetch_order_trade_list()`: variables type inconsistent
* HTX: correcting order Status depending on cumulative_filled_quantity

## 1.4.13 2024-02-18
### Fix
* `FetchOrder()`: conditions for generating a trading event(s)
Expand Down
2 changes: 1 addition & 1 deletion exchanges_wrapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
__contact__ = "https://github.com/DogsTailFarmer"
__email__ = "jerry.fedorenko@yahoo.com"
__credits__ = ["https://github.com/DanyaSWorlD"]
__version__ = "1.4.13"
__version__ = "1.4.14"

from pathlib import Path
import shutil
Expand Down
7 changes: 2 additions & 5 deletions exchanges_wrapper/bybit_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,14 +516,11 @@ def order_trade_list(res: [], order_id: str) -> []:
"price": price,
"qty": str(qty),
"quoteQty": quote_qty,
"commission": str(fee) if fee else '0',
"commissionAsset": trade['currency'] if fee else '',
"time": int(trade['transactionTime']),
"isBuyer": trade['side'] == 'Buy',
"isMaker": True,
"isBestMatch": True,
}

if fee:
trade_rows[trade_id]["commission"] = str(fee)
trade_rows[trade_id]["commissionAsset"] = str(trade['currency'])

return list(trade_rows.values())
26 changes: 13 additions & 13 deletions exchanges_wrapper/huobi_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,10 @@ def on_order_update(_order: {}) -> {}:
#
if event.get('orderStatus') in ('canceled', 'partial-canceled'):
status = 'CANCELED'
elif event.get('orderStatus') == 'partial-filled':
status = 'PARTIALLY_FILLED'
elif event.get('orderStatus') == 'filled':
elif event.get('orderStatus') == 'filled' and cumulative_filled_quantity >= Decimal(order_quantity):
status = 'FILLED'
elif event.get('orderStatus') == 'partial-filled' or cumulative_filled_quantity > 0:
status = 'PARTIALLY_FILLED'
else:
status = 'NEW'
return {
Expand Down Expand Up @@ -445,22 +445,22 @@ def on_order_update(_order: {}) -> {}:
def account_trade_list(res: []) -> []:
binance_trade_list = []
for trade in res:
price = trade.get('price')
qty = trade.get('filled-amount')
price = trade['price']
qty = trade['filled-amount']
quote_qty = str(Decimal(price) * Decimal(qty))
binance_trade = {
"symbol": trade.get('symbol').upper(),
"id": trade.get('trade-id'),
"orderId": trade.get('order-id'),
"symbol": trade['symbol'].upper(),
"id": trade['trade-id'],
"orderId": int(trade['order-id']),
"orderListId": -1,
"price": price,
"qty": qty,
"quoteQty": quote_qty,
"commission": trade.get('filled-fees'),
"commissionAsset": trade.get('fee-currency'),
"time": trade.get('created-at'),
"isBuyer": 'buy' in trade.get('type'),
"isMaker": trade.get('role') == 'maker',
"commission": trade['filled-fees'],
"commissionAsset": trade['fee-currency'],
"time": trade['created-at'],
"isBuyer": 'buy' in trade['type'],
"isMaker": trade['role'] == 'maker',
"isBestMatch": True,
}
binance_trade_list.append(binance_trade)
Expand Down
20 changes: 10 additions & 10 deletions exchanges_wrapper/okx_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,22 +508,22 @@ def funding_wallet(res: []) -> []:
def order_trade_list(res: []) -> []:
binance_trade_list = []
for trade in res:
price = trade.get('fillPx')
qty = trade.get('fillSz')
price = trade['fillPx']
qty = trade['fillSz']
quote_qty = str(Decimal(price) * Decimal(qty))
binance_trade = {
"symbol": trade.get('instId').replace('-', ''),
"id": trade.get('tradeId'),
"orderId": trade.get('ordId'),
"symbol": trade['instId'].replace('-', ''),
"id": int(trade['tradeId']),
"orderId": int(trade['ordId']),
"orderListId": -1,
"price": price,
"qty": qty,
"quoteQty": quote_qty,
"commission": str(abs(float(trade.get('fee')))),
"commissionAsset": trade.get('feeCcy'),
"time": trade.get('ts'),
"isBuyer": trade.get('side') == 'buy',
"isMaker": trade.get('execType') == 'M',
"commission": str(abs(float(trade['fee']))),
"commissionAsset": trade['feeCcy'],
"time": trade['ts'],
"isBuyer": trade['side'] == 'buy',
"isMaker": trade['execType'] == 'M',
"isBestMatch": True,
}
binance_trade_list.append(binance_trade)
Expand Down

0 comments on commit c34b7dc

Please sign in to comment.