hiveengine.market

class hiveengine.market.Market(api=None, blockchain_instance=None, steem_instance=None)

Bases: list

Access the hive-engine market

Parameters:blockchain_instance (Hive) – Hive instance
buy(account, amount, symbol, price)

Buy token for given price.

Parameters:
  • account (str) – account name
  • amount (float) – Amount to withdraw
  • symbol (str) – symbol
  • price (float) – price

Buy example:

from hiveengine.market import Market
from beem import Steem
active_wif = "5xxxx"
stm = Steem(keys=[active_wif])
market = Market(blockchain_instance=stm)
market.buy("test", 1, "BEE", 0.95)
cancel(account, order_type, order_id)

Cancel buy/sell order.

Parameters:
  • account (str) – account name
  • order_type (str) – sell or buy
  • order_id (int) – order id

Cancel example:

from hiveengine.market import Market
from beem import Steem
active_wif = "5xxxx"
stm = Steem(keys=[active_wif])
market = Market(blockchain_instance=stm)
market.sell("test", "sell", 12)
deposit(account, amount)

Deposit HIVE to market in exchange for SWAP.HIVE.

Parameters:
  • account (str) – account name
  • amount (float) – Amount to deposit

Deposit example:

from hiveengine.market import Market
from beem import Steem
active_wif = "5xxxx"
stm = Steem(keys=[active_wif])
market = Market(blockchain_instance=stm)
market.deposit("test", 1)
get_buy_book(symbol, account=None, limit=100, offset=0)

Returns the buy book for a given symbol. When account is set, the order book from the given account is shown.

get_metrics()

Returns all token within the wallet as list

get_sell_book(symbol, account=None, limit=100, offset=0)

Returns the sell book for a given symbol. When account is set, the order book from the given account is shown.

get_trades_history(symbol, account=None, limit=30, offset=0)

Returns the trade history for a given symbol. When account is set, the trade history from the given account is shown.

refresh()
sell(account, amount, symbol, price)

Sell token for given price.

Parameters:
  • account (str) – account name
  • amount (float) – Amount to withdraw
  • symbol (str) – symbol
  • price (float) – price

Sell example:

from hiveengine.market import Market
from beem import Steem
active_wif = "5xxxx"
stm = Steem(keys=[active_wif])
market = Market(blockchain_instance=stm)
market.sell("test", 1, "BEE", 0.95)
set_id(ssc_id)

Sets the ssc id (default is ssc-mainnet-hive)

withdraw(account, amount)

Widthdraw SWAP.HIVE to account as HIVE.

Parameters:
  • account (str) – account name
  • amount (float) – Amount to withdraw

Withdraw example:

from hiveengine.market import Market
from beem import Steem
active_wif = "5xxxx"
stm = Steem(keys=[active_wif])
market = Market(blockchain_instance=stm)
market.withdraw("test", 1)