Skip to content

Commit

Permalink
ENH: issue scrtlabs#423 - added kucoin in live and support in get_order
Browse files Browse the repository at this point in the history
  • Loading branch information
EmbarAlmog committed Aug 27, 2018
1 parent 3072bc2 commit 578afe8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion catalyst/api.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def cancel_order(order_param, symbol=None, params={}):
Extra parameters to pass to the exchange
"""


def get_orderbook(asset, order_type='all', limit=None):
"""Get the order book of asset.exchange.
Expand All @@ -76,6 +77,7 @@ def get_orderbook(asset, order_type='all', limit=None):
limit : int, optional
"""


def get_open_orders(asset=None):
"""Retrieve all of the current open orders.
Expand Down Expand Up @@ -244,7 +246,7 @@ def get_environment(field='platform'):
"""


def get_order(order_id, asset_or_symbol=None, return_price=False):
def get_order(order_id, asset_or_symbol=None, return_price=False, params={}):
"""Lookup an order based on the order id returned from one of the
order functions.
Expand Down
5 changes: 3 additions & 2 deletions catalyst/exchange/ccxt/ccxt_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
huobipro=ccxt.huobipro,
okex=ccxt.okex,
hitbtc=ccxt.hitbtc2,
kucoin=ccxt.kucoin,
)


Expand Down Expand Up @@ -1150,7 +1151,7 @@ def process_order(self, order):
order.broker_order_id = ', '.join([t['id'] for t in trades])
return transactions

def get_order(self, order_id, asset_or_symbol=None, return_price=False):
def get_order(self, order_id, asset_or_symbol=None, return_price=False, params={}):
"""Lookup an order based on the order id returned from one of the
order functions.
Expand Down Expand Up @@ -1178,7 +1179,7 @@ def get_order(self, order_id, asset_or_symbol=None, return_price=False):
try:
symbol = self.get_symbol(asset_or_symbol) \
if asset_or_symbol is not None else None
order_status = self.api.fetch_order(id=order_id, symbol=symbol)
order_status = self.api.fetch_order(id=order_id, symbol=symbol, params=params)
order, executed_price = self._create_order(order_status)

if return_price:
Expand Down
2 changes: 1 addition & 1 deletion catalyst/exchange/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ def get_open_orders(self, asset):
pass

@abstractmethod
def get_order(self, order_id, symbol_or_asset=None):
def get_order(self, order_id, symbol_or_asset=None, return_price=False, params={}):
"""Lookup an order based on the order id returned from one of the
order functions.
Expand Down
4 changes: 2 additions & 2 deletions catalyst/exchange/exchange_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ def get_open_orders(self, asset=None):
)

@api_method
def get_order(self, order_id, asset_or_symbol=None, return_price=False):
def get_order(self, order_id, asset_or_symbol=None, return_price=False, params={}):
"""Lookup an order based on the order id returned from one of the
order functions.
Expand Down Expand Up @@ -1114,7 +1114,7 @@ def get_order(self, order_id, asset_or_symbol=None, return_price=False):
sleeptime=self.attempts['retry_sleeptime'],
retry_exceptions=(ExchangeRequestError,),
cleanup=lambda: log.warn('Fetching orders again.'),
args=(order_id, asset_or_symbol, return_price)
args=(order_id, asset_or_symbol, return_price, params)
)

@api_method
Expand Down
1 change: 1 addition & 0 deletions docs/source/live-trading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Additionally, we have successfully tested in live mode the following exchanges:
- Huobi Pro, id = ``huobipro``
- OKEX, id = ``okex``
- HitBTC, id = ``hitbtc``
- KuCoin, id = ``kucoin``

As Catalyst is currently in Alpha and is under active development, you are
encouraged to thoroughly test any exchange in *paper trading* mode before trading
Expand Down

0 comments on commit 578afe8

Please sign in to comment.