Bitshares-2-ui: Limit Order Create Operation issue

Started by sharique-knysys, March 24, 2016, 11:58:34 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

abit

Quote from: sharique-knysys on March 24, 2016, 11:58:34 AM
I am using bitshares2-ui library to create my app. I have created limit_order_create operation to trade currency from my app. But limit_order_create operations behaves very weird.
For example if I want 0.1 EUR for 19.98414 BTS, it shows Sell 19.98414 BTS. Then if I want 0.1 EUR for 19.99 BTS it shows Sell 199841417742.87936 BTS. Please guide me to resolve this issue. Following is the limit_order_create operation definition which takes asset type in amount_to_sell.

limit_order_create = new Serializer(
    "limit_order_create"
    fee: asset
    seller: protocol_id_type "account"
    amount_to_sell: asset
    min_to_receive: asset
    expiration: time_point_sec
    fill_or_kill: bool
    extensions: set future_extensions
)


Following is asset type definition

asset = new Serializer(
    "asset"
    amount: int64
    asset_id: protocol_id_type "asset"
)

The former is correct, but the latter is incorrect? Rounding issue? Can you paste the transaction you've built here (json format)?
BitShares committee member: abit
BitShares witness: in.abit

xeroc

in graphene .. all amounts are INTEGERS .. hence if you want to sell 19.0002 BTS  .. you need to multiply by 10^(precision) .. which is 10k for BTS.
the precision can be seen from the assets details (5 in the case of BTS with 10^5=10k)

sharique-knysys

I am using bitshares2-ui library to create my app. I have created limit_order_create operation to trade currency from my app. But limit_order_create operations behaves very weird.
For example if I want 0.1 EUR for 19.98414 BTS, it shows Sell 19.98414 BTS. Then if I want 0.1 EUR for 19.99 BTS it shows Sell 199841417742.87936 BTS. Please guide me to resolve this issue. Following is the limit_order_create operation definition which takes asset type in amount_to_sell.

limit_order_create = new Serializer(
    "limit_order_create"
    fee: asset
    seller: protocol_id_type "account"
    amount_to_sell: asset
    min_to_receive: asset
    expiration: time_point_sec
    fill_or_kill: bool
    extensions: set future_extensions
)


Following is asset type definition

asset = new Serializer(
    "asset"
    amount: int64
    asset_id: protocol_id_type "asset"
)