Date Format issues with JSON quote feeds

I’m trying to load the following URL:

https://chart.hl.co.uk/charts/chart.jsproto_large.chart?ID_NOTATION=296369819&WIDTH=930&HEIGHT=330&IND_SPACING=36&IND_HEIGHT=130&TIME_SPAN=10Y&ID_NOTATION_COLOR1=25456b&XAXISCLOSECOL=0&XAXISCLOSE_COLORLIST=000099%3B990000%3B009900&HILOW_COLORLIST=5387db%3B5387db%3B&COPYRIGHT_TEXT_COLOR=999999&MOUNTAIN_ALPHA=62&MOUNTAIN_COLOR1=a5b9d8&MOUNTAIN_COLOR2=c1cfe5&MOUNTAIN_COLOR3=c1cfe5&MOUNTAIN_COLOR4=ffffff&TEXT_COLOR=666666&BACKGROUND_COLOR=FFFFFF&SUBSAMPLINGGRANULARITY=DAY&ID_TYPE_SCALE_DATA=1&BENCHMARK_OWN_COORD=1&ID_TYPE_SCALE_AXIS=1&TYPE_CHART=MOUNTAIN&LINE_WIDTH=1&LINE_WIDTH_BENCH=1&NOITNAV=1&DATE_START=&DATE_END=&RETURN_DATA=1

as a JSON quote feed. I’ve set the following:

but as you can see I’m getting

Text ‘1591185600’ could not be parsed at index 0

From the instructions in the UI given this is an epoch date, I shouldn’t need to specify a date format? I had a look at https://github.com/portfolio-performance/portfolio/blob/master/name.abuchen.portfolio/src/name/abuchen/portfolio/online/impl/GenericJSONQuoteFeed.java and it appears to be because the field is defined as a string, rather than a number.

I tried using the ‘dateF’ field in the JSON - which comes in a somewhat crazy format of “Wed Jun 03 10:00:00 PM GMT 2020”. Unfortunately the closest Java date format string I can find is: “EEE MMM dd hh:mm:ss a zzz yyyy” but the DateTimeFormatter chokes on the AM/PM field with hh:mm:ss or HH:mm:ss. Any ideas?

Many thanks

Regarding AM/PM, the strings expected by a depend on the locale. So using a different locale might work.

Maybe it is easier to use onvista?

"NAME_SECURITY":"GROSSBRIT. 20/26

seems to be GB00BL68HJ26

https://www.onvista.de/anleihen/handelsplaetze/GROSSBRIT-20-26-Anleihe-GB00BL68HJ26
https://api.onvista.de/api/v1/instruments/BOND/172983854/eod_history?idNotation=296369819&range=M1&startDate={TODAY:yyyy-MM-dd:-P1M}
$.datetimeLast[*]
$.last[*]

How to handle with onvista is written down in Historische Kurse von onvista nicht mehr lesbar - #78 by chirlu and following posts.

2 Likes

@chirlu, thanks - locale is set to en_GB - I tried just running java code outside of portfolio performance and had the same issue - I suspect it’s a bug/limitation in the Java library.

I’ve actually managed to work around it though. The ‘12:00:00 PM GMT’ portion is unchanging, so I flipped the format to a literal, ie EEE MMM dd '12:00:00 PM GMT' yyyy, so that will do the trick for now!

@ProgFriese, thanks - I hadn’t come across onvista, that’s a good one to have in my back pocket!

1 Like