Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Fixed bug in authentication_required; added get_order_status() #15

Merged
merged 2 commits into from
May 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ftx/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,13 @@ def _process_response(response: Response) -> Any:
#
# Authentication required methods
#

def authentication_required(fn):
"""Annotation for methods that require auth."""
def wrapped(self, *args, **kwargs):
if not self._api_key:
raise TypeError("You must be authenticated to use this method")
else:
return fn(self=self, *args, **kwargs)
return fn(self, *args, **kwargs)

return wrapped

Expand All @@ -90,6 +89,10 @@ def get_account_info(self) -> dict:
def get_open_orders(self, market: Optional[str] = None) -> List[dict]:
return self._get('orders', {'market': market})

@authentication_required
def get_order_status(self, existing_order_id: int) -> dict:
return self._get(f'orders/{existing_order_id}')

@authentication_required
def get_order_history(self,
market: Optional[str] = None,
Expand Down