Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document `subscribe_to_market` returned values #1258

Closed
Magestro opened this issue Aug 16, 2018 · 11 comments

Comments

Projects
5 participants
@Magestro
Copy link

commented Aug 16, 2018

Hello!
i use this command while ws connected:

{"id":1, "method":"call","params":[0, "subscribe_to_market", [2, "1.3.0","1.3.121"]]}

I noticed, that subscribe_to_market event can return notices in the following formats:

first (guess new orders)

    [  
         {  
            "deferred_fee":578,
            "deferred_paid_fee":{  
               "amount":0,
               "asset_id":"1.3.0"
            },
            "expiration":"2023-08-16T11:17:32",
            "for_sale":114549,
            "id":"1.7.179659247",
            "sell_price":{  
               "base":{  
                  "amount":114549,
                  "asset_id":"1.3.0"
               },
               "quote":{  
                  "amount":10413,
                  "asset_id":"1.3.562"
               }
            },
            "seller":"1.2.898669"
         }
      ]
   ]

second (guess canceled orders)

["1.7.179659247", "1.7.179659247", "1.7.179659247"]

third (guess filled orders)

 [  
         [  
            4,
            {  
               "account_id":"1.2.966230",
               "fee":{  
                  "amount":0,
                  "asset_id":"1.3.0"
               },
               "fill_price":{  
                  "base":{  
                     "amount":1587491612,
                     "asset_id":"1.3.0"
                  },
                  "quote":{  
                     "amount":14318975,
                     "asset_id":"1.3.121"
                  }
               },
               "is_maker":false,
               "order_id":"1.7.179681786",
               "pays":{  
                  "amount":1002122,
                  "asset_id":"1.3.121"
               },
               "receives":{  
                  "amount":111101546,
                  "asset_id":"1.3.0"
               }
            }
         ],
         [  
            0,
            {  

            }
         ]
      ],
      [  
         [  
            4,
            {  
               "account_id":"1.2.978193",
               "fee":{  
                  "amount":1002,
                  "asset_id":"1.3.121"
               },
               "fill_price":{  
                  "base":{  
                     "amount":1587491612,
                     "asset_id":"1.3.0"
                  },
                  "quote":{  
                     "amount":14318975,
                     "asset_id":"1.3.121"
                  }
               },
               "is_maker":true,
               "order_id":"1.7.179681755",
               "pays":{  
                  "amount":111101546,
                  "asset_id":"1.3.0"
               },
               "receives":{  
                  "amount":1002122,
                  "asset_id":"1.3.121"
               }
            }
         ],
         [  
            0,
            {  

            }
         ]
      ]
   ]

But don't found in documentation what it means.
I am particularly interested in the third one: what represent object [0, {}] ? What represent first number in array(4 in current case)?

I searched for the explanations in the documentation, but did not find them.
I will be grateful for any information on this issue

@abitmore

This comment has been minimized.

Copy link
Member

commented Aug 16, 2018

I am particularly interested in the third one: what represent object [0, {}] ? What represent first number in array(4 in current case)?

  • 1.7.x is limit_order_object, see this document
  • The 3rd format is actually (operation, operation_result) pairs, related code is here:
    subscribed_markets_ops[*market].emplace_back( std::move( std::make_pair( op.op, op.result ) ) );
    • the operation is fill_order_operation
    • the operation_result currently is always [0, {}] which means void_result, because the code didn't set it (I don't know why):
      uint32_t database::push_applied_operation( const operation& op )
      {
      _applied_ops.emplace_back(op);
      operation_history_object& oh = *(_applied_ops.back());
      oh.block_num = _current_block_num;
      oh.trx_in_block = _current_trx_in_block;
      oh.op_in_trx = _current_op_in_trx;
      oh.virtual_op = _current_virtual_op++;
      return _applied_ops.size() - 1;
      }
  • 4 means fill_order_operation See this code.
@Magestro

This comment has been minimized.

Copy link
Author

commented Aug 17, 2018

@abitmore very thx!
and I'm guessing about the other types? cancel and placed orders?

@abitmore

This comment has been minimized.

Copy link
Member

commented Aug 17, 2018

The other 2, I guess they'll not only present when creating or cancelling orders, but will also present when an order is entirely filled or partially filled. You can test.

@ryanRfox

This comment has been minimized.

Copy link
Member

commented Aug 20, 2018

@Magestro Sorry, our documentation is work-in-progress. Out of curiosity, what URL(s) did you attempt to locate the information originally? I'm trying to better understand how/where new developers come into the docs. I will work with @cedar-book to ensure we capture the required information in our documentation going forward. Thanks

@cedar-book

This comment has been minimized.

Copy link

commented Aug 21, 2018

Only I had gathered this information on this page.https://dev.bitshares.works/en/master/api/objects_ids.html
I will add and update the information. Thank you.

@cedar-book

This comment has been minimized.

Copy link

commented Aug 21, 2018

@Magestro, If you are interested, only so far listed together, BitShares operations list and objects list if want to read the Detailed Descriptions. I did not know we had this information. sorry about that.

If want to research BitShares doxygen documentation (details), this page links take to the Doxygen page.

@Magestro

This comment has been minimized.

Copy link
Author

commented Aug 21, 2018

@ryanRfox i use this resources:
http://docs.bitshares.org

And this api guide:
https://github.com/bitshares/bitshares-core/wiki

I found some answers in bitshares-py lib, but it not really comfortable.
Maybe you should create an "API" section on the readme page and add a link to the bitshares/dev.bitshares.works and other related resources?

and IMHO u need more practical examples with detailed explanations.

Thank you for attention

P.S.
I think u have error on this page: http://docs.bitshares.org/api/websocket.html
near set_block_applied_callback(blockid)
this method accept int identifier

@Magestro

This comment has been minimized.

Copy link
Author

commented Aug 21, 2018

@cedar-book thank u for the given links, it will be helpfull!

@ryanRfox ryanRfox added this to To do in Feature Release (3.1.0) via automation Feb 24, 2019

@pmconrad

This comment has been minimized.

Copy link
Contributor

commented Apr 11, 2019

Is there anything left to do here?

@cedar-book

This comment has been minimized.

Copy link

commented Apr 12, 2019

@pmconrad, I do not have any. I have posted several reference links to the dev website.

@pmconrad

This comment has been minimized.

Copy link
Contributor

commented Apr 12, 2019

Good, thanks!

@pmconrad pmconrad closed this Apr 12, 2019

Feature Release (3.1.0) automation moved this from To do to Done Apr 12, 2019

@abitmore abitmore changed the title `subscribe_to_market` returned values Document `subscribe_to_market` returned values Apr 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.