limit package - fastlob

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
Toggle table of contents sidebar

# limit package

## Submodules

## limit.limit module

A limit is a collection of limit orders sitting at a certain price.

class fastlob.limit.limit.Limit(price)

  Bases: `object`

  A limit is a collection of limit orders sitting at a certain price.

  cancel_order(order)

    Cancel an order.

    Return type:

      `None`

  deepempty()

    Check if limit contains zero orders.

  delete_fakeorder()

    Deletes the current fake order, if fake order is not set, it does nothing.

    Return type:

      `None`

  empty()

    Check if limit contains zero valid orders, not if the limit queue is empty.

    Return type:

      `bool`

  enqueue(order)

    Add (enqueue) an order to the limit order queue.

  fakeorder_exists()

    True if limit contains a fake order.

    Return type:

      `bool`

  fill_all()

    Fill all orders in limit.

  fill_next(quantity)

    Partially fill the next order in the queue. Filling it entirely would lead to problems, to only use in last stage of order execution (engine._partial_fill_order).

  next_order()

    Returns the next order to be matched by an incoming market order.

    Return type:

      `Order`

  notional()

    Notional = limit price * limit volume.

    Return type:

      `Decimal`

  pop_next_order()

    Pop from the queue the next order to be executed. Does not return it, only removes it.

    Return type:

      `None`

  price()

    Getter for limit price.

    Return type:

      `Decimal`

  real_orders()

    Getter for number of orders placed by the user = (valid_orders - 1 if limit has a fake order).

    Return type:

      `int`

  set_fakeorder(order)

    Set order as the new limit fake order. This method first deletes the previous order.

    Return type:

      `None`

  valid_orders()

    Getter for limit size (number of orders).

    Return type:

      `int`

  view()

    Returns a pretty-print view of the limit.

    Return type:

      `str`

  volume()

    Getter for limit volume (sum of orders quantity).

    Return type:

      `Decimal`

## Module contents

A limit is a collection of limit orders sitting at a certain price.