'use strict';


var mongoose = require('mongoose'),
  request = require('request');

exports.list_ticker_price = function(req, res) {
 request('https://www.quandl.com/api/v3/datasets/WIKI/WMT.json?start_date=1985-05-01&end_date=2010-07-01&order=asc&column_index=4&collapse=daily&transformation=rdiff',
  function(err, response, body){
    if(!err && response.statusCode == 200){
      res.json(body);
    }
  }).end();
};







@@ -8,20 +8,16 @@
 rict';%0D%0A
-%0D%0A%0D%0A
 var mong
@@ -75,16 +75,171 @@
 equest')
+,%0D%0A  Schema = mongoose.Schema,%0D%0A  dataModel = require('../models/fintechModel.js'),%0D%0A  config = require('../config.js');%0D%0A%0D%0Amongoose.connect(config.db.uri)
 ;%0D%0A%0D%0Aexp
@@ -578,22 +578,589 @@
 d();%0D%0A%7D;%0D%0A%0D%0A
+exports.save_portfolio = function(req, res)%7B%0D%0A%0D%0A%09var portfolio = mongoose.model('portfolio', dataModel.portfolio);%0D%0A%09var testPortfolio = new portfolio(%7B%0D%0A%09%09name : %22testPortfolio%22,%0D%0A%09%09marketValue : %5B%5D,%0D%0A%09%09historicalOptimization :%5B%5D%0D%0A%09%7D);%0D%0A%0D%0A%09var currentTime = new Date;%0D%0A%09var marketValue =%7B%0D%0A%09%09%22value%22 : 387987.98,%0D%0A%09%09%22currency%22 : %22USD%22,%0D%0A%09%09%22time%22 : currentTime%0D%0A%09%7D%0D%0A%0D%0A%09testPortfolio.marketValue.push(marketValue);%0D%0A%0D%0A%09testPortfolio.save(function(err)%7B%0D%0A%09%09if(err) throw err;%0D%0A%09%09res.status(200).send('Succesfully created an entry in portfolio collection!');%0D%0A%09%7D);%0D%0A%7D;%0D%0A
 %0D%0A%0D%0A%0D%0A%0D%0A%0D%0A

Include example func in controller