Author Topic: Bitshares-2-ui: Limit Order Create Operation issue  (Read 763 times)

0 Members and 1 Guest are viewing this topic.

Offline sharique-knysys

  • Newbie
  • *
  • Posts: 19
    • View Profile
Bitshares-2-ui: Limit Order Create Operation issue
« 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"
)

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12914
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Re: Bitshares-2-ui: Limit Order Create Operation issue
« Reply #1 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)
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4287
    • View Profile
    • Steemit Blog
  • BitShares: abit
  • GitHub: abitmore
Re: Bitshares-2-ui: Limit Order Create Operation issue
« Reply #2 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)?
BTS account: abit
BTS committee member: abit
BTS witness: in.abit