query for balance and get the amount of funds available for trading or funds locked in orders https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-account-info :param dict [params]: extra parameters specific to the exchange API endpoint :param str [p
(self, params={})
| 583 | }) |
| 584 | |
| 585 | def fetch_balance(self, params={}) -> Balances: |
| 586 | """ |
| 587 | query for balance and get the amount of funds available for trading or funds locked in orders |
| 588 | |
| 589 | https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-account-info |
| 590 | |
| 591 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 592 | :param str [params.account]: will default to walletAddress if not provided |
| 593 | :returns dict: a `balance structure <https://docs.ccxt.com/?id=balance-structure>` |
| 594 | """ |
| 595 | userAccount = None |
| 596 | userAccount, params = self.handle_origin_and_single_address('fetchBalance', params) |
| 597 | request = { |
| 598 | 'account': userAccount, |
| 599 | } |
| 600 | response = self.publicGetAccount(self.extend(request, params)) |
| 601 | # { |
| 602 | # "success": True, |
| 603 | # "data": { |
| 604 | # "balance": "2000.000000", |
| 605 | # "fee_level": 0, |
| 606 | # "maker_fee": "0.00015", |
| 607 | # "taker_fee": "0.0004", |
| 608 | # "account_equity": "2150.250000", |
| 609 | # "available_to_spend": "1800.750000", |
| 610 | # "available_to_withdraw": "1500.850000", |
| 611 | # "pending_balance": "0.000000", |
| 612 | # "total_margin_used": "349.500000", |
| 613 | # "cross_mmr": "420.690000", |
| 614 | # "positions_count": 2, |
| 615 | # "orders_count": 3, |
| 616 | # "stop_orders_count": 1, |
| 617 | # "updated_at": 1716200000000, |
| 618 | # "use_ltp_for_stop_orders": False |
| 619 | # }, |
| 620 | # "error": null, |
| 621 | # "code": null |
| 622 | # } |
| 623 | data = self.safe_dict(response, 'data', {}) |
| 624 | result = { |
| 625 | 'info': data, |
| 626 | } |
| 627 | result['free'] = {} |
| 628 | result['used'] = {} |
| 629 | result['total'] = {} |
| 630 | totalBalance = self.safe_number(data, 'account_equity') |
| 631 | usedMargin = self.safe_number(data, 'total_margin_used') |
| 632 | freeBalance = self.safe_number(data, 'available_to_spend') |
| 633 | result['total']['USDC'] = totalBalance |
| 634 | result['used']['USDC'] = usedMargin |
| 635 | result['free']['USDC'] = freeBalance |
| 636 | timestamp = self.safe_integer(data, 'updated_at') |
| 637 | result['timestamp'] = timestamp |
| 638 | result['datetime'] = self.iso8601(timestamp) |
| 639 | return self.safe_balance(result) |
| 640 | |
| 641 | def fetch_leverage(self, symbol: str, params={}) -> Leverage: |
| 642 | """ |
nothing calls this directly
no test coverage detected