drop minimum_date from get_ticker_history

This commit is contained in:
gcarq 2017-11-06 00:06:59 +01:00
parent 60e651cb4c
commit 810f2f9243
4 changed files with 9 additions and 17 deletions

View File

@ -81,8 +81,7 @@ def analyze_ticker(pair: str) -> DataFrame:
add several TA indicators and buy signal to it add several TA indicators and buy signal to it
:return DataFrame with ticker data and indicator data :return DataFrame with ticker data and indicator data
""" """
minimum_date = arrow.utcnow().shift(hours=-24) data = get_ticker_history(pair)
data = get_ticker_history(pair, minimum_date)
dataframe = parse_ticker_dataframe(data) dataframe = parse_ticker_dataframe(data)
if dataframe.empty: if dataframe.empty:

View File

@ -96,8 +96,8 @@ def get_ticker(pair: str) -> dict:
return _API.get_ticker(pair) return _API.get_ticker(pair)
def get_ticker_history(pair: str, minimum_date: arrow.Arrow) -> List: def get_ticker_history(pair: str) -> List:
return _API.get_ticker_history(pair, minimum_date) return _API.get_ticker_history(pair)
def cancel_order(order_id: str) -> None: def cancel_order(order_id: str) -> None:

View File

@ -1,7 +1,6 @@
import logging import logging
from typing import List, Optional, Dict from typing import List, Dict
import arrow
import requests import requests
from bittrex.bittrex import Bittrex as _Bittrex from bittrex.bittrex import Bittrex as _Bittrex
@ -87,7 +86,7 @@ class Bittrex(Exchange):
'last': float(data['result']['Last']), 'last': float(data['result']['Last']),
} }
def get_ticker_history(self, pair: str, minimum_date: Optional[arrow.Arrow] = None): def get_ticker_history(self, pair: str):
url = self.TICKER_METHOD url = self.TICKER_METHOD
headers = { headers = {
# TODO: Set as global setting # TODO: Set as global setting
@ -96,15 +95,12 @@ class Bittrex(Exchange):
params = { params = {
'marketName': pair.replace('_', '-'), 'marketName': pair.replace('_', '-'),
'tickInterval': self.TICKER_INTERVAL, 'tickInterval': self.TICKER_INTERVAL,
# TODO: Timestamp has no effect on API response
'_': minimum_date.timestamp * 1000
} }
data = requests.get(url, params=params, headers=headers).json() data = requests.get(url, params=params, headers=headers).json()
if not data['success']: if not data['success']:
raise RuntimeError('{message} params=({pair}, {minimum_date})'.format( raise RuntimeError('{message} params=({pair})'.format(
message=data['message'], message=data['message'],
pair=pair, pair=pair))
minimum_date=minimum_date))
return data['result'] return data['result']
def get_order(self, order_id: str) -> Dict: def get_order(self, order_id: str) -> Dict:

View File

@ -1,7 +1,5 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from typing import List, Optional, Dict from typing import List, Dict
import arrow
class Exchange(ABC): class Exchange(ABC):
@ -85,11 +83,10 @@ class Exchange(ABC):
""" """
@abstractmethod @abstractmethod
def get_ticker_history(self, pair: str, minimum_date: Optional[arrow.Arrow] = None) -> List: def get_ticker_history(self, pair: str) -> List:
""" """
Gets ticker history for given pair. Gets ticker history for given pair.
:param pair: Pair as str, format: BTC_ETC :param pair: Pair as str, format: BTC_ETC
:param minimum_date: Minimum date (optional)
:return: list, format: [ :return: list, format: [
{ {
'O': float, (Open) 'O': float, (Open)