diff --git a/catalyst/examples/mean_reversion_simple.py b/catalyst/examples/mean_reversion_simple.py index db7d5e39..db787612 100644 --- a/catalyst/examples/mean_reversion_simple.py +++ b/catalyst/examples/mean_reversion_simple.py @@ -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() diff --git a/catalyst/exchange/ccxt/ccxt_exchange.py b/catalyst/exchange/ccxt/ccxt_exchange.py index 377c3096..7a118a52 100644 --- a/catalyst/exchange/ccxt/ccxt_exchange.py +++ b/catalyst/exchange/ccxt/ccxt_exchange.py @@ -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')