Learn R Programming

obAnalytics (version 0.1.1)

getSpread: Get the spread.

Description

Extracts the spread from the depth summary, removing any points in which a change to bid/ask price/volume did not occur.

Usage

getSpread(depth.summary)

Arguments

depth.summary

Value

Bid/Ask spread quote data.

Details

The spread (best bid and ask price) will change following a market order or upon the addition/cancellation of a limit order at, or within, the range of the current best bid/ask. A change to the spread that is not the result of a market order (an impact/market shock) is known as a quote.

The following table shows a market spread betwen 05:03:22.546 and 05:04:42.957. During this time, the best ask price and volume changes whilst the best bid price and volume remains static.

timestamp bid.price bid.vol ask.price
ask.vol 05:03:22.546 235.45 16235931
235.72 39375160 05:03:24.990 235.45
16235931 235.72 21211607 05:03:25.450
235.45 16235931 235.71 39375160
05:04:15.477 235.45 16235931 235.72
39058160 05:04:16.670 235.45 16235931
235.71 39058160 timestamp bid.price

Examples

Run this code

# get the last 25 quotes (changes to the spread).
with(lob.data, tail(getSpread(depth.summary), 25))

Run the code above in your browser using DataLab