bar – Instrument prices

class quantworks.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 quantworks.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.

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 quantworks.bar.BasicBar(dateTime, open_, high, low, close, volume, adjClose, frequency, extra={})

Bases: quantworks.bar.Bar

Common bar class of OCHLV wih frequency and adjusted close if available. Extra bar values are stored as a group under BasicBar.getExtraColumns()

__init__(dateTime, open_, high, low, close, volume, adjClose, frequency, extra={})

Initialize self. See help(type(self)) for accurate signature.

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.

getPrice()

Returns the closing or adjusted closing price.

class quantworks.bar.Bars(barDict)

Bases: object

A point-in-time mapping of instrument -> Bar.

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

Note

All bars must have the same datetime.

__init__(barDict)

Initialize self. See help(type(self)) for accurate signature.

__getitem__(instrument)

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

__contains__(instrument)

Returns True if a quantworks.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 quantworks.bar.Bar for the given instrument or None if the instrument is not found.