Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
beem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
beem
Commits
c96afa47
Commit
c96afa47
authored
6 years ago
by
Holger
Browse files
Options
Downloads
Patches
Plain Diff
Add conversion of datetime objects to timestamp in get_steem_per_mvest
parent
8f871977
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beem/steem.py
+9
-4
9 additions, 4 deletions
beem/steem.py
with
9 additions
and
4 deletions
beem/steem.py
+
9
−
4
View file @
c96afa47
...
...
@@ -11,8 +11,9 @@ import re
import
os
import
math
import
ast
import
time
from
beemgraphenebase.py23
import
bytes_types
,
integer_types
,
string_types
,
text_type
from
datetime
import
datetime
,
timedelta
from
datetime
import
datetime
,
timedelta
,
date
from
beemapi.steemnoderpc
import
SteemNodeRPC
from
beemapi.exceptions
import
NoAccessApi
,
NoApiWithName
from
beemgraphenebase.account
import
PrivateKey
,
PublicKey
...
...
@@ -29,7 +30,7 @@ from .exceptions import (
from
.wallet
import
Wallet
from
.steemconnect
import
SteemConnect
from
.transactionbuilder
import
TransactionBuilder
from
.utils
import
formatTime
,
resolve_authorperm
,
derive_permlink
,
remove_from_dict
from
.utils
import
formatTime
,
resolve_authorperm
,
derive_permlink
,
remove_from_dict
,
addTzInfo
from
beem.constants
import
STEEM_VOTE_REGENERATION_SECONDS
,
STEEM_100_PERCENT
,
STEEM_1_PERCENT
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -444,11 +445,15 @@ class Steem(object):
def
get_steem_per_mvest
(
self
,
time_stamp
=
None
,
use_stored_data
=
True
):
"""
Returns the MVEST to STEEM ratio
:param
datetime
time_stamp: (optional) if set, return an estimated
:param
int
time_stamp: (optional) if set, return an estimated
STEEM per MVEST ratio for the given time stamp. If unset the
current ratio is returned (default).
current ratio is returned (default).
(can also be a datetime object)
"""
if
time_stamp
is
not
None
:
if
isinstance
(
time_stamp
,
(
datetime
,
date
)):
time_stamp
=
addTzInfo
(
time_stamp
)
epoch
=
addTzInfo
(
datetime
(
1970
,
1
,
1
))
time_stamp
=
(
time_stamp
-
epoch
)
//
timedelta
(
seconds
=
1
)
a
=
2.1325476281078992e-05
b
=
-
31099.685481490847
a2
=
2.9019227739473682e-07
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment