Add offset to trade response
This commit is contained in:
parent
bb61250bfe
commit
0809f9aef6
@ -283,6 +283,7 @@ class OpenTradeSchema(TradeSchema):
|
|||||||
class TradeResponse(BaseModel):
|
class TradeResponse(BaseModel):
|
||||||
trades: List[TradeSchema]
|
trades: List[TradeSchema]
|
||||||
trades_count: int
|
trades_count: int
|
||||||
|
offset: int
|
||||||
total_trades: int
|
total_trades: int
|
||||||
|
|
||||||
|
|
||||||
|
@ -365,6 +365,7 @@ class RPC:
|
|||||||
return {
|
return {
|
||||||
"trades": output,
|
"trades": output,
|
||||||
"trades_count": len(output),
|
"trades_count": len(output),
|
||||||
|
"offset": offset,
|
||||||
"total_trades": Trade.get_trades([Trade.is_open.is_(False)]).count(),
|
"total_trades": Trade.get_trades([Trade.is_open.is_(False)]).count(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,9 +578,10 @@ def test_api_trades(botclient, mocker, fee, markets, is_short):
|
|||||||
)
|
)
|
||||||
rc = client_get(client, f"{BASE_URI}/trades")
|
rc = client_get(client, f"{BASE_URI}/trades")
|
||||||
assert_response(rc)
|
assert_response(rc)
|
||||||
assert len(rc.json()) == 3
|
assert len(rc.json()) == 4
|
||||||
assert rc.json()['trades_count'] == 0
|
assert rc.json()['trades_count'] == 0
|
||||||
assert rc.json()['total_trades'] == 0
|
assert rc.json()['total_trades'] == 0
|
||||||
|
assert rc.json()['offset'] == 0
|
||||||
|
|
||||||
create_mock_trades(fee, is_short=is_short)
|
create_mock_trades(fee, is_short=is_short)
|
||||||
Trade.query.session.flush()
|
Trade.query.session.flush()
|
||||||
|
Loading…
Reference in New Issue
Block a user