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
valanced opened this issue Aug 16, 2018 · 11 comments
Closed

Document subscribe_to_market returned values #1258

valanced opened this issue Aug 16, 2018 · 11 comments
Assignees
Labels
0 Question Notification that Issue has an open question. Please reference open question within Description 5a Docs Needed Status specific to Documentation indicating the need for proper documentation to be added question

Comments

@valanced
Copy link

valanced 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
Copy link
Member

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.

@abitmore abitmore added question 0 Question Notification that Issue has an open question. Please reference open question within Description labels Aug 16, 2018
@valanced
Copy link
Author

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

@abitmore
Copy link
Member

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 ryanRfox added the 5a Docs Needed Status specific to Documentation indicating the need for proper documentation to be added label Aug 20, 2018
@ryanRfox
Copy link
Contributor

@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
Copy link

cedar-book 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
Copy link

cedar-book 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.

@valanced
Copy link
Author

valanced 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

@valanced
Copy link
Author

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

@pmconrad
Copy link
Contributor

Is there anything left to do here?

@cedar-book
Copy link

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

@pmconrad
Copy link
Contributor

Good, thanks!

@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
Labels
0 Question Notification that Issue has an open question. Please reference open question within Description 5a Docs Needed Status specific to Documentation indicating the need for proper documentation to be added question
Projects
None yet
Development

No branches or pull requests

5 participants