BitShares Forum

Main => Technical Support => Topic started by: sharique-knysys on March 24, 2016, 11:58:34 am

Title: Bitshares-2-ui: Limit Order Create Operation issue
Post by: 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.

Code: [Select]
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

Code: [Select]
asset = new Serializer(
    "asset"
    amount: int64
    asset_id: protocol_id_type "asset"
)
Title: Re: Bitshares-2-ui: Limit Order Create Operation issue
Post by: xeroc on March 24, 2016, 12:38:31 pm
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)
Title: Re: Bitshares-2-ui: Limit Order Create Operation issue
Post by: abit on March 24, 2016, 05:09:39 pm
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.

Code: [Select]
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

Code: [Select]
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)?