PtfAllocationΒΆ

class alchemist_lib.database.ptf_allocation.PtfAllocation(amount, base_currency_amount, ts_name, ticker, instrument_id)[source]

Map class for table ptf_allocation.

  • allocation_id: Integer, primary_key.
  • amount: Float(20, 8), not null.
  • base_currency_amount: Float(20, 8), not null.
  • ts_name: String(150), not null, foreign_key(ts.ts_name).
  • ticker: String(16), not null, foreign_key(asset.ticker).
  • instrument_id: Integer, not null, foreign_key(asset.instrument_id).
Relationship:
  • asset: Asset instance. (Many-to-One)
  • ts: TradingSystem instance. (Many-to-One)
__eq__(other)[source]

Overrides the default implementation.

__init__(amount, base_currency_amount, ts_name, ticker, instrument_id)

Costructor method.

Parameters:
  • ticker (str) – Ticker code of the asset.
  • instrument_id (int) – Integer that identify tha type of financial instrument.
  • amount (decimal.Decimal) – Amount of the asset.
  • base_currency_amount (decimal.Decimal) – Amount of the base currency used to buy the amount of asset.
  • ts_name (str) – Name of the trading system that manages this allocation.
deepcopy()[source]

Notes

https://www.python-course.eu/deep_copy.php https://docs.python.org/2/library/copy.html

to_dict()[source]

As the name tell, it returns attributes in a dict form.

Note

The __dict__ method is not overrideble.