Skip to main content

lotech-market-data

Python client for accessing Lotech market data from AWS Athena.

Installation

pip install lotech-market-data

For running the advanced plotting examples:

pip install lotech-market-data[examples]

Usage

Basic Example

import logging
from datetime import datetime, timezone
from lotech_market_data import LotechMarketData

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

client = LotechMarketData()

# Get time range for today
query_date = datetime.now(timezone.utc).date()
start = datetime.combine(query_date, datetime.min.time()).replace(tzinfo=timezone.utc)
end = datetime.combine(query_date, datetime.max.time()).replace(tzinfo=timezone.utc)

# Fetch top of book data
df = client.load_top_of_book(
    exchange="BINANCE",
    instrument="BTC-USDT:SPOT",
    start=start,
    end=end,
)

logger.info("Total rows: %d", df.height)

API Methods

The LotechMarketData class provides the following methods:

Market Data Methods

All market data methods accept the following parameters:

  • exchange: Single exchange string or list of exchanges (e.g., "BINANCE" or ["BINANCE", "BYBIT"])
  • instrument: Single instrument or list (e.g., "BTC-USDT:SPOT" or ["BTC-USDT:SPOT", "ETH-USDT:SPOT"])
  • start: Start datetime (timezone-aware)
  • end: End datetime (timezone-aware)
  • columns (optional): List of columns to return

Available methods:

  • load_top_of_book() - Top of book (bid/ask) data
  • load_trades() - Trade data
  • load_funding() - Funding rate data
  • load_reference_price() - Reference price data
  • load_open_interest() - Open interest data
  • load_orderbook_incremental() - Incremental orderbook updates

Instrument Static

# Get all instruments for an exchange (latest)
df = client.load_instr_static(exchange="BINANCE")

# Get all instruments at a specific datetime
df = client.load_instr_static(
    exchange="BINANCE",
    datetime=some_datetime
)

# Filter for specific instrument(s)
df = client.load_instr_static(
    exchange="BINANCE",
    instrument="BTC-USDT:SPOT"
)

df = client.load_instr_static(
    exchange="BINANCE",
    instrument=["BTC-USDT:SPOT", "ETH-USDT:SPOT"]
)

Column Filtering

You can filter columns to reduce data transfer:

df = client.load_top_of_book(
    exchange="BINANCE",
    instrument="BTC-USDT:SPOT",
    start=start,
    end=end,
    columns=["exchange", "instrument", "ingress_ts", "bid_price", "ask_price"],
)

Multiple Exchanges

Query multiple exchanges:

df = client.load_top_of_book(
    exchange=["BINANCE", "BYBIT"],
    instrument="BTC-USDT:SPOT",
    start=start,
    end=end,
)

Multiple Instruments

Query multiple instruments:

df = client.load_top_of_book(
    exchange="BINANCE",
    instrument=["BTC-USDT:SPOT", "ETH-USDT:SPOT", "SOL-USDT:SPOT"],
    start=start,
    end=end,
)

Available Exchanges

The set of exchanges is fetched dynamically from the API and reflects exactly what your API key is permissioned for — the client does not hardcode a list:

exchanges = LotechMarketData.get_available_exchanges()
logger.info("Available exchanges: %s", exchanges)

Instrument Format

Instruments follow the format: SYMBOL:KIND[:SUBKIND]

Examples:

  • BTC-USDT:SPOT - Spot market
  • BTC-USDT:PERP:LINEAR - Linear perpetual
  • BTC-USDT:PERP:INVERSE - Inverse perpetual
  • BTC-USD:FUT:LINEAR - Linear future
  • BTC-USD:FUT:INVERSE - Inverse future

Examples

Basic Examples (examples/basic/)

These examples showcase fetching each data type and display all available columns:

  • top_of_book.py - Fetch bid/ask data
  • trades.py - Fetch trade data
  • orderbook_incremental.py - Fetch orderbook updates and build orderbook
  • funding.py - Fetch funding rate data
  • open_interest.py - Fetch open interest data
  • reference_price.py - Fetch reference price data
  • instrument_static.py - Fetch instrument metadata
  • list_exchanges.py - List all available exchanges

Advanced Examples (examples/advanced/)

These examples demonstrate more complex use cases:

  • plot_btc_usdt_exchanges.py - Plot BTC-USDT mid price across multiple exchanges
  • plot_trades.py - Visualize trades with volume bars
  • analyze_instruments.py - Analyze instrument metadata with statistics
  • animate_orderbook.py - Create animated orderbook visualization
  • plot_polymarket_binary.py - Compare Polymarket binary options to GBM theoretical pricing

Example Outputs

The advanced examples generate visualizations in examples/outputs/:

BTC-USDT Mid Price Across Exchanges

BTC-USDT Exchanges

Comparison of BTC-USDT perpetual mid price across BINANCE, BYBIT, OKX, BITMART, and BITMEX exchanges showing price movements and spreads.

LTC-USDT Trades Visualization

LTC-USDT Trades

Trades visualization for LTC-USDT perpetual contracts showing taker buy/sell trades colored by exchange, with weighted mid price overlay and 30-second volume bars.

DOGE-USDT Orderbook Animation

DOGE Orderbook

Animated visualization of DOGE orderbook across 5 exchanges (BINANCE, BYBIT, OKX, COINBASEUS, BITSTAMP) showing cumulative order book depth, mid price movement, and cross-exchange dynamics at 10ms intervals.

Metadata

Release files for lotech-market-data 3.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for lotech-market-data 3.0.2
File Actions
lotech_market_data-3.0.2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl PyPy 3.11 PyPy 3.11 7.3 Linux glibc 2.17+ x86-64 Details for lotech_market_data-3.0.2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
lotech_market_data-3.0.2-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl PyPy 3.11 PyPy 3.11 7.3 Linux glibc 2.17+ ARM64 Details for lotech_market_data-3.0.2-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
lotech_market_data-3.0.2-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64 Details for lotech_market_data-3.0.2-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
lotech_market_data-3.0.2-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64 Details for lotech_market_data-3.0.2-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
lotech_market_data-3.0.2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64 Details for lotech_market_data-3.0.2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
lotech_market_data-3.0.2-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ ARM64 Details for lotech_market_data-3.0.2-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
lotech_market_data-3.0.2-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for lotech_market_data-3.0.2-cp314-cp314-macosx_11_0_arm64.whl
lotech_market_data-3.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details for lotech_market_data-3.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
lotech_market_data-3.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details for lotech_market_data-3.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
lotech_market_data-3.0.2-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for lotech_market_data-3.0.2-cp313-cp313-macosx_11_0_arm64.whl
lotech_market_data-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details for lotech_market_data-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
lotech_market_data-3.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details for lotech_market_data-3.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
lotech_market_data-3.0.2-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for lotech_market_data-3.0.2-cp312-cp312-macosx_11_0_arm64.whl
lotech_market_data-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details for lotech_market_data-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
lotech_market_data-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details for lotech_market_data-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
lotech_market_data-3.0.2-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for lotech_market_data-3.0.2-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 84.2 MB

Release files / lotech_market_data-3.0.2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lotech_market_data-3.0.2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.6 MB
Tags Linux glibc 2.17+ x86-64 PyPy 3.11 PyPy 3.11 7.3
SHA-256 checksum
How to use checksums
327ffd7e551665766cb0fd19eedfc611d7bd70ef3b119be778a71539bd4b91e1
BLAKE2b-256 checksum
How to use checksums
4f12c430ecd61342703f90aaafb83ab52a34989035f2a9bd80192bcd89db03b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL lotech_market_data-3.0.2-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.1 MB
Tags Linux glibc 2.17+ ARM64 PyPy 3.11 PyPy 3.11 7.3
SHA-256 checksum
How to use checksums
d657d2290023557cf1abf0ff4ab98deccd158d7cc94935250792912567f8e6c7
BLAKE2b-256 checksum
How to use checksums
117c48c1af12678512768930a93daf07285ae8026c58d55e5b21f195544c39e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lotech_market_data-3.0.2-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.6 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
1ae7294c7d83f175ba11410ace7c31c7b60e56a6fc2e68c761ed83b75677376b
BLAKE2b-256 checksum
How to use checksums
8757e4b888a725d8a93dd60fafd57b9921ab22f86f06f7b25f2dfd2b0c994658
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL lotech_market_data-3.0.2-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.1 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
ac6111187351d156ad303bf278297cbb6e267092331f12aca3496f423b560c83
BLAKE2b-256 checksum
How to use checksums
1fc6deedb1ba67143efb3eaa2ef7c5b7a4b396d1c2b3503559212eba854c01b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lotech_market_data-3.0.2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.6 MB
Tags CPython 3.14 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
64801ac709bd13c730f6bd57d9599e21aea7f077d23c6da9aafd481724fdb51b
BLAKE2b-256 checksum
How to use checksums
f5a2c26fa309759ad6b43c801ae1a93dd7405a9b10506512c15006c1ef2e7ebe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL lotech_market_data-3.0.2-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.1 MB
Tags CPython 3.14 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
824fc522c35288c113b51aabb1f13ddad6a159e757f603458c8a4edf405c7f33
BLAKE2b-256 checksum
How to use checksums
fd226f6e13831b201a1d7fa922cbe6150354657bd1962c305ec282c12b6a18a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-cp314-cp314-macosx_11_0_arm64.whl

Download URL lotech_market_data-3.0.2-cp314-cp314-macosx_11_0_arm64.whl
Size 5.0 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9fb686dc382f256f14c42d27d57b4287d7f57144ad944576dbbc2f73a4f6e0cb
BLAKE2b-256 checksum
How to use checksums
ae28123663c85fa0232b23fae3c4f5f02f537c91c6d38fe607c14cd97cea4123
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lotech_market_data-3.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.6 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
f6a64ca8a6b15828eb5211aaef59aaec07f379568f193b79289f6701c6b9ab58
BLAKE2b-256 checksum
How to use checksums
f2e5e35178b96f4264a1f823f94ae4b7a7153d5af0271db197061678376d5d4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL lotech_market_data-3.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.1 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
bd17d9e947bb409dee6bb9c42aa368b2a866d9e6374c513cec3086c5cf9aef25
BLAKE2b-256 checksum
How to use checksums
0a3dc9f896a7f76f326570bbe4e576ec2c355c0ede34feef3d320e0c34bc6c7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-cp313-cp313-macosx_11_0_arm64.whl

Download URL lotech_market_data-3.0.2-cp313-cp313-macosx_11_0_arm64.whl
Size 5.0 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ce1f3c3b06d73d2f4dfc753c8299cb7b2dc8e6b084c6ddf125dffb21aa2de8ef
BLAKE2b-256 checksum
How to use checksums
0e541ae9e0ca3474e8ec5b83105ec676adcf4a54336d28f79f1d45a0f501ff7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lotech_market_data-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.6 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
8c23743fa8265b6d5a638dcc2750f098ef919994a1fb6acbdec9f0f76db7f6d4
BLAKE2b-256 checksum
How to use checksums
89722865f9ebaff60d471b8ef1e0af66dc709084a992b78762be9e1c0b9bec27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL lotech_market_data-3.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.1 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
5c323ffbfbf8fdf4c336f419fb80add3d30de33501d234e6cbd655da828ccec7
BLAKE2b-256 checksum
How to use checksums
3b865acc25f8732d6b3dff991ac2477d4d64329b10add12a25816a6a25276d41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-cp312-cp312-macosx_11_0_arm64.whl

Download URL lotech_market_data-3.0.2-cp312-cp312-macosx_11_0_arm64.whl
Size 5.0 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e7f8e4d4d10f430407e14021a3ce148149c862366ffc4175694c98c3ff2cb0e0
BLAKE2b-256 checksum
How to use checksums
7d6599dc2bde960a410a58cff51b09aa4abb886b5ca9f0de2919862ab8bf008b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lotech_market_data-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.6 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
929883267d90957d1e6132066f0b0551db86c7b9a3495c2a993f58e8ec52701c
BLAKE2b-256 checksum
How to use checksums
141532d3f91d91b4c0e4eb8509bf747e67e69d0e9bbce5ca2f7af88628dbe172
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL lotech_market_data-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.1 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
6ad7e4b31ca91f20a8ccd57613352ee55a0334dde97b65328f7ce76f392d1bf2
BLAKE2b-256 checksum
How to use checksums
dbb64cfed6f29f320c45faeae1e5e352edfbd059201f51c940e6af017a5171b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lotech_market_data-3.0.2-cp311-cp311-macosx_11_0_arm64.whl

Download URL lotech_market_data-3.0.2-cp311-cp311-macosx_11_0_arm64.whl
Size 5.0 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a94c7761ae1ebca83877449759dbd4beab7addda2ea06f0703a853874f5ea2c6
BLAKE2b-256 checksum
How to use checksums
882ae59454588e22791d5ab38990c76eeac8e0d283651d2ed8ffe13af4b1732a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for lotech-market-data 3.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page