Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 552 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Possible to extend assetHistory with own source? #474132
09/24/18 09:01
09/24/18 09:01
Joined: Feb 2017
Posts: 369
D
Dalla Offline OP
Senior Member
Dalla  Offline OP
Senior Member
D

Joined: Feb 2017
Posts: 369
Hi

I was wondering if there is any source code available for the mode functions used by assetHistory, like FROM_AV, FROM_STOOQ etc?

I have an external source from where I would like to download D1 data and it would be great if I could somehow tie that to the existing assetHistory call.

Regards,
Daniel

Re: Possible to extend assetHistory with own source? [Re: Dalla] #474133
09/24/18 09:30
09/24/18 09:30
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
This is possible by downloading it with a script. Example for Google:

Code:
void main()
{
	string MyAsset = "SPY";
	string URL = strf("https://www.google.com/finance/historical?q=%s&startdate=01-Jan-2000&output=csv",MyAsset);
	string Content = http_transfer(URL,0);
	if(!Content) return;
	file_write("History\\history.csv",Content,0);
	dataNew(1,0,7);
	if(!dataParse(1,"%d-%b-%y,f3,f1,f2,f4,f6","History\\history.csv"))
			return;
	dataSave(1,strf("History\\%s.t6",MyAsset));
}


Re: Possible to extend assetHistory with own source? [Re: jcl] #474135
09/24/18 11:45
09/24/18 11:45
Joined: Feb 2017
Posts: 369
D
Dalla Offline OP
Senior Member
Dalla  Offline OP
Senior Member
D

Joined: Feb 2017
Posts: 369
I was hoping to be able to use UpdateDays=-1 after the initial download to avoid downloading the entire history every time, which would take time if I have a universe of ~ 200 stocks.

I guess I could use dataLoad and dataVar to get the latest date and adjust the startdate accordingly, or is there an easier way?

Re: Possible to extend assetHistory with own source? [Re: Dalla] #474139
09/24/18 14:32
09/24/18 14:32
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
For UpdateDays, you can use the file_date function and compare the file date with the current date. That's what the assetHistory function internally does. This, and the code above, are almost the complete assetHistory function.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1