Open Fredrik-C opened 3 years ago
Do you mean that your request fails using 1hour parameter? Which endpoint did you use? The following request works for me:
import pandas as pd
tickers = 'AMZN,AAPL,TWTR'
params = {
'access_key': api_key,
'symbols':tickers,
'limit': 1000,
'offset': 0,
'date_from':'2021-03-01',
'interval':'1hour'
}
base = 'http://api.marketstack.com/v1/'
endpoint = 'intraday'
api_result = requests.get(base + endpoint, params)
api_response = api_result.json()
# If needed, for visualization purposes
#output = pd.DataFrame(api_response['data'])
#output = output.pivot_table(values='close', index='date', columns='symbol')
However, i must admit that the results are very strange, half of the data is NaN because there is no clear distinction between trading hours and non trading hours in the data provided (or in the inputs), and the data you eventually receive randomly has multiple identical rows (my latest pull got the exact same prices for TWTR between 1pm and 5pm on 2021-03-01). There is probably a misunderstanding somewhere, but i cannot figure it out with the little documentation we have.
Well, if you notice my "documentation states" snippet above you will see that the documentation states that you should input "1h" but as you mention in your sample code, you input "1hour"
1h != 1hour
Yeah, the "intraday" is a sad story. You do not get any figures for volume which makes it pointless since you can't use "On Balance Volume" or "Money Flow Index" indicators etc...
Documentation states:
interval | [Optional] Specify your preferred data interval. Available values: 1min, 5min, 10min, 15min, 30min, 1h (Default), 3h, 6h, 12h and 24h.
But 1h, 3h etc does not work. You need to supply 1hour, 3hour etc.