beem.price module¶
-
class
beem.price.FilledOrder(order, steem_instance=None, **kwargs)¶ Bases:
beem.price.PriceThis class inherits
beem.price.Pricebut has thebaseandquoteAmounts not only be used to represent the price (as a ratio of base and quote) but instead has those amounts represent the amounts of an actually filled order!Parameters: steem_instance (beem.steem.Steem) – Steem instance Note
Instances of this class come with an additional
datekey that shows when the order has been filled!-
json()¶
-
-
class
beem.price.Order(base, quote=None, steem_instance=None, **kwargs)¶ Bases:
beem.price.PriceThis class inherits
beem.price.Pricebut has thebaseandquoteAmounts not only be used to represent the price (as a ratio of base and quote) but instead has those amounts represent the amounts of an actual order!Parameters: steem_instance (beem.steem.Steem) – Steem instance Note
If an order is marked as deleted, it will carry the ‘deleted’ key which is set to
Trueand all other data beNone.
-
class
beem.price.Price(price=None, base=None, quote=None, base_asset=None, steem_instance=None)¶ Bases:
dictThis class deals with all sorts of prices of any pair of assets to simplify dealing with the tuple:
(quote, base)
each being an instance of
beem.amount.Amount. The amount themselves define the price.Note
The price (floating) is derived as
base/quoteParameters: - args (list) – Allows to deal with different representations of a price
- base (beem.asset.Asset) – Base asset
- quote (beem.asset.Asset) – Quote asset
- steem_instance (beem.steem.Steem) – Steem instance
Returns: All data required to represent a price
Return type: dict
Way to obtain a proper instance:
argsis a str with a price and two assetsargscan be a floating number andbaseandquotebeing instances ofbeem.asset.Assetargscan be a floating number andbaseandquotebeing instances ofstrargscan be dict with keysprice,base, andquote(graphene balances)argscan be dict with keysbaseandquoteargscan be dict with keyreceives(filled orders)argsbeing a list of[quote, base]both being instances ofbeem.amount.Amountargsbeing a list of[quote, base]both being instances ofstr(amount symbol)baseandquotebeing instances ofbeem.asset.Amount
This allows instanciations like:
Price("0.315 SBD/STEEM")Price(0.315, base="SBD", quote="STEEM")Price(0.315, base=Asset("SBD"), quote=Asset("STEEM"))Price({"base": {"amount": 1, "asset_id": "SBD"}, "quote": {"amount": 10, "asset_id": "SBD"}})Price(quote="10 STEEM", base="1 SBD")Price("10 STEEM", "1 SBD")Price(Amount("10 STEEM"), Amount("1 SBD"))Price(1.0, "SBD/STEEM")
Instances of this class can be used in regular mathematical expressions (
+-*/%) such as:>>> from beem.price import Price >>> Price("0.3314 SBD/STEEM") * 2 0.662600000 SBD/STEEM
-
as_base(base)¶ Returns the price instance so that the base asset is
base.Note: This makes a copy of the object!
-
as_quote(quote)¶ Returns the price instance so that the quote asset is
quote.Note: This makes a copy of the object!
-
copy()¶
-
invert()¶ Invert the price (e.g. go from
SBD/STEEMintoSTEEM/SBD)
-
json()¶
-
market¶ Open the corresponding market
Returns: Instance of beem.market.Marketfor the corresponding pair of assets.
-
symbols()¶