-
Notifications
You must be signed in to change notification settings - Fork 4
Trades
poloniex-sdk edited this page Jan 10, 2023
·
3 revisions
get_all_trades(end_time=None, start_time=None, begins_from=None, symbols=None, **kwargs)
Get a list of all trades for an account. Currently, trade history is supported since 07/30/2021. Interval between startTime and endTime cannot exceed 90 days. If only endTime is populated then startTime will default to 7 days before endTime. If only startTime is populated then endTime will be defaulted to 7 days after startTime.
Args:
-
end_time
(int, optional): (milliseconds since UNIX epoch) Trades filled after endTime will not be retrieved. -
start_time
(int, optional): (milliseconds since UNIX epoch) Trades filled before startTime will not be retrieved. -
begins_from
(int, optional): It is 'orderId'. The query begin at 'from', and it is 0 when you first query. (use pageId value from response). -
symbols
(str, optional): One or multiple symbols separated by comma e.g. BTC_USDT,ETH_USDT
Keyword Args:
-
limit
(int, optional): Default and max value is 100. -
direction
(str, optional): PRE, NEXT The direction before or after ‘from'.
Returns:
A list of json objects with all trades made for account:
[
{
'id': (str) Trade id,
'symbol': (str) The trading symbol, like BTC_USDT,
'accountType': (str) Account type,
'orderId': (str) The associated order's id,
'side': (str) Possible sides(BUY, SELL),
'type': (str) Possible types(MARKET, LIMIT, LIMIT_MAKER),
'matchRole': (str) Possible values(MAKER, TAKER),
'createTime': (int) Trade create time,
'price': (str) Price for the order,
'quantity': (str) Quote units,
'amount': (str) Base units,
'feeCurrency': (str) Fee currency name,
'feeAmount': (str) Fee amount
},
{...},
...
]
Raises:
-
RequestError
: An error occurred communicating with trade engine.
Example:
response = client.orders().get_all_trades(limit=5)
print(response)
get_trades(order_id)
Get a list of all trades for an order specified by its orderId.
Args:
-
order_id
(str, required): The associated order's id.
Returns:
A list of json objects with all trades made for account:
[
{
'id': (str) Trade id,
'symbol': (str) The trading symbol, like BTC_USDT,
'accountType': (str) Account type,
'orderId': (str) The associated order's id,
'side': (str) Possible sides(BUY, SELL),
'type': (str) Possible types(MARKET, LIMIT, LIMIT_MAKER),
'matchRole': (str) Possible values(MAKER, TAKER),
'createTime': (int) Trade create time,
'price': (str) Price for the order,
'quantity': (str) Quote units,
'amount': (str) Base units,
'feeCurrency': (str) Fee currency name,
'feeAmount': (str) Fee amount,
'pageId': (str) A trade Id that can be used as query param 'from',
'clientOrderId': (str) Order's clientOrderId
},
{...},
...
]
Raises:
-
RequestError
: An error occurred communicating with trade engine.
Example:
response = client.orders().get_trades('21934611974062080')
print(response)