bitshares / python-bitshares

Fully featured client-side library for the BitShares Blockchain - written entirely in python.
http://docs.pybitshares.com/
MIT License
163 stars 166 forks source link

FillOrder is always of type sell #251

Closed richard-kovachev-axway closed 2 years ago

richard-kovachev-axway commented 5 years ago

Hello guys im currently working on a project and i found an issue with Notify when FillOrder is sent

See here: https://github.com/bitshares/python-bitshares/blob/1946721d429fedaa3ddd96fab7b9348d2ba8cf4e/bitshares/price.py#L245-L246

And when we go to Price in Graphenelib common price

https://github.com/xeroc/python-graphenelib/blob/ba3702a25498f56a8ade8b855b812e7ec00311e2/graphenecommon/price.py#L122-L131

if args[0]["receives"]["asset_id"] == base_asset["id"]: you will see that it always will be of type sell because base asset is receives in both cases

my solution is to check is_maker to reverse the type:

if order['is_maker']:
   base_asset = kwargs.get("base_asset", order["pays"]["asset_id"])
else:
   base_asset = kwargs.get("base_asset", order["receives"]["asset_id"])
xeroc commented 5 years ago

could, could you send a pullrequest, please?