Skip to content

Commit

Permalink
Minor improvement for Euronext downloader to pass tests successfully
Browse files Browse the repository at this point in the history
  • Loading branch information
titov-vv committed Apr 6, 2024
1 parent f544fb9 commit be2484b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion jal/net/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def YahooFRA_Downloader(self, asset, currency_id, start_timestamp, end_timestamp

# noinspection PyMethodMayBeStatic
def Euronext_DataReader(self, asset, currency_id, start_timestamp, end_timestamp):
params = {'format': 'csv', 'decimal_separator': '.', 'date_form': 'd/m/Y', 'op': '', 'adjusted': '',
params = {'format': 'csv', 'decimal_separator': '.', 'date_form': 'd/m/Y', 'op': '', 'adjusted': 'N',
'base100': '', 'startdate': datetime.utcfromtimestamp(start_timestamp).strftime('%Y-%m-%d'),
'enddate': datetime.utcfromtimestamp(end_timestamp).strftime('%Y-%m-%d')}
suffix = "ETFP" if asset.type() == PredefinedAsset.ETF else "XPAR" # Dates don't work for ETFP due to glitch on their site
Expand All @@ -441,6 +441,8 @@ def Euronext_DataReader(self, asset, currency_id, start_timestamp, end_timestamp
except ParserError:
return None
data['Date'] = pd.to_datetime(data['Date'], format="%d/%m/%Y")
data = data[data.Date >= datetime.utcfromtimestamp(start_timestamp)] # There is a bug on Euronext side - it returns full set regardless of date
data = data[data.Date <= datetime.utcfromtimestamp(end_timestamp)]
data['Close'] = data['Close'].apply(Decimal)
data = data.drop(columns=['Open', 'High', 'Low', 'Last', 'Number of Shares', 'Number of Trades', 'Turnover', 'vwap'],
errors='ignore') # Ignore errors as some columns might be missing
Expand Down

0 comments on commit be2484b

Please sign in to comment.