Dex

class piston.dex.Dex(steem_instance=None)

This class allows to access calls specific for the internal exchange of STEEM.

Parameters:steem_instance (Steem) – Steem() instance to use when accesing a RPC
buy(amount, quote_symbol, rate, expiration=604800, killfill=False, account=None, orderid=None)

Places a buy order in a given market (buy quote, sell base in market quote_base). If successful, the method will return the order creating (signed) transaction.

Parameters:
  • amount (number) – Amount of quote to buy
  • quote_symbol (str) – STEEM, or SBD
  • price (float) – price denoted in base/quote
  • expiration (number) – (optional) expiration time of the order in seconds (defaults to 7 days)
  • killfill (bool) – flag that indicates if the order shall be killed if it is not filled (defaults to False)
  • account (str) – (optional) the source account for the transfer if not default_account
  • orderid (int) – (optional) a 32bit orderid for tracking of the created order (random by default)

Prices/Rates are denoted in ‘base’, i.e. the STEEM:SBD market is priced in SBD per STEEM.

cancel(orderid, account=None)

Cancels an order you have placed in a given market.

Parameters:
  • orderid (int) – the 32bit orderid
  • account (str) – (optional) the source account for the transfer if not default_account
get_higest_bid()

Return the highest bid.

Note

Market is STEEM:SBD and prices are SBD per STEEM!

Example:

{'price': '0.32399833185738391',
 'sbd': 320863,
 'steem': 990323}
get_lowest_ask()

Return the lowest ask.

Note

Market is STEEM:SBD and prices are SBD per STEEM!

Example:

{'price': '0.32399833185738391',
  'sbd': 320863,
  'steem': 990323}
return24Volume()

Returns the 24-hour volume for all markets, plus totals for primary currencies.

Sample output:

{'sbd_volume': 108329.611, 'steem_volume': 355094.043}
returnBalances(account=None)

Return SBD and STEEM balance of the account

Parameters:account (str) – (optional) the source account for the transfer if not default_account
returnMarketHistory(bucket_seconds=300, start_age=3600, stop_age=0)

Return the market history (filled orders).

Parameters:
  • bucket_seconds (int) – Bucket size in seconds (see returnMarketHistoryBuckets())
  • start_age (int) – Age (in seconds) of the start of the window (default: 1h/3600)
  • end_age (int) – Age (in seconds) of the end of the window (default: now/0)

Example:

{'close_sbd': 2493387,
 'close_steem': 7743431,
 'high_sbd': 1943872,
 'high_steem': 5999610,
 'id': '7.1.5252',
 'low_sbd': 534928,
 'low_steem': 1661266,
 'open': '2016-07-08T11:25:00',
 'open_sbd': 534928,
 'open_steem': 1661266,
 'sbd_volume': 9714435,
 'seconds': 300,
 'steem_volume': 30088443},
returnOpenOrders(account=None)

Return open Orders of the account

Parameters:account (str) – (optional) the source account for the transfer if not default_account
returnOrderBook(limit=25)

Returns the order book for the SBD/STEEM markets in both orientations.

Parameters:limit (int) – Limit the amount of orders (default: 25)

Note

Market is STEEM:SBD and prices are SBD per STEEM!

Sample output:

{'asks': [{'price': 3.086436224481787,
           'sbd': 318547,
           'steem': 983175},
          {'price': 3.086429621198315,
           'sbd': 2814903,
           'steem': 8688000}],
 'bids': [{'price': 3.0864376216446257,
           'sbd': 545133,
           'steem': 1682519},
          {'price': 3.086440512632327,
           'sbd': 333902,
           'steem': 1030568}]},
returnTicker()

Returns the ticker for all markets.

Output Parameters:

  • latest: Price of the order last filled
  • lowest_ask: Price of the lowest ask
  • highest_bid: Price of the highest bid
  • sbd_volume: Volume of SBD
  • steem_volume: Volume of STEEM
  • percent_change: 24h change percentage (in %)

Note

Market is STEEM:SBD and prices are SBD per STEEM!

Sample Output:

{'highest_bid': 0.30100226633322913,
 'latest': 0.0,
 'lowest_ask': 0.3249636958897082,
 'percent_change': 0.0,
 'sbd_volume': 108329611.0,
 'steem_volume': 355094043.0}
returnTradeHistory(time=3600, limit=100)

Returns the trade history for the internal market

Parameters:
  • hours (int) – Show the last x seconds of trades (default 1h)
  • limit (int) – amount of trades to show (<100) (default: 100)
sell(amount, quote_symbol, rate, expiration=604800, killfill=False, account=None, orderid=None)

Places a sell order in a given market (sell quote, buy base in market quote_base). If successful, the method will return the order creating (signed) transaction.

Parameters:
  • amount (number) – Amount of quote to sell
  • quote_symbol (str) – STEEM, or SBD
  • price (float) – price denoted in base/quote
  • expiration (number) – (optional) expiration time of the order in seconds (defaults to 7 days)
  • killfill (bool) – flag that indicates if the order shall be killed if it is not filled (defaults to False)
  • account (str) – (optional) the source account for the transfer if not default_account
  • orderid (int) – (optional) a 32bit orderid for tracking of the created order (random by default)

Prices/Rates are denoted in ‘base’, i.e. the STEEM:SBD market is priced in SBD per STEEM.

transfer(*args, **kwargs)

Dummy to redirect to steem.transfer()