mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-21 12:30:16 +08:00
BUG: for issue #183, added more logic to catch order amount adjustments
This commit is contained in:
@@ -37,8 +37,8 @@ def initialize(context):
|
||||
context.base_price = None
|
||||
context.current_day = None
|
||||
|
||||
context.RSI_OVERSOLD = 55
|
||||
context.RSI_OVERBOUGHT = 60
|
||||
context.RSI_OVERSOLD = 40
|
||||
context.RSI_OVERBOUGHT = 50
|
||||
context.CANDLE_SIZE = '15T'
|
||||
|
||||
context.start_time = time.time()
|
||||
|
||||
@@ -798,13 +798,21 @@ class CCXT(Exchange):
|
||||
)
|
||||
raise ExchangeRequestError(error=e)
|
||||
|
||||
exchange_amount = None
|
||||
if 'amount' in result and result['amount'] != adj_amount:
|
||||
exchange_amount = result['amount']
|
||||
|
||||
elif 'info' in result:
|
||||
if 'origQty' in result['info']:
|
||||
exchange_amount = float(result['info']['origQty'])
|
||||
|
||||
if exchange_amount:
|
||||
log.info(
|
||||
'order amount adjusted by {} from {} to {}'.format(
|
||||
self.name, adj_amount, result['amount']
|
||||
self.name, adj_amount, exchange_amount
|
||||
)
|
||||
)
|
||||
adj_amount = result['amount']
|
||||
adj_amount = exchange_amount
|
||||
|
||||
if 'info' not in result:
|
||||
raise ValueError('cannot use order without info attribute')
|
||||
|
||||
Reference in New Issue
Block a user