create account

Update for steemengine - token class and command line tool added by holger80

View this thread on: hive.blogpeakd.comecency.com
· @holger80 · (edited)
$98.70
Update for steemengine - token class and command line tool added
![image.png](https://ipfs.busy.org/ipfs/QmZrpLZz5DcAVLKkBSUknoEs1eSR4kJEaW1ZSB8otwt6Kq)


### Repository
https://github.com/holgern/steemengine

### steemengine
[steemengine](https://github.com/holgern/steemengine) is a python library for working with [steem-engine.com](https://steem-engine.com/) tokens.

I released version 0.3.0 which can be installed by
```
pip install steemengine
```

## New features
### New `Token` class
I added a token class, that can be used to receive information about a token.

```
from steemengine.tokenobject import Token
eng = Token("ENG")
print(eng)
print(eng.get_holder())
print(eng.get_market_info())
print(eng.get_buy_book())
print(eng.get_sell_book())
```

#### `get_holder`
All accounts that currently are holding a token can be received by the `get_holder()` function
It uses the `find` function from the api:
```
holder = self.api.find("tokens", "balances", query={"symbol": self.symbol})
```
It returns a list of dict-objects. Each dict object is of the following structure:
```
{'$loki': 2,
 'account': 'steemsc',
 'balance': '1973148.55400000',
 'symbol': 'ENG'}
```

#### `get_market_info()`
This function uses:
```
metrics = self.api.find_one("market", "metrics", query={"symbol": self.symbol})
```
and returns the following structure:
```
{'$loki': 1,
 'highestBid': '0.81000',
 'lastDayPrice': '0.949',
 'lastDayPriceExpiration': 1552346331,
 'lastPrice': '0.949',
 'lowestAsk': '0.949',
 'priceChangePercent': '0.00%',
 'priceChangeSteem': '0.000',
 'symbol': 'ENG',
 'volume': 223.535,
 'volumeExpiration': 1552346331}
```
#### get_buy_book() and get_sell_book()
These functions return the sell/buy book of all currently not fullfilled order at the market.

### Command line tool
I added a command line tool to the python package. It has currently two commands.
After installing the steemengine library, a steemengine command should be available in the terminal.
```
steemengine --version
```
and 
```
steemengine --help
```
should be working.

#### steemengine richlist
This command returns the top n token holder.
For example the top 10 ENG token holder can be shown be the following command:
```
 steemengine richlist -t 10 ENG
```
![image.png](https://ipfs.busy.org/ipfs/QmZwKFaExY7sewJbaHWnMKpnGYo5AUXeaoBmNbp1tZAWvb)

The STEEM value of the token balance is obtained by multiplying the balance by the `lastPrice` field from get_market_info().

#### steemengine info
This command can be used to receive information about

#### latest block
```
steemengine info
```
![image.png](https://ipfs.busy.org/ipfs/QmXi65CUriwXJatBP2oez2Vjdje1QEfxX48qGyerw7C57Q)

#### a sidechain block
```
steemengine info 16695
```
![image.png](https://ipfs.busy.org/ipfs/QmWykTLoBcxEroBp8LHu9HSTzCX2SMfdZzN2Jz7u1E7MCG)

#### a token
```
steemengine info ENG
```
![image.png](https://ipfs.busy.org/ipfs/QmYMHKjzH2BP5Ne78VwK1JyZkihyDYiXBask2KA2TF61kC)

#### an account
```
steemengine info holger80
```
![image.png](https://ipfs.busy.org/ipfs/QmZF2TKmrLMcyTecX8rtNu4fD1gCf1hAv7Wh8SiHEWFXYt)

#### a transaction id
```
steemengine info 12ed6e59179a8b5441809d60dc3025143f17ff9f
```
![image.png](https://ipfs.busy.org/ipfs/QmV5fymefs3Yyy8Aj5HYh9DWTJXgFecu8tGBsRQVe2RdkP)

### PyInstaller
I created two pyinstaller specs, which will create a one file standalone executable and a one-directory standalone excecutable. I setup appveyoer, in order to build a packed version for windows:
https://ci.appveyor.com/project/holger80/steemengine
I will put the newest Windows-Versions to the release page: https://github.com/holgern/steemengine/releases

## Commits
### Changelog and pyinstaller build instruction added
* [commit ff05b22](https://github.com/holgern/steemengine/commit/ff05b22c90812aaf383f81b02920bad626510916)
### Add command line tool for showing block, token and account info 
* [commit e8362861](https://github.com/holgern/steemengine/commit/e8362861c114831d991841ca99ba7e057f5f3d7b)
* Add CLI for showing information about blocks, transaction ids, token and accounts
* Unit tests for tokenobject and tokens added
* get_buy_book and get_sell_book for Wallet added

### Add Token class, remove unused imports and fix some variable names
* [commit d34d5ee](https://github.com/holgern/steemengine/commit/d34d5ee6c146cdb5765d33462d4fb0785ab2984b)
* The new Token class returns, token holder, market information and token information
* some camelcase variable names fixed
* unused imports removed
* version increased to 0.3.0

### GitHub Account
https://github.com/holgern
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 311 others
properties (23)
authorholger80
permlinkupdate-for-steemengine-token-class-and-command-line-tool-added
categoryutopian-io
json_metadata"{"community": "busy", "app": "beempy/0.23.10", "format": "markdown", "tags": ["utopian-io", "development", "steem-engine", "steemdev", "busy"], "users": [], "links": ["https://github.com/holgern/steemengine", "https://github.com/holgern/steemengine", "https://steem-engine.com/", "https://ci.appveyor.com/project/holger80/steemengine", "https://github.com/holgern/steemengine/releases", "https://github.com/holgern/steemengine/commit/ff05b22c90812aaf383f81b02920bad626510916", "https://github.com/holgern/steemengine/commit/e8362861c114831d991841ca99ba7e057f5f3d7b", "https://github.com/holgern/steemengine/commit/d34d5ee6c146cdb5765d33462d4fb0785ab2984b", "https://github.com/holgern"], "image": ["https://ipfs.busy.org/ipfs/QmZrpLZz5DcAVLKkBSUknoEs1eSR4kJEaW1ZSB8otwt6Kq", "https://ipfs.busy.org/ipfs/QmZwKFaExY7sewJbaHWnMKpnGYo5AUXeaoBmNbp1tZAWvb", "https://ipfs.busy.org/ipfs/QmXi65CUriwXJatBP2oez2Vjdje1QEfxX48qGyerw7C57Q", "https://ipfs.busy.org/ipfs/QmWykTLoBcxEroBp8LHu9HSTzCX2SMfdZzN2Jz7u1E7MCG", "https://ipfs.busy.org/ipfs/QmYMHKjzH2BP5Ne78VwK1JyZkihyDYiXBask2KA2TF61kC", "https://ipfs.busy.org/ipfs/QmZF2TKmrLMcyTecX8rtNu4fD1gCf1hAv7Wh8SiHEWFXYt", "https://ipfs.busy.org/ipfs/QmV5fymefs3Yyy8Aj5HYh9DWTJXgFecu8tGBsRQVe2RdkP"], "canonical_url": "https://hive.blog/utopian-io/@holger80/update-for-steemengine-token-class-and-command-line-tool-added"}"
created2019-03-11 13:32:51
last_update2020-05-23 14:31:24
depth0
children10
last_payout2019-03-18 13:32:51
cashout_time1969-12-31 23:59:59
total_payout_value75.316 HBD
curator_payout_value23.380 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,504
author_reputation358,857,509,568,825
root_title"Update for steemengine - token class and command line tool added"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,069,461
net_rshares140,838,949,049,179
author_curate_reward""
vote details (375)
@bubke ·
$0.06
hey, thanks again.  I am counting on you to make some easy full set delegation tool for steemmonsters..

Posted using [Partiko Android](https://steemit.com/@partiko-android)
πŸ‘  
properties (23)
authorbubke
permlinkbubke-re-holger80-update-for-steemengine-token-class-and-command-line-tool-added-20190311t163548679z
categoryutopian-io
json_metadata{"app":"partiko","client":"android"}
created2019-03-11 16:35:54
last_update2019-03-11 16:35:54
depth1
children1
last_payout2019-03-18 16:35:54
cashout_time1969-12-31 23:59:59
total_payout_value0.046 HBD
curator_payout_value0.015 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length173
author_reputation9,285,631,006,103
root_title"Update for steemengine - token class and command line tool added"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,079,502
net_rshares87,506,482,040
author_curate_reward""
vote details (1)
@holger80 ·
I will work on a command line tool :)

Posted using [Partiko Android](https://steemit.com/@partiko-android)
properties (22)
authorholger80
permlinkholger80-re-bubke-bubke-re-holger80-update-for-steemengine-token-class-and-command-line-tool-added-20190311t172346414z
categoryutopian-io
json_metadata{"app":"partiko","client":"android"}
created2019-03-11 17:23:48
last_update2019-03-11 17:23:48
depth2
children0
last_payout2019-03-18 17:23:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length107
author_reputation358,857,509,568,825
root_title"Update for steemengine - token class and command line tool added"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,081,487
net_rshares0
@cardboard ·
$0.06
You're on fire :D
πŸ‘  
properties (23)
authorcardboard
permlinkre-holger80-update-for-steemengine-token-class-and-command-line-tool-added-20190311t143321320z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2019-03-11 14:33:24
last_update2019-03-11 14:33:24
depth1
children0
last_payout2019-03-18 14:33:24
cashout_time1969-12-31 23:59:59
total_payout_value0.046 HBD
curator_payout_value0.015 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length17
author_reputation31,522,757,177,122
root_title"Update for steemengine - token class and command line tool added"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,072,514
net_rshares87,245,772,752
author_curate_reward""
vote details (1)
@helo ·
$13.29
- Good post with images and code samples.
- Good commits messages and comments in the code.
- Great advancement to bring smart contract and tokens to the Steem blockchain.

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/3/1-2-1-1-1-1-1-).

---- 
Need help? Chat with us on [Discord](https://discord.gg/uTyJkNm).

[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , , , , , , , , , , ,
properties (23)
authorhelo
permlinkre-holger80-update-for-steemengine-token-class-and-command-line-tool-added-20190311t155413616z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https://join.utopian.io/guidelines","https://review.utopian.io/result/3/1-2-1-1-1-1-1-","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2019-03-11 15:54:12
last_update2019-03-11 15:54:12
depth1
children1
last_payout2019-03-18 15:54:12
cashout_time1969-12-31 23:59:59
total_payout_value10.091 HBD
curator_payout_value3.195 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length621
author_reputation121,547,934,535,311
root_title"Update for steemengine - token class and command line tool added"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,077,356
net_rshares18,940,394,094,937
author_curate_reward""
vote details (16)
@utopian-io ·
Thank you for your review, @helo! Keep up the good work!
properties (22)
authorutopian-io
permlinkre-re-holger80-update-for-steemengine-token-class-and-command-line-tool-added-20190311t155413616z-20190314t050159z
categoryutopian-io
json_metadata"{"app": "beem/0.20.17"}"
created2019-03-14 05:02:00
last_update2019-03-14 05:02:00
depth2
children0
last_payout2019-03-21 05:02:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length56
author_reputation152,955,367,999,756
root_title"Update for steemengine - token class and command line tool added"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,279,795
net_rshares0
@partiko ·
Thank you so much for participating in the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.00% upvote! Together, let’s change the world!
properties (22)
authorpartiko
permlinkre-update-for-steemengine-token-class-and-command-line-tool-added-20190311t183113
categoryutopian-io
json_metadata"{"app": "partiko"}"
created2019-03-11 18:31:15
last_update2019-03-11 18:31:15
depth1
children0
last_payout2019-03-18 18:31:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length213
author_reputation39,207,160,334,751
root_title"Update for steemengine - token class and command line tool added"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,084,533
net_rshares0
@pennsif ·
This post has been included in the latest edition of  [**SoS Daily News**](https://steemit.com/steem/@pennsif/sosdailynewsnewsaboutthestateofsteem11march2019-fqedjj565e) - a digest of all the latest news on the Steem blockchain.
properties (22)
authorpennsif
permlinkre-holger80-update-for-steemengine-token-class-and-command-line-tool-added-20190313t011302914z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https://steemit.com/steem/@pennsif/sosdailynewsnewsaboutthestateofsteem11march2019-fqedjj565e"],"app":"steemit/0.1"}
created2019-03-13 01:13:06
last_update2019-03-13 01:13:06
depth1
children0
last_payout2019-03-20 01:13:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length228
author_reputation636,410,097,572,565
root_title"Update for steemengine - token class and command line tool added"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,184,248
net_rshares0
@steem-ua ·
$0.03
#### Hi @holger80!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
**Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
πŸ‘  
properties (23)
authorsteem-ua
permlinkre-update-for-steemengine-token-class-and-command-line-tool-added-20190311t163500z
categoryutopian-io
json_metadata"{"app": "beem/0.20.18"}"
created2019-03-11 16:35:00
last_update2019-03-11 16:35:00
depth1
children0
last_payout2019-03-18 16:35:00
cashout_time1969-12-31 23:59:59
total_payout_value0.020 HBD
curator_payout_value0.006 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length287
author_reputation23,214,230,978,060
root_title"Update for steemengine - token class and command line tool added"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,079,468
net_rshares39,306,189,020
author_curate_reward""
vote details (1)
@tipu ·
This post is supported by $5.02 @tipU upvote funded by @cardboard :)<br><strong><a href="https://steemit.com/@tipu/tipu-voting-service-quick-guide-updated-05-10-2018" rel="noopener">@tipU voting service</a></strong> always profitable, instant upvotes | <strong><a href="https://steemit.com/steem/@tipu/tipu-investors-guide" rel="noopener">For investors</a></strong>.
properties (22)
authortipu
permlinkre-update-for-steemengine-token-class-and-command-line-tool-added-20190311t143429
categoryutopian-io
json_metadata""
created2019-03-11 14:34:30
last_update2019-03-11 14:34:30
depth1
children0
last_payout2019-03-18 14:34:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length366
author_reputation55,914,851,917,880
root_title"Update for steemengine - token class and command line tool added"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,072,571
net_rshares0
@utopian-io ·
Hey, @holger80!

**Thanks for contributing on Utopian**.
We’re already looking forward to your next contribution!

**Get higher incentives and support Utopian.io!**
 Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via [SteemPlus](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
authorutopian-io
permlinkre-update-for-steemengine-token-class-and-command-line-tool-added-20190312t035926z
categoryutopian-io
json_metadata"{"app": "beem/0.20.17"}"
created2019-03-12 03:59:27
last_update2019-03-12 03:59:27
depth1
children0
last_payout2019-03-19 03:59:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length590
author_reputation152,955,367,999,756
root_title"Update for steemengine - token class and command line tool added"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,111,698
net_rshares0