Skip to content

Commit

Permalink
Fixing timeout in Dukascopy
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedamen committed Apr 4, 2020
1 parent 59845cb commit 5b65bc5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 13 additions & 9 deletions findatapy/market/datavendorweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1343,19 +1343,23 @@ def download_tick(self, market_data_request):
completed = False

for i in range(0, 5):
# Use threading (not multiprocess interface, which has issues with dukascopy download)
pool = SwimPool().create_pool('thread', constants.market_thread_no['dukascopy'])
results = [pool.apply_async(self.fetch_file, args=(time, symbol, do_retrieve_df,)) for time in time_list]

logger.debug("Attempting Dukascopy download " + str(i) + "... ")
tick_list = [p.get(timeout=constants.timeout_downloader['dukascopy']) for p in results]
try:
# Use threading (not multiprocess interface, which has issues with dukascopy download)
pool = SwimPool().create_pool('thread', constants.market_thread_no['dukascopy'])
results = [pool.apply_async(self.fetch_file, args=(time, symbol, do_retrieve_df,)) for time in time_list]

pool.close()
pool.join()
logger.debug("Attempting Dukascopy download " + str(i) + "... ")
tick_list = [p.get(timeout=constants.timeout_downloader['dukascopy']) for p in results]

completed = True
pool.close()
pool.join()

break
completed = True

break
except:
logger.warning("Didn't download on " + str(i) + " attempt... ")

if not(completed):
logger.warning("Failed to download from Dukascopy after several attempts")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
tickers, using configuration files. There is also functionality which is particularly useful for those downloading FX market data."""

setup(name='findatapy',
version='0.1.8',
version='0.1.9',
description='Market data library',
author='Saeed Amen',
author_email='saeed@cuemacro.com',
Expand Down

0 comments on commit 5b65bc5

Please sign in to comment.