Returns the current value of stocks
502027
def get_value(self) -> Decimal:
        
        quantity = self.get_quantity()
        price = self.get_last_available_price()
        if not price:
            # raise ValueError("no price found for", self.full_symbol)
            return Decimal(0)

        value = quantity * price.value
        return value
368232
@Override
    public float[] getValues() {
        if (used == values.length)
            return values;

        float[] tmpValues = new float[used];
        for (int i = 0; i < used; i++) {
        	tmpValues[i] = values[i];
        }
        return tmpValues;
    }
1323524
function _current() {
    var a = [], i, n;

    if (!this.__isCurrent__) { return []; }
    if (this.substates.length === 0) { return [this]; }

    for (i = 0, n = this.substates.length; i < n; i++) {
      if (this.substates[i].__isCurrent__) {
        a = a.concat(_current.call(this.substates[i]));
      }
    }

    return a;
  }
1254290
def get_stock_codes(realtime=False):
    """"""
    if realtime:
        all_stock_codes_url = "http://www.shdjt.com/js/lib/astock.js"
        grep_stock_codes = re.compile(r"~(\d+)`")
        response = requests.get(all_stock_codes_url)
        stock_codes = grep_stock_codes.findall(response.text)
        with open(stock_code_path(), "w") as f:
            f.write(json.dumps(dict(stock=stock_codes)))
        return stock_codes

    with open(stock_code_path()) as f:
        return json.load(f)["stock"]
260631
def value(self):
        """"""
        field_vals = None
        field_names = self.fields_select.names()
        fcount = len(field_names)
        if fcount:
            d = self._query('get_one')
            if d:
                field_vals = [d.get(fn, None) for fn in field_names]
                if fcount == 1:
                    field_vals = field_vals[0]

        else:
            raise ValueError("no select fields were set, so cannot return value")

        return field_vals
1359668
def get_last_traded_dt(self, asset, dt, data_frequency):
        
        return self._get_pricing_reader(data_frequency).get_last_traded_dt(
            asset, dt)
1253411
def current(self, fields=None):
        """"""
        if fields is None:
            fields = self.fields

        return dict((f, self.get_field_value(f)) for f in fields)
1008217
def daily_returns(ts, **kwargs):
    '''  '''
    relative = kwargs.get('relative', 0)
    return returns(ts, delta=BDay(), relative=relative)
1128379
def C_stock(self):
        
        return self._C_sys * (self._Q_sys / self._Q_stock).to(u.dimensionless)
750711
def get_current_info(self, symbolList, columns=None):
        
        response = self.select('yahoo.finance.quotes',columns).where(['symbol','in',symbolList])
        return response
1124359
def value(self):
        
        try:
            value = self.lastValue
        except IndexError:
            value = "NaN"
        except ValueError:
            value = "NaN"
        return value
1007829
def get_value(self):
        """"""
        try:
            return self.get_applicable_values()[0]
        except IndexError:
            if not self.select_many and self.get_values():
                return self.get_values()[0]
1127865
def currentValue(self):
        
        enum  = self.enum()
        if ( self.isCheckable() ):
            value = 0
            for i in self.checkedIndexes():
                value |= enum[nativestring(self.itemText(i))]
            return value
        else:
            try:
                return enum[nativestring(self.itemText(self.currentIndex()))]
            except KeyError:
                return 0
946908
def __getCashToBuyStock(self):
        '''  '''
        account=self.__strategy.getAccountCopy()

        if (account.buyingPower >= account.getTotalValue() / self.__buyingRatio):
            return account.getTotalValue() / self.__buyingRatio
        else:
            return 0
1177939
def to_price_index(returns, start=100):
    
    return (returns.replace(to_replace=np.nan, value=0) + 1).cumprod() * start
481472
def Cmd_display(self):
    
    re = "%(stock_no)s %(stock_name)s %(stock_date)s %(stock_price)s %(stock_range)s %(stock_range_per).2f%% %(RABC)s %(stock_vol)s" % {
        'stock_name': unicode(self.stock_name),
        'stock_no': unicode(self.stock_no),
        'stock_date': unicode(self.data_date[-1]),
        'stock_price': unicode(self.raw_data[-1]),
        'stock_range': unicode(self.stock_range[-1]),
        'stock_range_per': self.range_per,
        'stock_vol': self.stock_vol[-1]/1000,
        'RABC': self.RABC
      }
    return re
1179946
def market_snapshot(self, prefix=False):
        
        return self.get_stock_data(self.stock_list, prefix=prefix)