text
stringlengths
0
828
return t.evtime
else:
return None"
1857,"def set_indexing(self, index_template):
""""""
Update a symbol's indexing strategy
Parameters
----------
index_template : bIndex or bIndex-like
An index template used to overwrite all
details about the symbol's current index.
""""""
objs = object_session(self)
if self.index.indimp != index_template.imp_name:
self._refresh_datatable_schema()
self.index.name = index_template.name
self.index.indimp = index_template.imp_name
self.index.case = index_template.case
self.index.setkwargs(**index_template.kwargs)
objs.commit()"
1858,"def add_meta(self, **metadict):
""""""Add meta information to a Symbol.
Parameters
----------
metadict
Attributes are passed as keywords, with their
associated values as strings. For meta attributes with spaces,
use an unpacked dict.
""""""
objs = object_session(self)
for attr,val in metadict.iteritems():
newmeta = SymbolMeta(self, attr, val)
self.meta.append(newmeta)
objs.commit()"
1859,"def add_validator(self, val_template):
""""""
Creates and adds a SymbolValidity object to the Symbol.
Parameters
----------
validity_template : bValidity or bValidity-like
a validity template.
""""""
validator = val_template.validator
args = []
for arg in SymbolValidity.argnames:
if arg in val_template.__dict__.keys():
args.append(getattr(val_template, arg))
objs = object_session(self)
qry = objs.query(func.max(SymbolValidity.vid).label('max_vid'))
qry = qry.filter_by(symname = self.name)
cur_vid = qry.one()[0]
if cur_vid is None:
next_vid = 0
else:
next_vid = cur_vid + 1
self.validity.append(SymbolValidity(self, next_vid, validator, *args))
objs.commit()"
1860,"def cache(self, checkvalidity=True, staleonly=False, allowraise=True):
"""""" Re-caches the Symbol's datatable by querying each Feed.
Parameters
----------
checkvalidity : bool, optional
Optionally, check validity post-cache. Improve speed by
turning to False.
staleonly : bool, default False
Set to True, for speed up, by looking at staleness
allowraise : bool, default True
AND with the Symbol.handle and Feed.handle's 'raise',
set to False, to do a list of symbols. Note, this
won't silence bugs in Trump, eg. unhandled edge cases.
So, those still need to be handled by the application.
Returns
-------
SymbolReport
""""""
note = ""staleonly = {}"".format(staleonly)
self._log_an_event('CACHE','START',note)
docache = True
if staleonly:
lc = self.last_cache()