Author Topic: [API] How to get best bid/ask?  (Read 2394 times)

0 Members and 1 Guest are viewing this topic.

Offline monsterer

Precision is part of get_asset .. that will make any pai robust .. you can take a look at the last third of the pricefeed script

Thanks, got it - turned out I had my base quote precisions around the wrong way :)
My opinions do not represent those of metaexchange unless explicitly stated.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Precision is part of get_asset .. that will make any pai robust .. you can take a look at the last third of the pricefeed script

Offline sittingduck

  • Sr. Member
  • ****
  • Posts: 246
    • View Profile
Usd precision is 4 digits.  Bts is 5 digits

Offline monsterer

Still struggling with this - best I can figure is all the values returned by this function are 10 times too big?

Anyone know how to get a price robustly from this data?
My opinions do not represent those of metaexchange unless explicitly stated.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline monsterer

Ok, for clarity's sake, say I want to get the best bid, priced in USD for market BTS/USD - which order is it (1/2), and which sell price is it (base/quote)?
My opinions do not represent those of metaexchange unless explicitly stated.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline roadscape

Here's a good resource for future reference:
http://docs.bitshares.eu/api/database.html

Also this.. but a bit outdated:
https://bitshares.org/doxygen/
http://cryptofresh.com  |  witness: roadscape

Offline monsterer

My opinions do not represent those of metaexchange unless explicitly stated.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline bytemaster

Code: [Select]
get_limit_orders USD BTS 1
[{
    "id": "1.7.1148",
    "expiration": "2020-10-20T17:33:00",
    "seller": "1.2.18208",
    "for_sale": 8033,
    "sell_price": {
      "base": {
        "amount": 18533,
        "asset_id": "1.3.121"
      },
      "quote": {
        "amount": 49112450,
        "asset_id": "1.3.0"
      }
    }
  },{
    "id": "1.7.1139",
    "expiration": "2020-10-20T16:45:29",
    "seller": "1.2.32886",
    "for_sale": 260000000,
    "sell_price": {
      "base": {
        "amount": 260000000,
        "asset_id": "1.3.0"
      },
      "quote": {
        "amount": 100000,
        "asset_id": "1.3.121"
      }
    }
  }
]
unlocked >>> get_limit_orders BTS USD 1
get_limit_orders BTS USD 1
[{
    "id": "1.7.1139",
    "expiration": "2020-10-20T16:45:29",
    "seller": "1.2.32886",
    "for_sale": 260000000,
    "sell_price": {
      "base": {
        "amount": 260000000,
        "asset_id": "1.3.0"
      },
      "quote": {
        "amount": 100000,
        "asset_id": "1.3.121"
      }
    }
  },{
    "id": "1.7.1148",
    "expiration": "2020-10-20T17:33:00",
    "seller": "1.2.18208",
    "for_sale": 8033,
    "sell_price": {
      "base": {
        "amount": 18533,
        "asset_id": "1.3.121"
      },
      "quote": {
        "amount": 49112450,
        "asset_id": "1.3.0"
      }
    }
  }
]
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline maqifrnswa

  • Hero Member
  • *****
  • Posts: 661
    • View Profile
gets the best of both sides.

Documentation is found in the source for now.
https://github.com/bitshares/bitshares-2/blob/bitshares/libraries/wallet/include/graphene/wallet/wallet.hpp

Ok, great, its ordered, so:

get_limit_orders BTS USD 1 will get me the best bid ask?

Or is it:

get_limit_orders USD BTS 1

?

both will get you the same data, just the order the data is received is reversed. Best is to try both and see what the data looks like. The concept of bid/ask is a little ambiguous as the only operation is to "sell" on asset for another.
maintains an Ubuntu PPA: https://launchpad.net/~showard314/+archive/ubuntu/bitshares [15% delegate] wallet_account_set_approval maqifrnswa true [50% delegate] wallet_account_set_approval delegate1.maqifrnswa true

Offline monsterer

gets the best of both sides.

Documentation is found in the source for now.
https://github.com/bitshares/bitshares-2/blob/bitshares/libraries/wallet/include/graphene/wallet/wallet.hpp

Ok, great, its ordered, so:

get_limit_orders BTS USD 1 will get me the best bid ask?

Or is it:

get_limit_orders USD BTS 1

?
My opinions do not represent those of metaexchange unless explicitly stated.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline maqifrnswa

  • Hero Member
  • *****
  • Posts: 661
    • View Profile
I'm looking at cli_wallet, all I can find is get_limit_orders, but there is no documentation.

Is that just one side of the book? Are the results ordered? Is there a better way to get the orderbook?

gets the best of both sides.

Documentation is found in the source for now.
https://github.com/bitshares/bitshares-2/blob/bitshares/libraries/wallet/include/graphene/wallet/wallet.hpp
maintains an Ubuntu PPA: https://launchpad.net/~showard314/+archive/ubuntu/bitshares [15% delegate] wallet_account_set_approval maqifrnswa true [50% delegate] wallet_account_set_approval delegate1.maqifrnswa true

Offline monsterer

I'm looking at cli_wallet, all I can find is get_limit_orders, but there is no documentation.

Is that just one side of the book? Are the results ordered? Is there a better way to get the orderbook?
My opinions do not represent those of metaexchange unless explicitly stated.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads