(self, client: Client, message)
| 762 | raise ExchangeError(self.json(message)) |
| 763 | |
| 764 | def handle_message(self, client: Client, message): |
| 765 | # |
| 766 | # public |
| 767 | # { |
| 768 | # "type": "trade", |
| 769 | # "symbol": "BTCUSD", |
| 770 | # "event_id": 122278173770, |
| 771 | # "timestamp": 1655335880981, |
| 772 | # "price": "22530.80", |
| 773 | # "quantity": "0.04", |
| 774 | # "side": "buy" |
| 775 | # } |
| 776 | # |
| 777 | # private |
| 778 | # [ |
| 779 | # { |
| 780 | # "type": "accepted", |
| 781 | # "order_id": "134150423884", |
| 782 | # "event_id": "134150423886", |
| 783 | # "account_name": "primary", |
| 784 | # "client_order_id": "1659739406916", |
| 785 | # "api_session": "account-pnBFSS0XKGvDamX4uEIt", |
| 786 | # "symbol": "batbtc", |
| 787 | # "side": "sell", |
| 788 | # "order_type": "exchange limit", |
| 789 | # "timestamp": "1659739407", |
| 790 | # "timestampms": 1659739407576, |
| 791 | # "is_live": True, |
| 792 | # "is_cancelled": False, |
| 793 | # "is_hidden": False, |
| 794 | # "original_amount": "1", |
| 795 | # "price": "1", |
| 796 | # "socket_sequence": 139 |
| 797 | # } |
| 798 | # ] |
| 799 | # |
| 800 | isArray = isinstance(message, list) |
| 801 | if isArray: |
| 802 | self.handle_order(client, message) |
| 803 | return |
| 804 | reason = self.safe_string(message, 'reason') |
| 805 | if reason == 'error': |
| 806 | self.handle_error(client, message) |
| 807 | methods = { |
| 808 | 'l2_updates': self.handle_l2_updates, |
| 809 | 'trade': self.handle_trade, |
| 810 | 'subscription_ack': self.handle_subscription, |
| 811 | 'heartbeat': self.handle_heartbeat, |
| 812 | } |
| 813 | type = self.safe_string(message, 'type', '') |
| 814 | if type.find('candles') >= 0: |
| 815 | self.handle_ohlcv(client, message) |
| 816 | return |
| 817 | method = self.safe_value(methods, type) |
| 818 | if method is not None: |
| 819 | method(client, message) |
| 820 | # handle multimarketdata |
| 821 | if type == 'update': |
nothing calls this directly
no test coverage detected