Unified instrument spec parser and venue symbol resolver for crypto markets
Project description
marketspec
Unified instrument spec parser and venue symbol resolver for crypto markets.
- Parse
BTC/USDT:USDT,BTC/USD:USD-20251227,ETH-20251226-2500-C. - Resolve symbols for Binance and Bybit.
- No runtime dependencies. Typed. MIT.
Install
pip install marketspec
Quick start
from marketspec import venue_symbol
print(venue_symbol("binance", "BTC/USDT:USDT")) # BTCUSDT
print(venue_symbol("bybit", "BTC/USD:USD-20251227")) # BTCUSD_20251227
print(venue_symbol("binance", "ETH-20251226-2500-C")) # ETH-20251226-2500-C
Grammar
- Spot:
BASE/QUOTE→BTC/USDT - Swap (linear):
BASE/QUOTE:SETTLEwhereSETTLE == QUOTEand is a stable →BTC/USDT:USDT - Swap (inverse):
BASE/QUOTE:USD→BTC/USD:USD - Future: append
-YYYYMMDDto the swap form →BTC/USDT:USDT-20251227 - Option:
BASE-YYYYMMDD-STRIKE-C|P→ETH-20251226-2500-C
Supported venues
binancebybit
PRs welcome for more venues.
Development
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .
pytest -q
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
marketspec-0.1.0.tar.gz
(5.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file marketspec-0.1.0.tar.gz.
File metadata
- Download URL: marketspec-0.1.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0935eb16891f6617aec864a7eb28fbf0132bbfddee64fd9662bb17b009833a81
|
|
| MD5 |
33a7da5fde980c53e0f3e337dab3286e
|
|
| BLAKE2b-256 |
36ad1b36be31466673494719d83c5d0387bcf2d91ce13b864ab8847a7cf0e0ac
|
File details
Details for the file marketspec-0.1.0-py3-none-any.whl.
File metadata
- Download URL: marketspec-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9d97479aa77d2fca5d0581d156459b597ce920ffc635118b4442226cd65c74b
|
|
| MD5 |
7fc0bcb802f39ecdf856ad6c13f2431d
|
|
| BLAKE2b-256 |
d10b2632511babb49ca4372d3a739f8d739a546da41f827a121233b1aff03838
|