Quoting

class hippo.quote.Quote(db: Database, id: int, compound: int, smiles: str, supplier: str, catalogue: str, entry: str, amount: float, price: float, currency: str, purity: float, lead_time: int, date: str | None = None, type: str | None = None)[source]

Supplier quote for a specific quantity of a Compound.

Attention

Quote objects should not be created directly. Instead use Compound.get_quotes().

Quote initialisation

repr(self) str[source]

ANSI Formatted string representation

str(self)[source]

Unformatted string representation

property amount: float

Amount in mg

property catalogue: str | None

Name of the catalogue

classmethod combination(required_amount: float, quotes: list[Quote]) Quote[source]

Combine a list of quotes into one Quote object.

  • Start with biggest pack

  • Estimate by scaling linearly with unit price

Parameters:
  • required_amount – amount in mg

  • quotes – list of quotes to be combined

property compound: int

Returns the associated Compound

property currency: str

Currency of the associated Price object

property currency_symbol: str

Currency symbol of the associated Price

property date: str

Date the quote was registered to the database

property db: Database

Returns a pointer to the parent database

property dict: dict

Dictionary representation of this quote

property entry: str

Name/ID of the catalogue entry

property entry_str: str

Unformatted string including the supplier, catalogue (if available), and entry name of the quote

property id: int

Returns the quote’s database ID

property lead_time: float

Lead time in days

property price: Price

Price

property purity: float

Purity fraction

property smiles: str

Returns the catalogue SMILES string

property supplier: str

Name of the supplier

property type: str

Description of this quote

class hippo.price.Price(amount: float | None, currency: str | None)[source]

Class to represent a certain amount of currency. Supported currencies:

CURRENCIES = {
        'USD':'$',
        'EUR':'€',
        'GBP':'£',
}

Price initialisation

self + other: Price Price[source]

Add two Price objects

Parameters:

otherPrice object

Returns:

Price object

self == other: Price bool[source]

Compare two Price objects

self > other: Price bool[source]

Compare two Price objects

hash(self) int[source]

Allow for Prices to be hashed for comparison

self < other: Price bool[source]

Compare two Price objects

self * other: Price | float | int Price | float[source]

Multiply this Price by another object

Parameters:

otherPrice or float or int

Returns:

Price object or float

repr(self) str[source]

ANSI Formatted string representation

str(self) str[source]

Unformatted string representation

self / other: Price | float | int Price | float[source]

Divide this Price by another object

Parameters:

otherPrice or float or int

Returns:

Price object or float

property amount: float

Amount

copy() Price[source]

Return a copy of this Price

property currency: str

Currency string

classmethod from_dict(d: dict) Price[source]

Create a Price object from a dictionary:

dict(amount: float, currency: str)
Parameters:

d – dictionary in the above format:

get_dict() dict[source]

Dictionary in the format:

dict(amount: float, currency: str)
property is_null: bool

Is this Price.null() or zero?

classmethod null() Price[source]

Zero in any currency

property symbol: str

Currency symbol