Hi Bubbler,
Firstly, is this call even possible with the Bubble API connector?
API document here: API Documentation - Twelve Data
Request example:
https://api.twelvedata.com/complex_data?apikey=your_api_key
–header “Content-Type: application/json”
–request POST
–data ‘{
“symbols”: [“AAPL”, “MSFT”, “GOOG”],
“intervals”: [“5min”, “1day”],
“outputsize”: 25,
“methods”: [
“time_series”,
{
“name”: “ema”,
“time_period”: 12
},
“quote”,
{
“name”: “adx”,
“symbol”: [“MMM”],
“order”: “ASC”
}
]
}’
Use case:
I want to update the prices of a list of stocks, which is a custom datatype.
Stock {
Price:
Ticker:
Exchange:
}
I can run a loop and make individual calls but that may take too long so a better option is to use the “complex” call feature of the API. A complex data call is where we’re sending an array of tickers to the API and it will return data for each ticker. I am only interested in the last price.
The endpoint doesn’t need the exchange specified but I like to include it to make sure the right data is returned.
So the workflow is something like this:
Send list of ticker:exchange to API → API returns a list of datapoints → update the list of stocks with the latest prices.
$50 reward for someone to show me how to do this complex call or setup a demo page that I can copy.
Return example:
{
"data": [
{"meta": {"symbol" : "AAPL", "interval": "5min", ...}, "values": [...], "status": "ok"},
{"meta": {"symbol" : "AAPL", "interval": "1day", ...}, "values": [...], "status": "ok"},
{"meta": {"symbol" : "MSFT", "interval": "5min", ...}, "values": [...], "status": "ok"},
{"meta": {"symbol" : "MSFT", "interval": "1day", ...}, "values": [...], "status": "ok"},
{"meta": {"symbol" : "GOOG", "interval": "5min", ...}, "values": [...], "status": "ok"},
{"meta": {"symbol" : "GOOG", "interval": "1day", ...}, "values": [...], "status": "ok"},
...
{"meta": {"symbol" : "MMM", "interval": "1day", ...}, "values": [...], "status": "ok"}
],
"status": "ok"
}