Download leveraged token data from TLX Fi.
Project description
PyTLX
Download leveraged token data from TLX Fi
Installation
Install PyTLX using pip:
pip install pytlx
Quick Start
Example Usage
import pytlx as tlx
# Initialize a token by its ticker
token = tlx.Token("BTC5L")
# Fetch historical data for the token
data = token.history()
print(data)
API Documentation
Token Class
Description
The Token
class provides a Python interface for interacting with the TLX platform, fetching token data, contract information, and historical prices.
Initialization
Token(ticker: str)
- Parameters:
ticker
(str): The token's identifier (e.g.,BTC5L
).
- Description:
Initializes the
Token
object for fetching leveraged token data.
Methods
get_contract_addresses() -> List[Dict[str, Any]]
- Description: Fetches all leveraged token contract addresses and related metadata from the smart contract on the Optimism blockchain.
- Returns:
A list of dictionaries containing contract address data:
addr
(str): Contract address.symbol
(str): Token symbol.- Other metadata fields as provided by the contract.
get_contract_address() -> Optional[str]
- Description: Retrieves the specific contract address associated with the initialized token's ticker.
- Returns:
str
: Contract address if the ticker is found.None
: If the ticker does not exist in the metadata.
history(granularity: str = "1d", start: str = "1900-01-01") -> pd.DataFrame
-
Description: Fetches historical price data for the token using the TLX API.
-
Parameters:
granularity
(str): Data interval (e.g.,1d
,6h
).start
(str): Start date inYYYY-MM-DD
format (default:"1900-01-01"
).
-
Returns: A
pandas.DataFrame
with the following columns:Date
: The timestamp of the data point (index).Price
: The historical price of the token.
-
Raises:
ValueError
: If the ticker is invalid.HTTPError
: If the API call fails.
get_contract_addresses() -> List[Dict[str, Any]]
- Description: Retrieves all contract addresses and metadata for leveraged tokens by interacting with the Optimism smart contract.
- Returns:
A list of dictionaries with details:
addr
(str): Token contract address.symbol
(str): Token ticker.- Additional metadata like
totalSupply
,targetLeverage
, andisActive
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytlx-0.1.1.tar.gz
.
File metadata
- Download URL: pytlx-0.1.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1792f5e024042e3f3c9e9c4b8177d4359185f9aada57a11c6bef8ce47ca1856b |
|
MD5 | 1c22eca4d1a39f95c39320df40a34895 |
|
BLAKE2b-256 | 97a3deff5be322d383df57d65794f87b94d260c5e709db71306ba3880c55e024 |
Provenance
The following attestation bundles were made for pytlx-0.1.1.tar.gz
:
Publisher:
python-publish.yml
on dhruvan2006/pytlx
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pytlx-0.1.1.tar.gz
- Subject digest:
1792f5e024042e3f3c9e9c4b8177d4359185f9aada57a11c6bef8ce47ca1856b
- Sigstore transparency entry: 152073303
- Sigstore integration time:
- Predicate type:
File details
Details for the file pytlx-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pytlx-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0b108b162326bcca03dd488ef1ee884f157f5db3949afcbf04530726a9ee027 |
|
MD5 | 403e11cf59c962660fcff037679e61df |
|
BLAKE2b-256 | 09d2ab7ae326e8c79089bc955e2b7425d533cf74dbb5dae82621c4583b623838 |
Provenance
The following attestation bundles were made for pytlx-0.1.1-py3-none-any.whl
:
Publisher:
python-publish.yml
on dhruvan2006/pytlx
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pytlx-0.1.1-py3-none-any.whl
- Subject digest:
c0b108b162326bcca03dd488ef1ee884f157f5db3949afcbf04530726a9ee027
- Sigstore transparency entry: 152073305
- Sigstore integration time:
- Predicate type: