Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function importRisks() {
- $fp = fopen('/home/jborzilleri/Downloads/ETF_Risk_Information_SPDRS-SPDR U-Mobile_Sep 15 2011.csv', 'r');
- $funds = array();
- while( false !== ($line = fgetcsv($fp)) ) {
- if( count($line) < 4 ) {
- printf("Not enough data for ticker: %s<br>", @$line[1]);
- continue;
- }
- $ticker = $line[1];
- $fund = Query::build()
- ->attribute('Products.Product Ticker', $ticker, QUERY_TERM)
- ->run('Fund');
- if( count($fund) == 0 ) {
- printf("cannot find: %s<br>", $ticker);
- continue;
- }
- $fund = $fund[0];
- $fund->setAttribute('Products.mobileRisk', $line[3]);
- $fund->save();
- printf("updating: %s<br>", $ticker);
- }
- }
Add Comment
Please, Sign In to add comment