Compare commits

..
2 Commits
2 changed files with 9 additions and 8 deletions
+3 -2
View File
@@ -181,8 +181,9 @@ class PoloniexCurator(object):
our existing TradeHistory until the first transaction our existing TradeHistory until the first transaction
for this currencyPair for this currencyPair
''' '''
try: try:
if( 'end_file' in locals() and end_file + 3600 < end): if(temp is not None
or ('end_file' in locals() and end_file + 3600 < end)):
if (temp is None): if (temp is None):
temp = os.tmpfile() temp = os.tmpfile()
tempcsv = csv.writer(temp) tempcsv = csv.writer(temp)
+6 -6
View File
@@ -63,7 +63,7 @@ class Bitfinex(Exchange):
# Max is 90 but playing it safe # Max is 90 but playing it safe
# https://www.bitfinex.com/posts/188 # https://www.bitfinex.com/posts/188
self.max_requests_per_minute = 80 self.max_requests_per_minute = 9
self.request_cpt = dict() self.request_cpt = dict()
self.bundle = ExchangeBundle(self.name) self.bundle = ExchangeBundle(self.name)
@@ -586,10 +586,9 @@ class Bitfinex(Exchange):
def generate_symbols_json(self, filename=None, source_dates=False): def generate_symbols_json(self, filename=None, source_dates=False):
symbol_map = {} symbol_map = {}
if not source_dates: fn, r = download_exchange_symbols(self.name)
fn, r = download_exchange_symbols(self.name) with open(fn) as data_file:
with open(fn) as data_file: cached_symbols = json.load(data_file)
cached_symbols = json.load(data_file)
response = self._request('symbols', None) response = self._request('symbols', None)
@@ -643,6 +642,7 @@ class Bitfinex(Exchange):
try: try:
self.ask_request() self.ask_request()
time.sleep(60 / self.max_requests_per_minute)
response = requests.get(url) response = requests.get(url)
except Exception as e: except Exception as e:
raise ExchangeRequestError(error=e) raise ExchangeRequestError(error=e)
@@ -654,7 +654,7 @@ class Bitfinex(Exchange):
+/- 31 days +/- 31 days
""" """
if (len(response.json())): if (len(response.json())):
startmonth = response.json()[-1][0] startmonth = int(response.json()[-1][0])
else: else:
startmonth = int((time.time() - 15 * 24 * 3600) * 1000) startmonth = int((time.time() - 15 * 24 * 3600) * 1000)