bar – Instrument prices

class pyalgotrade.bar.Bar(dateTime, open_, high, low, close, volume, adjClose)

An instrument’s prices at a given time.

Parameters:
  • dateTime (datetime.datetime) – The date time.
  • open (float) – The opening price.
  • high (float) – The highest price.
  • low (float) – The lowest price.
  • close (float) – The closing price.
  • volume (float) – The volume.
  • close – The adjusted closing price.
getDateTime()

Returns the datetime.datetime.

getOpen()

Returns the opening price.

getHigh()

Returns the highest price.

getLow()

Returns the lowest price.

getClose()

Returns the closing price.

getVolume()

Returns the volume.

getAdjClose()

Returns the adjusted closing price.

class pyalgotrade.bar.Bars(barDict)

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