replace get_open_oders() with get_order() and add property for fee

This commit is contained in:
gcarq
2017-11-01 00:13:23 +01:00
parent 4a35676794
commit 9b9d0250f7
3 changed files with 48 additions and 34 deletions

View File

@@ -1,5 +1,5 @@
from abc import ABC, abstractmethod
from typing import List, Optional
from typing import List, Optional, Dict
import arrow
@@ -13,6 +13,14 @@ class Exchange(ABC):
"""
return self.__class__.__name__
@property
def fee(self) -> float:
"""
Fee for placing an order
:return: percentage in float
"""
return 0.0
@property
@abstractmethod
def sleep_time(self) -> float:
@@ -100,6 +108,22 @@ class Exchange(ABC):
}
"""
def get_order(self, order_id: str) -> Dict:
"""
Get order details for the given order_id.
:param order_id: ID as str
:return: dict, format: {
'id': str,
'type': str,
'pair': str,
'opened': str ISO 8601 datetime,
'closed': str ISO 8601 datetime,
'rate': float,
'amount': float,
'remaining': int
}
"""
@abstractmethod
def cancel_order(self, order_id: str) -> None:
"""
@@ -108,24 +132,6 @@ class Exchange(ABC):
:return: None
"""
@abstractmethod
def get_open_orders(self, pair: str) -> List[dict]:
"""
Gets all open orders for given pair.
:param pair: Pair as str, format: BTC_ETC
:return: List of dicts, format: [
{
'id': str,
'type': str,
'opened': datetime,
'rate': float,
'amount': float,
'remaining': int,
},
...
]
"""
@abstractmethod
def get_pair_detail_url(self, pair: str) -> str:
"""