update buy

This commit is contained in:
gcarq 2017-10-13 21:47:49 +02:00
parent 93b729a5d5
commit 20b432c73d

View File

@ -2,7 +2,8 @@ import logging
from typing import List, Optional, Dict from typing import List, Optional, Dict
import arrow import arrow
from bittrex.bittrex import Bittrex as _Bittrex, API_V2_0 from bittrex.bittrex import Bittrex as _Bittrex, API_V2_0, TICKINTERVAL_FIVEMIN, ORDERTYPE_LIMIT, \
TIMEINEFFECT_GOOD_TIL_CANCELLED
from freqtrade.exchange.interface import Exchange from freqtrade.exchange.interface import Exchange
@ -20,7 +21,7 @@ class Bittrex(Exchange):
BASE_URL: str = 'https://www.bittrex.com' BASE_URL: str = 'https://www.bittrex.com'
PAIR_DETAIL_METHOD: str = BASE_URL + '/Market/Index' PAIR_DETAIL_METHOD: str = BASE_URL + '/Market/Index'
# Ticker inveral # Ticker inveral
TICKER_INTERVAL: str = 'fiveMin' TICKER_INTERVAL: str = TICKINTERVAL_FIVEMIN
# Sleep time to avoid rate limits, used in the main loop # Sleep time to avoid rate limits, used in the main loop
SLEEP_TIME: float = 25 SLEEP_TIME: float = 25
@ -39,10 +40,16 @@ class Bittrex(Exchange):
) )
def buy(self, pair: str, rate: float, amount: float) -> str: def buy(self, pair: str, rate: float, amount: float) -> str:
data = _API.buy_limit(pair.replace('_', '-'), amount, rate) data = _API.trade_buy(
market=pair.replace('_', '-'),
order_type=ORDERTYPE_LIMIT,
quantity=amount,
rate=rate,
time_in_effect=TIMEINEFFECT_GOOD_TIL_CANCELLED,
)
if not data['success']: if not data['success']:
raise RuntimeError('{}: {}'.format(self.name.upper(), data['message'])) raise RuntimeError('{}: {}'.format(self.name.upper(), data['message']))
return data['result']['uuid'] return data['result']['OrderId']
def sell(self, pair: str, rate: float, amount: float) -> str: def sell(self, pair: str, rate: float, amount: float) -> str:
data = _API.sell_limit(pair.replace('_', '-'), amount, rate) data = _API.sell_limit(pair.replace('_', '-'), amount, rate)