Skip to main content

Library for trading on Tristero

Project description

Tristero

PyPI version Python Support

This repository is home to Tristero's trading library.

Installation

pip install tristero

Usage

You can get started making swaps on Tristero as easily as:

import os
from tristero.client import TokenSpec, execute_swap, wait_for_completion
from eth_account import Account
from web3 import AsyncWeb3
from tristero.api import ChainID

private_key = os.getenv("EVM_PRIVATE_KEY")
account = Account.from_key(private_key)
w3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider("https://arbitrum-one-rpc.publicnode.com")) # adjust RPC endpoint as needed

res = await execute_swap(
    w3,
    account,
    TokenSpec(chain_id=ChainID.arbitrum, token_address="0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"), # USDT0(arbitrum)
    TokenSpec(chain_id=ChainID.base, token_address="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"), # USDC(base)
    10000000 # Raw token amount (no decimals). You can calculate this with amount * (10 ** decimals)
)

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

tristero-0.1.2.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tristero-0.1.2-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file tristero-0.1.2.tar.gz.

File metadata

  • Download URL: tristero-0.1.2.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.8

File hashes

Hashes for tristero-0.1.2.tar.gz
Algorithm Hash digest
SHA256 318e1f4d8f742869ec49cc240bbb873b4bec7b93ba6ed04451d0360d3903da4d
MD5 21c1fb98d61fdeee1509ea959f8c5416
BLAKE2b-256 eaf56783d1e9b05dded5d3e1b653bfcd2303f5851bea135fa4a8266f08789e0a

See more details on using hashes here.

File details

Details for the file tristero-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: tristero-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.8

File hashes

Hashes for tristero-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f75714d4eeaf0a1bcc8091b7dfb5acd67d0af7947bb4cbae8d6d8b9e20076b5e
MD5 56343a1a919385ec97a865f3960d7b35
BLAKE2b-256 d17205712811fd52b4219310569844e2a395f4d78ced562ae13d263c2452bfbf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page