Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)
Takes a list of stock infos and updates the portfolio quantities and values.
The list is in the form
stocks = [ ['AAPL', num_traded, close_price], ['MSFT', num_traded, close_price]...]

src/h/f/HFTrader-HEAD/src/main.py   HFTrader(Download)
            else:
                size = math.floor((ash_ptflo.cash*pred)/next_close)
            prev_val, curr_val = ash_ptflo.update_portfolio(-1*size*next_close, [['AAPL',size,next_close]]) #try close after
            day_return = (prev_val-curr_val)/prev_val
            data_handler.update_car('ash', the_date, day_return)
            data_handler.update_car('creamer', the_date, day_return)
            # ash
            prev_val, curr_val = ash_ptflo.update_portfolio(0, [['AAPL',0,next_close]]) #try close after
            day_return = (prev_val-curr_val)/prev_val
            data_handler.update_car('ash', the_date, day_return)