Returns the order book for a given market, as well as a sequence
        number for use with the Push API and an indicator specifying whether
        the market is frozen. You may set currencyPair to "all" to get the
        order books of all markets.
181046
def returnOrderBook(self, currencyPair='all', depth='50'):
        """"""
        return self._public('returnOrderBook', currencyPair=currencyPair,
                            depth=depth)
1073378
public static OrderBook adaptOrders(CampBXOrderBook orderBook, CurrencyPair currencyPair) {

    List<LimitOrder> asks = createOrders(currencyPair, Order.OrderType.ASK, orderBook.getAsks());
    List<LimitOrder> bids = createOrders(currencyPair, Order.OrderType.BID, orderBook.getBids());
    return new OrderBook(null, asks, bids);
  }
96379
public static CryptonitGenericOrder adaptOrder(
      String orderId, CryptonitOrderStatusResponse cryptonitOrderStatusResponse) {

    CryptonitOrderTransaction[] cryptonitTransactions =
        cryptonitOrderStatusResponse.getTransactions();
    CurrencyPair currencyPair = null;
    Date date = null;
    BigDecimal averagePrice = null;
    BigDecimal cumulativeAmount = null;
    BigDecimal totalFee = null;
    // Use only the first transaction, because we assume that for a single order id all transactions
    // will
    // be of the same currency pair
    if (cryptonitTransactions.length > 0) {
      currencyPair = adaptCurrencyPair(cryptonitTransactions[0]);
      date = cryptonitTransactions[0].getDatetime();

      averagePrice =
          Arrays.stream(cryptonitTransactions)
              .map(t -> t.getPrice())
              .reduce((x, y) -> x.add(y))
              .get()
              .divide(BigDecimal.valueOf(cryptonitTransactions.length), 2);

      cumulativeAmount =
          Arrays.stream(cryptonitTransactions)
              .map(t -> getBaseCurrencyAmountFromCryptonitTransaction(t))
              .reduce((x, y) -> x.add(y))
              .get();

      totalFee =
          Arrays.stream(cryptonitTransactions)
              .map(t -> t.getFee())
              .reduce((x, y) -> x.add(y))
              .get();
    }

    OrderStatus orderStatus =
        adaptOrderStatus(cryptonitOrderStatusResponse.getStatus(), cryptonitTransactions.length);

    CryptonitGenericOrder cryptonitGenericOrder =
        new CryptonitGenericOrder(
            null, // not discernable from response data
            null, // not discernable from the data
            currencyPair,
            orderId,
            date,
            averagePrice,
            cumulativeAmount,
            totalFee,
            orderStatus);

    return cryptonitGenericOrder;
  }
531318
def __placeSellShortOrder(self, tick):
        ''' '''
        share=math.floor(self.__strategy.getAccountCopy().getCash() / float(tick.close))
        sellShortOrder=Order(accountId=self.__strategy.accountId,
                                  action=Action.SELL_SHORT,
                                  is_market=True,
                                  security=self.__security,
                                  share=share)

        if self.__strategy.placeOrder(sellShortOrder):
            self.__buyOrder=sellShortOrder

            # place stop order
            stopOrder=Order(accountId=self.__strategy.accountId,
                          action=Action.BUY_TO_COVER,
                          is_stop=True,
                          security=self.__security,
                          price=tick.close * 1.05,
                          share=0 - share)
            self.__placeStopOrder(stopOrder)
1033288
def place_market_order(self, side: Side, amount: Number) -> Order:
        """"""
        return self.place_order(side, OrderType.MARKET, amount)
1216236
def _register_order_book_channels(self):
        
        channels = {'order_book': self.btcusd_ob_callback,
                    'order_book_btceur': self.btceur_ob_callback,
                    'order_book_eurusd': self.eurusd_ob_callback,
                    'order_book_xrpusd': self.xrpusd_ob_callback,
                    'order_book_xrpeur': self.xrpeur_ob_callback,
                    'order_book_xrpbtc': self.xrpbtc_ob_callback}

        event = 'data'
        self._bind_channels(event, channels)
861633
def price_range(self):
        
        ordered = self.variants.order_by('base_price')
        if ordered:
            return ordered.first().price, ordered.last().price
        else:
            return None, None
730774
@Override
  public String placeMarketOrder(MarketOrder marketOrder) throws IOException {
    WexExchangeInfo wexExchangeInfo = ((WexExchange) exchange).getWexExchangeInfo();
    LimitOrder order = WexAdapters.createLimitOrder(marketOrder, wexExchangeInfo);
    return placeLimitOrder(order);
  }
384465
def get_orderbook(self):
        
        if self in self.parent.books.keys():
            return self.parent.books[self]

        return {
            "bid": [0], "bidsize": [0],
            "ask": [0], "asksize": [0]
        }
481682
def get_currency_symbols(self) -> List[str]:
        
        result = []
        currencies = self.currencies.get_book_currencies()
        for cur in currencies:
            result.append(cur.mnemonic)
        return result
121922
public static OrderBook adaptOrderBook(
      BTCTurkOrderBook btcTurkOrderBook, CurrencyPair currencyPair) {
    List<LimitOrder> asks =
        createOrders(currencyPair, Order.OrderType.ASK, btcTurkOrderBook.getAsks());
    List<LimitOrder> bids =
        createOrders(currencyPair, Order.OrderType.BID, btcTurkOrderBook.getBids());
    return new OrderBook(btcTurkOrderBook.getTimestamp(), asks, bids);
  }
914739
public WexOrderInfoResult getBTCEOrderInfo(Long orderId) throws IOException {

    WexOrderInfoReturn btceOrderInfo =
        btce.OrderInfo(apiKey, signatureCreator, exchange.getNonceFactory(), orderId);

    checkResult(btceOrderInfo);

    return btceOrderInfo.getReturnValue().values().iterator().next();
  }
36151
public static Trade adaptTrade(
      LakeBTCTradeResponse tx, CurrencyPair currencyPair, int timeScale) {

    final String tradeId = String.valueOf(tx.getId());
    Date date = DateUtils.fromMillisUtc(tx.getAt() * timeScale); // polled order
    // books provide
    // a timestamp
    // in seconds,
    // stream in ms
    return new Trade(null, tx.getAmount(), currencyPair, tx.getTotal(), date, tradeId);
  }
649956
def orders(self) -> List[Order]:
        
        return list(
            trade.order for trade in self.wrapper.trades.values())
115906
def currencies(self) -> CurrenciesAggregate:
        
        if not self.__currencies_aggregate:
            self.__currencies_aggregate = CurrenciesAggregate(self.book)
        return self.__currencies_aggregate
340740
def buy_market_order(self, amount):
        
        amount = str(amount)
        self._log("buy {} {} at market price".format(amount, self.major))
        return self._rest_client.post(
            endpoint='/buy',
            payload={'book': self.name, 'amount': amount}
        )
1249347
def from_dict(data, ctx):
        

        type = data.get("type")

        if type == "MARKET_ORDER":
            return MarketOrderTransaction.from_dict(data, ctx)
        if type == "ORDER_FILL":
            return OrderFillTransaction.from_dict(data, ctx)
        if type == "ORDER_CANCEL":
            return OrderCancelTransaction.from_dict(data, ctx)
        if type == "MARKET_ORDER_REJECT":
            return MarketOrderRejectTransaction.from_dict(data, ctx)
        if type == "TRADE_CLIENT_EXTENSIONS_MODIFY":
            return TradeClientExtensionsModifyTransaction.from_dict(data, ctx)
        if type == "TRADE_CLIENT_EXTENSIONS_MODIFY_REJECT":
            return TradeClientExtensionsModifyRejectTransaction.from_dict(data, ctx)
        if type == "TAKE_PROFIT_ORDER":
            return TakeProfitOrderTransaction.from_dict(data, ctx)
        if type == "STOP_LOSS_ORDER":
            return StopLossOrderTransaction.from_dict(data, ctx)
        if type == "TRAILING_STOP_LOSS_ORDER":
            return TrailingStopLossOrderTransaction.from_dict(data, ctx)
        if type == "ORDER_CANCEL_REJECT":
            return OrderCancelRejectTransaction.from_dict(data, ctx)
        if type == "TAKE_PROFIT_ORDER_REJECT":
            return TakeProfitOrderRejectTransaction.from_dict(data, ctx)
        if type == "STOP_LOSS_ORDER_REJECT":
            return StopLossOrderRejectTransaction.from_dict(data, ctx)
        if type == "TRAILING_STOP_LOSS_ORDER_REJECT":
            return TrailingStopLossOrderRejectTransaction.from_dict(data, ctx)
        if type == "CLIENT_CONFIGURE":
            return ClientConfigureTransaction.from_dict(data, ctx)
        if type == "CLIENT_CONFIGURE_REJECT":
            return ClientConfigureRejectTransaction.from_dict(data, ctx)
        if type == "CREATE":
            return CreateTransaction.from_dict(data, ctx)
        if type == "CLOSE":
            return CloseTransaction.from_dict(data, ctx)
        if type == "REOPEN":
            return ReopenTransaction.from_dict(data, ctx)
        if type == "TRANSFER_FUNDS":
            return TransferFundsTransaction.from_dict(data, ctx)
        if type == "TRANSFER_FUNDS_REJECT":
            return TransferFundsRejectTransaction.from_dict(data, ctx)
        if type == "FIXED_PRICE_ORDER":
            return FixedPriceOrderTransaction.from_dict(data, ctx)
        if type == "LIMIT_ORDER":
            return LimitOrderTransaction.from_dict(data, ctx)
        if type == "LIMIT_ORDER_REJECT":
            return LimitOrderRejectTransaction.from_dict(data, ctx)
        if type == "STOP_ORDER":
            return StopOrderTransaction.from_dict(data, ctx)
        if type == "STOP_ORDER_REJECT":
            return StopOrderRejectTransaction.from_dict(data, ctx)
        if type == "MARKET_IF_TOUCHED_ORDER":
            return MarketIfTouchedOrderTransaction.from_dict(data, ctx)
        if type == "MARKET_IF_TOUCHED_ORDER_REJECT":
            return MarketIfTouchedOrderRejectTransaction.from_dict(data, ctx)
        if type == "ORDER_CLIENT_EXTENSIONS_MODIFY":
            return OrderClientExtensionsModifyTransaction.from_dict(data, ctx)
        if type == "ORDER_CLIENT_EXTENSIONS_MODIFY_REJECT":
            return OrderClientExtensionsModifyRejectTransaction.from_dict(data, ctx)
        if type == "MARGIN_CALL_ENTER":
            return MarginCallEnterTransaction.from_dict(data, ctx)
        if type == "MARGIN_CALL_EXTEND":
            return MarginCallExtendTransaction.from_dict(data, ctx)
        if type == "MARGIN_CALL_EXIT":
            return MarginCallExitTransaction.from_dict(data, ctx)
        if type == "DELAYED_TRADE_CLOSURE":
            return DelayedTradeClosureTransaction.from_dict(data, ctx)
        if type == "DAILY_FINANCING":
            return DailyFinancingTransaction.from_dict(data, ctx)
        if type == "RESET_RESETTABLE_PL":
            return ResetResettablePLTransaction.from_dict(data, ctx)

        data = data.copy()

        return Transaction(**data)