bar – Instrument prices

class pyalgotrade.bar.Frequency

Bases: object

Enum like class for bar frequencies. Valid values are:

  • Frequency.TRADE: The bar represents a single trade.
  • Frequency.SECOND: The bar summarizes the trading activity during 1 second.
  • Frequency.MINUTE: The bar summarizes the trading activity during 1 minute.
  • Frequency.HOUR: The bar summarizes the trading activity during 1 hour.
  • Frequency.DAY: The bar summarizes the trading activity during 1 day.
  • Frequency.WEEK: The bar summarizes the trading activity during 1 week.
  • Frequency.MONTH: The bar summarizes the trading activity during 1 month.
class pyalgotrade.bar.Bar

Bases: object

A Bar is a summary of the trading activity for a security in a given period.

Note

This is a base class and should not be used directly.

__metaclass__

alias of ABCMeta

getDateTime()

Returns the datetime.datetime.

getOpen(adjusted=False)

Returns the opening price.

getHigh(adjusted=False)

Returns the highest price.

getLow(adjusted=False)

Returns the lowest price.

getClose(adjusted=False)

Returns the closing price.

getVolume()

Returns the volume.

getAdjClose()

Returns the adjusted closing price.

getFrequency()

The bar’s period.

getTypicalPrice()

Returns the typical price.

getPrice()

Returns the closing or adjusted closing price.

class pyalgotrade.bar.Bars(barDict)

Bases: object

A group of Bar objects.

Parameters:barDict (map.) – A map of instrument to Bar objects.

Note

All bars must have the same datetime.

__getitem__(instrument)

Returns the pyalgotrade.bar.Bar for the given instrument. If the instrument is not found an exception is raised.

__contains__(instrument)

Returns True if a pyalgotrade.bar.Bar for the given instrument is available.

getInstruments()

Returns the instrument symbols.

getDateTime()

Returns the datetime.datetime for this set of bars.

getBar(instrument)

Returns the pyalgotrade.bar.Bar for the given instrument or None if the instrument is not found.

Previous topic

Documentation for the code

Next topic

dataseries – Basic dataseries classes

This Page