Templating¶
Bases¶
Trump’s templating system consists of pure-python objects, which can be converted into either lists, dictionaries, or ordered dictionaries, which can then be used in the generalized constructors of Trump’s SQLAlchemy based ORM system.
-
class
bTags
¶ Bases:
trump.templating.converters._ListConverter
Tag Templates are any object which implements a property called as_list, which returns a list of strings
The Base Template for Tag Templates inherits from _listConverter, which implements as_list(). as_list() looks at the attributes defined and set to True, in order to include the list of tags.
-
class
bMunging
¶ Bases:
trump.templating.converters._OrderedDictConverter
Munging Templates are any object which implements a property called as_odict, which returns an odict where each key is a function in munging_methods, and it’s value is an object which represents the parameters to use on that object. This should be sufficient to pass to a a Feed constructor’s munging parameter, which then becomes FeedMungingArgs objects making up a FeedMunge object, of which will be the instructions associated with a specific Feed object.
-
class
bSource
¶ Bases:
trump.templating.converters._DictConverter
Source Templates are any object which implements a property called as_dict. The keywords and values of which are sufficient to pass to a a Feed constructor’s source parameter, which then become FeedSource objects making up a source.
-
class
bFeed
¶ Bases:
object
Feed objects need an tags, sourcing, munging and validity attribute defined. They must be a list, dict, odict, and dict, respectively.
-
class
bValidity
¶ Bases:
object
Validity Templates are any object which implements an attribute named ‘validator’, and optionally some additional arguments as arga, argb, argc, argd and arge.
-
class
bIndex
¶ Bases:
object
Index Templates are any object which implements sufficient information to fully define an IndexImplementer via it’s name, case and associated kwargs, vias three attributes called imp_name (string), case (string), kwargs (dict).
Templates¶
Tags¶
-
class
AssetTT
(cls)¶ Bases:
trump.templating.bases.bTags
implements groups of tags for certain asset classes
-
class
GenericTT
(tags)¶ Bases:
trump.templating.bases.bTags
implements generic list of tags via boolean attributes
-
class
SimpleTT
(tags)¶ Bases:
trump.templating.bases.bTags
implements a simple list of tags via a single attribute
-
class
SimpleTT
(tags) Bases:
trump.templating.bases.bTags
implements a simple list of tags via a single attribute
Munging¶
-
class
AbsMT
¶ Bases:
trump.templating.bases.bMunging
,trump.templating.munging_helpers.mixin_pab
Example munging template, which implements an absolute function.
-
class
AsFreqMT
(**kwargs)¶ Bases:
trump.templating.bases.bMunging
,trump.templating.munging_helpers.mixin_pab
Example munging template, which implements pct_change.
-
class
RollingMeanMT
(**kwargs)¶ Bases:
trump.templating.bases.bMunging
,trump.templating.munging_helpers.mixin_pnab
Example munging template, which implements a rolling mean.
-
class
FFillRollingMeanMT
(**kwargs)¶ Bases:
trump.templating.bases.bMunging
,trump.templating.munging_helpers.mixin_pab
,trump.templating.munging_helpers.mixin_pnab
Example munging template, which implements a ffill using the generic pandas attribute based munging, and then a rolling mean.
-
class
RollingMeanFFillMT
(**kwargs)¶ Bases:
trump.templating.bases.bMunging
,trump.templating.munging_helpers.mixin_pab
,trump.templating.munging_helpers.mixin_pnab
Example munging template, which implements a rolling mean and a generic pandas attribute based munging step.
-
class
SimpleExampleMT
(periods, window)¶ Bases:
trump.templating.bases.bMunging
,trump.templating.munging_helpers.mixin_pnab
,trump.templating.munging_helpers.mixin_pab
Example munging template, which has defaults to forward fill, and a minimum period argument of 5
-
class
MultiExampleMT
(pct_change_kwargs, add_kwargs)¶ Bases:
trump.templating.bases.bMunging
,trump.templating.munging_helpers.mixin_pnab
,trump.templating.munging_helpers.mixin_pab
Example munging template, which implements a pct_change and add, using two sets of kwargs
Sources¶
-
class
DBapiST
(dsn=None, user=None, password=None, host=None, database=None, sourcing_key=None)¶ Bases:
trump.templating.bases.bSource
,trump.templating.source_helpers.mixin_dbCon
,trump.templating.source_helpers.mixin_dbIns
implements the generic source information for a DBAPI 2.0 driver
-
class
PyDataDataReaderST
(data_source, name, column='Close', start='2000-01-01', end='now')¶ Bases:
trump.templating.bases.bSource
implements the pydata datareaders sources
-
class
PyDataCSVST
(filepath_or_buffer, data_column, **kwargs)¶ Bases:
trump.templating.bases.bSource
implements pandas.read_csv source
Feeds¶
-
class
DBapiFT
(table=None, indexcol=None, datacol=None, dsn=None, user=None, password=None, host=None, database=None, sourcing_key=None)¶ Bases:
trump.templating.bases.bFeed
Feed template for DBAPI 2.0, which collects up everything it needs via parameters about the connection and information.
-
class
SQLFT
(command)¶ Bases:
trump.templating.templates.ExplicitCommandFT
Just wrap inherit, for renaming purposes.
-
class
QuandlFT
(dataset, **kwargs)¶ Bases:
trump.templating.bases.bFeed
Feed tamplate for a Quandl data source
-
class
QuandlSecureFT
(dataset, **kwargs)¶ Bases:
trump.templating.templates.QuandlFT
Feed tamplate for a Quandl data source, authtoken left in config file.
-
class
GoogleFinanceFT
(name, column='Close', start='1995-01-01', end='now')¶ Bases:
trump.templating.bases.bFeed
PyData reader feed, generalized for google finance.
-
class
YahooFinanceFT
(name, column='Close', start='1995-01-01', end='now')¶ Bases:
trump.templating.bases.bFeed
PyData reader feed, generalized for Yahoo Finance.
-
class
StLouisFEDFT
(name, column=None, start='1995-01-01', end='now')¶ Bases:
trump.templating.bases.bFeed
PyData reader feed, generalized for St Louis FED.
-
class
CSVFT
(filepath_or_buffer, data_column, **kwargs)¶ Bases:
trump.templating.bases.bFeed
Creates a feed from a CSV.