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.1

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.1
File Actions
lotech_market_data-3.0.1-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.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
lotech_market_data-3.0.1-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.1-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
lotech_market_data-3.0.1-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.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
lotech_market_data-3.0.1-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.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
lotech_market_data-3.0.1-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.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
lotech_market_data-3.0.1-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.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
lotech_market_data-3.0.1-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for lotech_market_data-3.0.1-cp314-cp314-macosx_11_0_arm64.whl
lotech_market_data-3.0.1-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.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
lotech_market_data-3.0.1-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.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
lotech_market_data-3.0.1-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for lotech_market_data-3.0.1-cp313-cp313-macosx_11_0_arm64.whl
lotech_market_data-3.0.1-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.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
lotech_market_data-3.0.1-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.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
lotech_market_data-3.0.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for lotech_market_data-3.0.1-cp312-cp312-macosx_11_0_arm64.whl
lotech_market_data-3.0.1-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.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
lotech_market_data-3.0.1-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.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
lotech_market_data-3.0.1-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for lotech_market_data-3.0.1-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 84.1 MB

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

Download URL lotech_market_data-3.0.1-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
c374a94ce8856b1bd36efe4ffb8343c26e2d0ee9e3d77d1118ab96a85e187b0a
BLAKE2b-256 checksum
How to use checksums
0d72ef6350fbded87d0e16d0d487bb4cf8ff013409c835e8c9905683f1d21139
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.1-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL lotech_market_data-3.0.1-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
ae28df8d16c2d8215742e6186c6e45fdb12f6d9fa05ebcd5a375d30862edc10d
BLAKE2b-256 checksum
How to use checksums
a83f32b2c1402767ecbaa5b36e339d11c788a80479644faf4b958e50ac54e80f
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.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lotech_market_data-3.0.1-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
0ec337b614b368b977e1f2914485cfef8206b0e6b5bc70b9421a09d51dd8de6b
BLAKE2b-256 checksum
How to use checksums
79b20d5acbd4d40656c08b5ff988308dfe185b16aacc5f8b250c5cdf4ae505c5
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.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL lotech_market_data-3.0.1-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
0e93be073b371807ea47eac839d55d02a5773070315a6e8df8c496645aab07da
BLAKE2b-256 checksum
How to use checksums
af21b8eb7e9a27052b1a4d327a9673628be23eff2b3eecc3a309526220991295
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.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lotech_market_data-3.0.1-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
940a48d921b8f4c80da05ac89bc220fcce0122bb486a688dd985ca586ae9a513
BLAKE2b-256 checksum
How to use checksums
9e4cf272877fcdd2c2b46990c392e14f4169e4d8396b3e4efe6db0b90c1f41cf
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.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL lotech_market_data-3.0.1-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
55a4250cb5bb1398455407cdab521297ebf9a7507afe726cff73861b61e58ed2
BLAKE2b-256 checksum
How to use checksums
ef8e74725ad646a60f7a8a2a99daad3432812f59631b74694fd572341037eabb
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.1-cp314-cp314-macosx_11_0_arm64.whl

Download URL lotech_market_data-3.0.1-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
8662a3cf128a9f34a59b07a39911527b837a8900ea5b7c8230e7c43c54ff17c5
BLAKE2b-256 checksum
How to use checksums
9059418eb6e919c482601cb870f1e388f892edb4453a252d286ad8c9b40ddf16
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.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lotech_market_data-3.0.1-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
d0d067dc39184da75aaf4977d3550e0a41457a4ddbee109529b7a3da05432ffa
BLAKE2b-256 checksum
How to use checksums
d68515a909075d82f354f4bee2f7b9c629cb9dd90c02f41b09b4652e08a36e3e
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.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL lotech_market_data-3.0.1-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
56057acada791573bf412158fdcd0640dc592e8dd79b1fab7805b871b30ea653
BLAKE2b-256 checksum
How to use checksums
b09b7fc95648fccbfbd7658e1f94abc912c39aaca3ff219138195fc8117a67c4
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.1-cp313-cp313-macosx_11_0_arm64.whl

Download URL lotech_market_data-3.0.1-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
e332d8d4db01afeb647356ea36061d5b56f45f492a8b7520e2cb045670a64d78
BLAKE2b-256 checksum
How to use checksums
e3d1772ae58bed3f04edd046c3c3acc0ca9e24c4afd27cc0c39aff042a875df6
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.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lotech_market_data-3.0.1-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
5de120623f92ccc8617154cc3b7a0ad29d2fb990d4956c93ed03f96d03a284f7
BLAKE2b-256 checksum
How to use checksums
3a4ce9c4db0119ae9363e8c0c68c5ea77083d78f1194a868c536f986bd13a9db
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.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL lotech_market_data-3.0.1-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
4b4d83dfc56431bb90e26ccce9b7fc565097d29984779704ff8392015ae9fce8
BLAKE2b-256 checksum
How to use checksums
888107bae56a0e9f2c2e51091307bd37ae7782ae23983f33fdd5520c2b2fab3f
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.1-cp312-cp312-macosx_11_0_arm64.whl

Download URL lotech_market_data-3.0.1-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
a8881a9be9dc562e7fdb3d923974f2ddf4971645c09a489e85e3d25ac165075e
BLAKE2b-256 checksum
How to use checksums
63c612bea6d4357f7a1e0160727b9e46b671fb624bc54eff8d95c89ca263cb2f
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.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lotech_market_data-3.0.1-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
597c8d9f9ed869e0206ee50ff287851cb228a4787c541baf8aa752dbdd9ece26
BLAKE2b-256 checksum
How to use checksums
625f56b9c478f4b3559d8ef1c734e803b7d694d8cbc09c714ca521297c662fdc
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.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL lotech_market_data-3.0.1-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
3a8332c0415520465c846f14b373fc2a1fab5acadd01630f806bd2870ce7481f
BLAKE2b-256 checksum
How to use checksums
c7023b82b4a76fda4a2423c8d0b6e17be03bddb74ae9c7a0ada6204c229ab24f
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.1-cp311-cp311-macosx_11_0_arm64.whl

Download URL lotech_market_data-3.0.1-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
dc7a16dc790c504545688f565e91a77dc4dcc281976e9ad7fdced6da11dbad97
BLAKE2b-256 checksum
How to use checksums
a59ff7f81a626b53e79eb687c477d966fef7c23d1b749bae40216745debaa46a
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.1

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