I want to use (15 minute delayed) realtime prices to act as a filter for a strategy. However the prices i'd be looking at are not available at my broker, so I want to import them from elsewhere. I have been trying to get this done for days, using several approaches but i simply don't seem able to make it work...
Can this be done using the AssetHistory function? And if so, doesnt this lead to a timing difference if I want to call it "realtime" (as it's delayed by at least 15 minutes vs broker data)?
I tried the following, but it gives me an 058 error (and I also heavily doubt the format parameter is alright)
All help is appreciated!
Thanks!
Code
function run()
{
int Year = 2022;
string URL = strf("https://eodhistoricaldata.com/api/real-time/AAPL.US?api_token=OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX&fmt=json");
string Name = strf("AAPLTESTIMPORT_%04d.t6",Year);
assetSource(Name,URL,0,0,
"[,%t,,price_open,price_high,price_low,price_close,volume_traded,,,");
assetHistory(0,FROM_SOURCE);
}