You are viewing a single comment's thread from:

RE: LightHive - A light Python client for HIVE blockchain

in HiveDevs4 years ago

i see in the preview that some multiplying asterix dont show up, but they are there

global client
client=Client(keys)
def sellop(steem,exp):
op=Operation("limit_order_create",{"owner":"maxsieg","orderid":str(randint(0,10000)),"amount_to_sell":json.dumps({"amount":str(int(steem1000)),"precision":"3","nai":"@@000000021"}),"amount_to_recieve":json.dumps({"amount":str(int(steem1000*sellrate())),"precision":"3","nai":"@@000000013"}),"fill_or_kill": "false","expiration":(datetime.utcnow()+timedelta(seconds=exp)).strftime("%Y-%m-%dT%H:%M:%S")})
client.broadcast(op)

I was not sure about boolean values i tried both "false" and False. Because of the following error message i tried converting all integers into string but it still gives me this message.

RPCNodeException: Parse Error:Couldn't parse int64_t

I converted it to string so should be no integer in there? do strings have to be encoded in a certain way? python3 should be utf-8...

Sort:  

First question: why do you use json.dumps in the fields? I'll try to check broadcasting a limit_order_create, today.

For boolean values, use Python's false. False. with no "" or ''.

usin json.dumps cuz u use json.dumps to solve dictionaries in dictionaries when you write a "post" or "comment on none" operation in the docs. i would not know how to deal with dictionaries in dictionaries otherwise.