Developer Interface

Entities

class bulbea.Share(source, ticker, start=None, end=None, latest=None, cache=False)

A user-created Share object.

Parameters:
  • source (str) – source symbol for economic data
  • ticker (str) – ticker symbol of a share
  • start (str) – starting date string in the form YYYY-MM-DD for acquiring historical records, defaults to the earliest available records
  • end (str) – ending date string in the form YYYY-MM-DD for acquiring historical records, defaults to the latest available records
  • latest (int) – acquires the latest N records
Example:
>>> import bulbea as bb
>>> share = bb.Share(source = 'YAHOO', ticker = 'GOOGL')
>>> share.data.sample(1)
            Open       High        Low  Close      Volume  Adjusted Close
Date
2003-05-15  18.6  18.849999  18.470001  18.73  71248800.0        1.213325
bollinger_bands(attrs='Close', period=50, bandwidth=1)

Returns the Bollinger Bands (R) for each attribute.

Parameters:
  • attrs (str, list) – str or list of attribute name(s) of a share, defaults to Close
  • period (int) – length of the window to compute moving averages, upper and lower bands
  • bandwidth (int) – multiple of the standard deviation of upper and lower bands
Example:
>>> import bulbea as bb
>>> share     = bb.Share(source = 'YAHOO', ticker = 'AAPL')
>>> bollinger = share.bollinger_bands()
>>> bollinger.tail()
            Lower (Close)  Mean (Close)  Upper (Close)
Date
2017-03-07     815.145883    831.694803     848.243724
2017-03-08     816.050821    832.574004     849.097187
2017-03-09     817.067353    833.574805     850.082257
2017-03-10     817.996674    834.604404     851.212135
2017-03-13     819.243360    835.804605     852.365849
plot(attrs='Close', global_mean=False, bollinger_bands=False, period=50, bandwidth=1, subplots=False, *args, **kwargs)
Parameters:attrsstr or list of attribute names of a share to plot, defaults to Close attribute
Example:
>>> import bulbea as bb
>>> share = bb.Share(source = 'YAHOO', ticker = 'AAPL')
>>> share.plot()
save(format_='csv', filename=None)
Parameters:format (str) – type of format to save the Share object, default ‘csv’.
update(start=None, end=None, latest=None, cache=False)

Update the share with the latest available data.

Example:
>>> import bulbea as bb
>>> share = bb.Share(source = 'YAHOO', ticker = 'AAPL')
>>> share.update()
class bulbea.Stock

Modelling