Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

1.1 Order book

Marc Juchli edited this pageApr 28, 2018 ·6 revisions

Gdax order bookFigure 1:https://www.bitfinex.com/t/BTC:USD

Properties

The order book consists oflimit orders placed on eitherbid (representing potential buyers) orask (representing potential sellers) side of the book.The two sides are separated by thespread.For example, Figure 1 illustrates the state of the order book “BTC/USD” at some timet.The current best bid-price, on the buyer side (left), is $14,910.00 and the best ask-price, on the seller side (right), is $14,930.00.Therefore, the spread is currently $20.00 wide.

Note that the exchanges, in this case Bitfinex, define a minimal spread per asset as well as a minimum quantity to be traded).

In order to appear in either of the side of the order book, a trader is required to place an Order of typelimit.To the accumulation of unexecuted trades at the same price level in the same order book state, we refer to asorder book entry.The order book entry resides on a certainlevel in either side of the book.Furthermore, to the state of the order book at time t we refer as theorder book state.Moreover, for every executed order (e.g. trade), the order book state changes and a new state evolves.The same applies for new or amended limit orders.

What is generally regarded as the order book is oftentimes only the current state of an order book. We like to refer to that as order book state and regard the order book as a data structure that holds order book states from the past.

Implementation

The fileorderbook.py currently holds the prototype implementation of an order book.

OrderbookEntry    price : float    amount : floatOrderbookState    lastTrade : Order    buyers : [OrderbookEntry]    sellers : [OrderbookEntry]    timestamp : DatetimeOrderbook    states : [OrderbookState]

TheOrderbook holds a list ofOrderbookState which should be ordered by their timestamps.TheOrderbookState further contains the lastTrade and a two lists ofOrderbookEntry, representing the bids and asks of the particular state in time.TheOrderbookEntry (e.g. bid or ask) is contains a price and amount of the asset the trader is willing to buy or sell.

Issue:

  • #1: A more stable and efficient implementation (PyLimitBook) should be used.

Import data

Currently there are two methods implemented in order to generate an order book from historical data given a.tsv file:

  • Trades:loadFromFile(fileName)
  • States:loadFromBitfinexFile(fileName)
  • Events:loadFromEvents(fileName)
Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp