MCPcopy Create free account
hub / github.com/ccxt/ccxt / fetch_my_trades

Method fetch_my_trades

python/ccxt/pacifica.py:1084–1147  ·  view source on GitHub ↗

fetch all trades made by the user https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-trade-history :param str [symbol]: unified market symbol :param int [since]: the earliest time in ms to fetch trades for :param int [limit]: the maximum nu

(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})

Source from the content-addressed store, hash-verified

1082 return self.parse_trades(recentTrades, market, since, limit)
1083
1084 def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
1085 """
1086 fetch all trades made by the user
1087
1088 https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-trade-history
1089
1090 :param str [symbol]: unified market symbol
1091 :param int [since]: the earliest time in ms to fetch trades for
1092 :param int [limit]: the maximum number of trades structures to retrieve
1093 :param dict [params]: extra parameters specific to the exchange API endpoint
1094 :param int [params.until]: timestamp in ms of the latest trade
1095 :param str [params.account]: will default to walletAddress if not provided
1096 :param str [params.cursor]: pagination cursor from prev request(manual use)
1097 :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1098 :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/?id=trade-structure>`
1099 """
1100 self.load_markets()
1101 market = None
1102 if symbol is not None:
1103 market = self.market(symbol)
1104 paginate = False
1105 paginate, params = self.handle_option_and_params(params, 'fetchMyTrades', 'paginate', False)
1106 userAddress = None
1107 userAddress, params = self.handle_origin_and_single_address('fetchMyTrades', params)
1108 defaultLimit = 100 # Default max limit
1109 if paginate:
1110 return self.fetch_paginated_call_cursor('fetchMyTrades', symbol, since, limit, params, 'next_cursor', 'cursor', None, defaultLimit)
1111 request = {}
1112 request, params = self.handle_until_option('end_time', request, params)
1113 request['account'] = userAddress
1114 if symbol is not None:
1115 request['symbol'] = self.safe_string(market, 'id')
1116 if limit is not None:
1117 request['limit'] = limit
1118 if since is not None:
1119 request['start_time'] = since
1120 response = self.publicGetTradesHistory(self.extend(request, params))
1121 #
1122 # {
1123 # "success": True,
1124 # "data": [
1125 # {
1126 # "history_id": 19329801,
1127 # "order_id": 315293920,
1128 # "client_order_id": "acf...",
1129 # "symbol": "LDO",
1130 # "amount": "0.1",
1131 # "price": "1.1904",
1132 # "entry_price": "1.176247",
1133 # "fee": "0",
1134 # "pnl": "-0.001415",
1135 # "event_type": "fulfill_maker",
1136 # "side": "close_short",
1137 # "created_at": 1759215599188,
1138 # "cause": "normal"
1139 # },
1140 # ...
1141 # ],

Callers

nothing calls this directly

Calls 11

handle_until_optionMethod · 0.80
safe_stringMethod · 0.80
parse_tradesMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected