[API] How to get best bid/ask?

Started by monsterer, October 20, 2015, 07:57:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

monsterer

Quote from: xeroc on October 24, 2015, 07:33:55 PM
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.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

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

sittingduck

Usd precision is 4 digits.  Bts is 5 digits

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.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

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.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

roadscape

http://cryptofresh.com  |  witness: roadscape

monsterer

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

bytemaster

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: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
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.

maqifrnswa

Quote from: monsterer on October 20, 2015, 08:21:18 PM
Quote from: maqifrnswa on October 20, 2015, 08:03:47 PM
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: [url="https://launchpad.net/~showard314/+archive/ubuntu/bitshares"]https://launchpad.net/~showard314/+archive/ubuntu/bitshares[/url] [15% delegate] wallet_account_set_approval maqifrnswa true [50% delegate] wallet_account_set_approval delegate1.maqifrnswa true

monsterer

Quote from: maqifrnswa on October 20, 2015, 08:03:47 PM
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.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

maqifrnswa

Quote from: monsterer on October 20, 2015, 07:57:05 PM
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: [url="https://launchpad.net/~showard314/+archive/ubuntu/bitshares"]https://launchpad.net/~showard314/+archive/ubuntu/bitshares[/url] [15% delegate] wallet_account_set_approval maqifrnswa true [50% delegate] wallet_account_set_approval delegate1.maqifrnswa true

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.
[url="https://metaexchange.info"]https://metaexchange.info[/url] | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads