bitshares / python-bitshares

Fully featured client-side library for the BitShares Blockchain - written entirely in python.

Home Page:http://docs.pybitshares.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

market.py FIXME this call should also return whether it was a buy or sell

henryw2019 opened this issue · comments

In market.py trades() function line 256 says “# FIXME, this call should also return whether it was a buy or sell” ,When will it be fixed?

Unfortunately, the backend does not give me that kind of information. This is all I get from the API:

{'sequence': 18007003, 'date': '2019-03-25T14:49:54', 'price': '2.45217354973004456229', 'amount': '80.1799', 'value': '196.61503', 'side1_account_id': '1.2.162847', 'side2_account_id': '1.2.883285'}

Maybe the 'sequence' will be a negtive number when 'side1_account_id' is maker ?
ref url: https://bitshares.org/doxygen/database__api_8cpp_source.html
line 1640:
if( next_itr->op.is_maker ) { trade.sequence = - next_itr->key.sequence; trade.side1_account_id = next_itr->op.account_id; } else trade.side2_account_id = next_itr->op.account_id;

In the get_trade_history, I couldn't find any negative sequence id anywhere.
The only location I can see a is_maker flag is in the operation history object .. such as in 1.11.823019348:

+--------------+---------------------------------------+
| Key          | Value                                 |
+--------------+---------------------------------------+
| block_num    | 36331623                              |
| id           | 1.11.823019348                        |
| op           | [                                     |
|              |     4,                                |
|              |     {                                 |
|              |         "account_id": "1.2.880",      |
|              |         "fee": {                      |
|              |             "amount": 0,              |
|              |             "asset_id": "1.3.0"       |
|              |         },                            |
|              |         "fill_price": {               |
|              |             "base": {                 |
|              |                 "amount": 2000000,    |
|              |                 "asset_id": "1.3.535" |
|              |             },                        |
|              |             "quote": {                |
|              |                 "amount": 17500000,   |
|              |                 "asset_id": "1.3.0"   |
|              |             }                         |
|              |         },                            |
|              |         "is_maker": true,             |
|              |         "order_id": "1.7.340153426",  |
|              |         "pays": {                     |
|              |             "amount": 2000000,        |
|              |             "asset_id": "1.3.535"     |
|              |         },                            |
|              |         "receives": {                 |
|              |             "amount": 17500000,       |
|              |             "asset_id": "1.3.0"       |
|              |         }                             |
|              |     }                                 |
|              | ]                                     |
|              |                                       |
| op_in_trx    | 0                                     |
| result       | [                                     |
|              |     0,                                |
|              |     {}                                |
|              | ]                                     |
|              |                                       |
| trx_in_block | 33                                    |
| virtual_op   | 55488                                 |
+--------------+---------------------------------------+