blocksights / blocksights-open-explorer

Other
5 stars 4 forks source link

Market overview does not show order details #9

Open sschiessl-bcp opened 2 years ago

sschiessl-bcp commented 2 years ago

See page https://blocksights.info/#/markets/XBTSX.USDT/BTS

Is it possible to give user links to the specific orders, or add optional columns that show the maker?

abitmore commented 2 years ago

I think adding a new column is better. Thanks.

abitmore commented 2 years ago

It seems the API does not return the owner of the orders: https://api.bitshares.ws/openexplorer/order_book?base=BTS&quote=XBTSX.USDT&limit=10 .

{"base":"BTS","quote":"XBTSX.USDT","bids":[{"price":"75.262190324355485951","quote":"0.532533","base":"40.07960"},{"price":"74.95094950949509495","quote":"1.111100","base":"83.27800"},...,{"price":"73.469534695346953469","quote":"1.111100","base":"81.63200"}],"asks":[{"price":"76.014488335403821384","quote":"0.524836","base":"39.89514"},...,{"price":"79.959815894891719773","quote":"44.789849","base":"3581.38808"}]}

abitmore commented 2 years ago

And it seems it's implemented with the get_order_book database API which does not return the owners.

https://github.com/bitshares/bitshares-core/blob/6.0.2/libraries/app/include/graphene/app/database_api.hpp#L583-L590

      /**
       * @brief Returns the order book for the market base:quote
       * @param base symbol name or ID of the base asset
       * @param quote symbol name or ID of the quote asset
       * @param limit depth of the order book to retrieve, for bids and asks each, capped at 50
       * @return Order book of the market
       */
      order_book get_order_book( const string& base, const string& quote, unsigned limit = 50 )const;

https://github.com/bitshares/bitshares-core/blob/6.0.2/libraries/app/include/graphene/app/api_objects.hpp#L82-L95

   struct order
   {
      string                     price;
      string                     quote;
      string                     base;
   };

   struct order_book
   {
     string                      base;
     string                      quote;
     vector< order >             bids;
     vector< order >             asks;
   };

So.. not very easy to fix :-|

sschiessl-bcp commented 2 years ago

I was playing around with using get limit orders instead of orderbook.

About orderbook: Is it straightforward to give the API a flag that then includes owner in response?

abitmore commented 2 years ago

About the API: https://github.com/cryptonomex/graphene/issues/503#issuecomment-170088270

These changes add a higher level and easier to use API for accessing public market information. The additions are based on the API used by Poloniex. See https://poloniex.com/support/api/ Public API Methods.

Of course, a traditional CEX won't let users know which order is owned by which account. But we are not a CEX. All info is on chain. So perhaps we can extend the APIs to contain more info. Sure it is possible technically. To be "ease to use", perhaps we should return order IDs, order expiration time and account names, but not only account IDs - although it means much more database queries on the server side.

On the other hand, these changes were made in year 2016, the world of CEX's has changed a lot - Poloniex is not that large now. There are lots of things for us to catch up.

abitmore commented 2 years ago

See https://github.com/bitshares/bitshares-core/pull/2638.

sschiessl-bcp commented 2 years ago

See bitshares/bitshares-core#2638.

Awesome, thanks! Will include once available