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

Method fetch_order_book

python/ccxt/ndax.py:674–717  ·  view source on GitHub ↗

fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data https://apidoc.ndax.io/#getl2snapshot :param str symbol: unified symbol of the market to fetch the order book for :param int [limit]: the maximum amount of order book entr

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

Source from the content-addressed store, hash-verified

672 return result
673
674 def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
675 """
676 fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
677
678 https://apidoc.ndax.io/#getl2snapshot
679
680 :param str symbol: unified symbol of the market to fetch the order book for
681 :param int [limit]: the maximum amount of order book entries to return
682 :param dict [params]: extra parameters specific to the exchange API endpoint
683 :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/?id=order-book-structure>`
684 """
685 omsId = self.safe_integer(self.options, 'omsId', 1)
686 self.load_markets()
687 market = self.market(symbol)
688 limit = 100 if (limit is None) else limit # default 100
689 request = {
690 'omsId': omsId,
691 'InstrumentId': market['id'],
692 'Depth': limit, # default 100
693 }
694 response = self.publicGetGetL2Snapshot(self.extend(request, params))
695 #
696 # [
697 # [
698 # 0, # 0 MDUpdateId
699 # 1, # 1 Number of Unique Accounts
700 # 123, # 2 ActionDateTime in Posix format X 1000
701 # 0, # 3 ActionType 0(New), 1(Update), 2(Delete)
702 # 0.0, # 4 LastTradePrice
703 # 0, # 5 Number of Orders
704 # 0.0, # 6 Price
705 # 0, # 7 ProductPairCode
706 # 0.0, # 8 Quantity
707 # 0, # 9 Side
708 # ],
709 # [97244115,1,1607456142963,0,19069.32,1,19069.31,8,0.140095,0],
710 # [97244115,0,1607456142963,0,19069.32,1,19068.64,8,0.0055,0],
711 # [97244115,0,1607456142963,0,19069.32,1,19068.26,8,0.021291,0],
712 # [97244115,1,1607456142964,0,19069.32,1,19069.32,8,0.099636,1],
713 # [97244115,0,1607456142964,0,19069.32,1,19069.98,8,0.1,1],
714 # [97244115,0,1607456142964,0,19069.32,1,19069.99,8,0.141604,1],
715 # ]
716 #
717 return self.parse_order_book(response, symbol)
718
719 def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
720 #

Callers

nothing calls this directly

Calls 6

parse_order_bookMethod · 0.95
safe_integerMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected