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

Method handle_order_book

python/ccxt/pro/bitget.py:796–908  ·  view source on GitHub ↗
(self, client: Client, message)

Source from the content-addressed store, hash-verified

794 return orderbook
795
796 def handle_order_book(self, client: Client, message):
797 #
798 # {
799 # "action":"snapshot",
800 # "arg":{
801 # "instType":"SPOT",
802 # "channel":"books5",
803 # "instId":"BTCUSDT"
804 # },
805 # "data":[
806 # {
807 # "asks":[
808 # ["21041.11","0.0445"],
809 # ["21041.16","0.0411"],
810 # ["21041.21","0.0421"],
811 # ["21041.26","0.0811"],
812 # ["21041.65","1.9465"]
813 # ],
814 # "bids":[
815 # ["21040.76","0.0417"],
816 # ["21040.71","0.0434"],
817 # ["21040.66","0.1141"],
818 # ["21040.61","0.3004"],
819 # ["21040.60","1.3357"]
820 # ],
821 # "checksum": -1367582038,
822 # "ts":"1656413855484"
823 # }
824 # ]
825 # }
826 #
827 # {
828 # "action": "snapshot",
829 # "arg": {"instType": "usdt-futures", "topic": "books", "symbol": "BTCUSDT"},
830 # "data": [
831 # {
832 # "a": [Array],
833 # "b": [Array],
834 # "checksum": 0,
835 # "pseq": 0,
836 # "seq": "1343064377779269632",
837 # "ts": "1755937421270"
838 # }
839 # ],
840 # "ts": 1755937421337
841 # }
842 #
843 arg = self.safe_value(message, 'arg')
844 channel = self.safe_string_2(arg, 'channel', 'topic')
845 instType = self.safe_string_lower(arg, 'instType')
846 marketType = 'spot' if (instType == 'spot') else 'contract'
847 marketId = self.safe_string_2(arg, 'instId', 'symbol')
848 market = self.safe_market(marketId, None, None, marketType)
849 symbol = market['symbol']
850 messageHash = 'orderbook:' + symbol
851 data = self.safe_value(message, 'data')
852 rawOrderBook = self.safe_value(data, 0)
853 timestamp = self.safe_integer(rawOrderBook, 'ts')

Callers 1

handle_messageMethod · 0.95

Calls 15

handle_deltasMethod · 0.95
safe_valueMethod · 0.80
safe_string_2Method · 0.80
safe_string_lowerMethod · 0.80
safe_integerMethod · 0.80
counted_order_bookMethod · 0.80
safe_list_2Method · 0.80
handle_optionMethod · 0.80
safe_stringMethod · 0.80
order_bookMethod · 0.80
resolveMethod · 0.65
rangeFunction · 0.50

Tested by

no test coverage detected