Replace 'BTC_XXX' with 'XXX/BTC' for pairs and 'XXX_BTC' for files

This commit is contained in:
enenn
2018-02-03 17:15:40 +01:00
parent ebd49cade5
commit f913b57bbe
20 changed files with 170 additions and 171 deletions

View File

@@ -45,6 +45,9 @@ def init(config: dict) -> None:
# TODO add check for a list of supported exchanges
if name not in ccxt.exchanges:
raise OperationalException('Exchange {} is not supported'.format(name))
try:
# exchange_class = Exchanges[name.upper()].value
_API = getattr(ccxt, name.lower())({
@@ -81,7 +84,7 @@ def validate_pairs(pairs: List[str]) -> None:
stake_cur = _CONF['stake_currency']
for pair in pairs:
# Note: ccxt has BaseCurrency/QuoteCurrency format for pairs
pair = pair.replace('_', '/')
# pair = pair.replace('_', '/')
# TODO: add a support for having coins in BTC/USDT format
if not pair.endswith(stake_cur):

View File

@@ -22,7 +22,7 @@ class Exchange(ABC):
def buy(self, pair: str, rate: float, amount: float) -> str:
"""
Places a limit buy order.
:param pair: Pair as str, format: BTC_ETH
:param pair: Pair as str, format: ETH/BTC
:param rate: Rate limit for order
:param amount: The amount to purchase
:return: order_id of the placed buy order
@@ -32,7 +32,7 @@ class Exchange(ABC):
def sell(self, pair: str, rate: float, amount: float) -> str:
"""
Places a limit sell order.
:param pair: Pair as str, format: BTC_ETH
:param pair: Pair as str, format: ETH/BTC
:param rate: Rate limit for order
:param amount: The amount to sell
:return: order_id of the placed sell order
@@ -65,7 +65,7 @@ class Exchange(ABC):
def get_ticker(self, pair: str, refresh: Optional[bool] = True) -> dict:
"""
Gets ticker for given pair.
:param pair: Pair as str, format: BTC_ETC
:param pair: Pair as str, format: ETC/BTC
:param refresh: Shall we query a new value or a cached value is enough
:return: dict, format: {
'bid': float,
@@ -78,7 +78,7 @@ class Exchange(ABC):
def get_ticker_history(self, pair: str, tick_interval: int) -> List[Dict]:
"""
Gets ticker history for given pair.
:param pair: Pair as str, format: BTC_ETC
:param pair: Pair as str, format: ETC/BTC
:param tick_interval: ticker interval in minutes
:return: list, format: [
{
@@ -122,7 +122,7 @@ class Exchange(ABC):
def get_pair_detail_url(self, pair: str) -> str:
"""
Returns the market detail url for the given pair.
:param pair: Pair as str, format: BTC_ETC
:param pair: Pair as str, format: ETC/BTC
:return: URL as str
"""