# Getting started
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
## Install
``` sh
$ pip install lobster-tools
```
## How to use
``` python
data = Data(ticker="AMZN", date_range="2012-06-21", load="both")
lobster = Lobster(data=data)
```
/nfs/home/nicolasp/anaconda3/envs/lob/lib/python3.11/site-packages/lobster_tools/preprocessing.py:320: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value '[]' has dtype incompatible with int8, please explicitly cast to a compatible dtype first.
df.loc[df.event.eq(Event.ORIGINAL_TRADING_HALT.value), "event"] = df.loc[
``` python
lobster.messages.head()
```
| | time | event | order_id | size | price | direction |
|-------------------------------|--------------|-------|----------|------|--------|-----------|
| datetime | | | | | | |
| 2012-06-21 09:30:00.017459617 | 34200.017460 | 5 | 0 | 1 | 223.82 | -1 |
| 2012-06-21 09:30:00.189607670 | 34200.189608 | 1 | 11885113 | 21 | 223.81 | 1 |
| 2012-06-21 09:30:00.189607670 | 34200.189608 | 1 | 3911376 | 20 | 223.96 | -1 |
| 2012-06-21 09:30:00.189607670 | 34200.189608 | 1 | 11534792 | 100 | 223.75 | 1 |
| 2012-06-21 09:30:00.189607670 | 34200.189608 | 1 | 1365373 | 13 | 224.00 | -1 |
``` python
lobster.book.head()
```
| | ask_price_1 | ask_size_1 | bid_price_1 | bid_size_1 | ask_price_2 | ask_size_2 | bid_price_2 | bid_size_2 | ask_price_3 | ask_size_3 | bid_price_3 | bid_size_3 | ask_price_4 | ask_size_4 | bid_price_4 | bid_size_4 | ask_price_5 | ask_size_5 | bid_price_5 | bid_size_5 |
|-------------------------------|-------------|------------|-------------|------------|-------------|------------|-------------|------------|-------------|------------|-------------|------------|-------------|------------|-------------|------------|-------------|------------|-------------|------------|
| datetime | | | | | | | | | | | | | | | | | | | | |
| 2012-06-21 09:30:00.017459617 | 223.95 | 100.0 | 223.18 | 100.0 | 223.99 | 100.0 | 223.07 | 200.0 | 224.00 | 220.0 | 223.04 | 100.0 | 224.25 | 100.0 | 223.00 | 10.0 | 224.40 | 547.0 | 222.62 | 100.0 |
| 2012-06-21 09:30:00.189607670 | 223.95 | 100.0 | 223.81 | 21.0 | 223.99 | 100.0 | 223.18 | 100.0 | 224.00 | 220.0 | 223.07 | 200.0 | 224.25 | 100.0 | 223.04 | 100.0 | 224.40 | 547.0 | 223.00 | 10.0 |
| 2012-06-21 09:30:00.189607670 | 223.95 | 100.0 | 223.81 | 21.0 | 223.96 | 20.0 | 223.18 | 100.0 | 223.99 | 100.0 | 223.07 | 200.0 | 224.00 | 220.0 | 223.04 | 100.0 | 224.25 | 100.0 | 223.00 | 10.0 |
| 2012-06-21 09:30:00.189607670 | 223.95 | 100.0 | 223.81 | 21.0 | 223.96 | 20.0 | 223.75 | 100.0 | 223.99 | 100.0 | 223.18 | 100.0 | 224.00 | 220.0 | 223.07 | 200.0 | 224.25 | 100.0 | 223.04 | 100.0 |
| 2012-06-21 09:30:00.189607670 | 223.95 | 100.0 | 223.81 | 21.0 | 223.96 | 20.0 | 223.75 | 100.0 | 223.99 | 100.0 | 223.18 | 100.0 | 224.00 | 233.0 | 223.07 | 200.0 | 224.25 | 100.0 | 223.04 | 100.0 |
``` python
(
lobster.messages.query(f"event == {Event.HIDDEN_EXECUTION.value}")
.query(f"direction == -1")
.head()
)
```
| | time | event | order_id | size | price | direction |
|-------------------------------|--------------|-------|----------|------|--------|-----------|
| datetime | | | | | | |
| 2012-06-21 09:30:00.017459617 | 34200.017460 | 5 | 0 | 1 | 223.82 | -1 |
| 2012-06-21 09:30:00.372779672 | 34200.372780 | 5 | 0 | 100 | 223.84 | -1 |
| 2012-06-21 09:30:00.375671205 | 34200.375671 | 5 | 0 | 100 | 223.84 | -1 |
| 2012-06-21 09:30:00.383971366 | 34200.383971 | 5 | 0 | 100 | 223.86 | -1 |
| 2012-06-21 09:30:00.385815710 | 34200.385816 | 5 | 0 | 100 | 223.86 | -1 |
Raw data
{
"_id": null,
"home_page": "https://github.com/n-petit/lobster-tools",
"name": "lobster-tools",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": "",
"keywords": "LOBSTER LOB nbdev jupyter notebook python",
"author": "Nicolas Petit",
"author_email": "nicolas.petit@keble.ox.ac.uk",
"download_url": "https://files.pythonhosted.org/packages/7e/82/486b0d7e3a9079cc3bc2af20b0676da16b05d8f518d39e9af6fa50d68598/lobster-tools-0.0.17.tar.gz",
"platform": null,
"description": "# Getting started\n\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n## Install\n\n``` sh\n$ pip install lobster-tools\n```\n\n## How to use\n\n``` python\ndata = Data(ticker=\"AMZN\", date_range=\"2012-06-21\", load=\"both\")\nlobster = Lobster(data=data)\n```\n\n /nfs/home/nicolasp/anaconda3/envs/lob/lib/python3.11/site-packages/lobster_tools/preprocessing.py:320: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value '[]' has dtype incompatible with int8, please explicitly cast to a compatible dtype first.\n df.loc[df.event.eq(Event.ORIGINAL_TRADING_HALT.value), \"event\"] = df.loc[\n\n``` python\nlobster.messages.head()\n```\n\n| | time | event | order_id | size | price | direction |\n|-------------------------------|--------------|-------|----------|------|--------|-----------|\n| datetime | | | | | | |\n| 2012-06-21 09:30:00.017459617 | 34200.017460 | 5 | 0 | 1 | 223.82 | -1 |\n| 2012-06-21 09:30:00.189607670 | 34200.189608 | 1 | 11885113 | 21 | 223.81 | 1 |\n| 2012-06-21 09:30:00.189607670 | 34200.189608 | 1 | 3911376 | 20 | 223.96 | -1 |\n| 2012-06-21 09:30:00.189607670 | 34200.189608 | 1 | 11534792 | 100 | 223.75 | 1 |\n| 2012-06-21 09:30:00.189607670 | 34200.189608 | 1 | 1365373 | 13 | 224.00 | -1 |\n\n``` python\nlobster.book.head()\n```\n\n| | ask_price_1 | ask_size_1 | bid_price_1 | bid_size_1 | ask_price_2 | ask_size_2 | bid_price_2 | bid_size_2 | ask_price_3 | ask_size_3 | bid_price_3 | bid_size_3 | ask_price_4 | ask_size_4 | bid_price_4 | bid_size_4 | ask_price_5 | ask_size_5 | bid_price_5 | bid_size_5 |\n|-------------------------------|-------------|------------|-------------|------------|-------------|------------|-------------|------------|-------------|------------|-------------|------------|-------------|------------|-------------|------------|-------------|------------|-------------|------------|\n| datetime | | | | | | | | | | | | | | | | | | | | |\n| 2012-06-21 09:30:00.017459617 | 223.95 | 100.0 | 223.18 | 100.0 | 223.99 | 100.0 | 223.07 | 200.0 | 224.00 | 220.0 | 223.04 | 100.0 | 224.25 | 100.0 | 223.00 | 10.0 | 224.40 | 547.0 | 222.62 | 100.0 |\n| 2012-06-21 09:30:00.189607670 | 223.95 | 100.0 | 223.81 | 21.0 | 223.99 | 100.0 | 223.18 | 100.0 | 224.00 | 220.0 | 223.07 | 200.0 | 224.25 | 100.0 | 223.04 | 100.0 | 224.40 | 547.0 | 223.00 | 10.0 |\n| 2012-06-21 09:30:00.189607670 | 223.95 | 100.0 | 223.81 | 21.0 | 223.96 | 20.0 | 223.18 | 100.0 | 223.99 | 100.0 | 223.07 | 200.0 | 224.00 | 220.0 | 223.04 | 100.0 | 224.25 | 100.0 | 223.00 | 10.0 |\n| 2012-06-21 09:30:00.189607670 | 223.95 | 100.0 | 223.81 | 21.0 | 223.96 | 20.0 | 223.75 | 100.0 | 223.99 | 100.0 | 223.18 | 100.0 | 224.00 | 220.0 | 223.07 | 200.0 | 224.25 | 100.0 | 223.04 | 100.0 |\n| 2012-06-21 09:30:00.189607670 | 223.95 | 100.0 | 223.81 | 21.0 | 223.96 | 20.0 | 223.75 | 100.0 | 223.99 | 100.0 | 223.18 | 100.0 | 224.00 | 233.0 | 223.07 | 200.0 | 224.25 | 100.0 | 223.04 | 100.0 |\n\n``` python\n(\n lobster.messages.query(f\"event == {Event.HIDDEN_EXECUTION.value}\")\n .query(f\"direction == -1\")\n .head()\n)\n```\n\n| | time | event | order_id | size | price | direction |\n|-------------------------------|--------------|-------|----------|------|--------|-----------|\n| datetime | | | | | | |\n| 2012-06-21 09:30:00.017459617 | 34200.017460 | 5 | 0 | 1 | 223.82 | -1 |\n| 2012-06-21 09:30:00.372779672 | 34200.372780 | 5 | 0 | 100 | 223.84 | -1 |\n| 2012-06-21 09:30:00.375671205 | 34200.375671 | 5 | 0 | 100 | 223.84 | -1 |\n| 2012-06-21 09:30:00.383971366 | 34200.383971 | 5 | 0 | 100 | 223.86 | -1 |\n| 2012-06-21 09:30:00.385815710 | 34200.385816 | 5 | 0 | 100 | 223.86 | -1 |\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Python package for working with LOBSTER data, the Nasdaq limit order book data.",
"version": "0.0.17",
"project_urls": {
"Homepage": "https://github.com/n-petit/lobster-tools"
},
"split_keywords": [
"lobster",
"lob",
"nbdev",
"jupyter",
"notebook",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8d211cce8f99bafd9e63c9f886e1beef63a31796e4f96016890c06feeee75b7f",
"md5": "09fab7cc6e1bb5b08dd72eb6aaf0aed0",
"sha256": "9753fd74c6d071756156e7239564cf689d7172a4fbbb05ab94e3bf8e9422a66f"
},
"downloads": -1,
"filename": "lobster_tools-0.0.17-py3-none-any.whl",
"has_sig": false,
"md5_digest": "09fab7cc6e1bb5b08dd72eb6aaf0aed0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 26354,
"upload_time": "2024-01-22T20:32:30",
"upload_time_iso_8601": "2024-01-22T20:32:30.840199Z",
"url": "https://files.pythonhosted.org/packages/8d/21/1cce8f99bafd9e63c9f886e1beef63a31796e4f96016890c06feeee75b7f/lobster_tools-0.0.17-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7e82486b0d7e3a9079cc3bc2af20b0676da16b05d8f518d39e9af6fa50d68598",
"md5": "3b06b8ef0c9b6844d086473e76c523a3",
"sha256": "a14d1f0d401d9338f22e5c5c715786e9bc89a06599152a4f2a154d41dfa5a5a0"
},
"downloads": -1,
"filename": "lobster-tools-0.0.17.tar.gz",
"has_sig": false,
"md5_digest": "3b06b8ef0c9b6844d086473e76c523a3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 26350,
"upload_time": "2024-01-22T20:32:32",
"upload_time_iso_8601": "2024-01-22T20:32:32.205914Z",
"url": "https://files.pythonhosted.org/packages/7e/82/486b0d7e3a9079cc3bc2af20b0676da16b05d8f518d39e9af6fa50d68598/lobster-tools-0.0.17.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-22 20:32:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "n-petit",
"github_project": "lobster-tools",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "lobster-tools"
}