Skip to main content

A package to enable API calls to the simpleswap.io API

Project description

SimpleSwap.io API Python Package

How to install?

pip install simpleswap

Usage:

from simpleswap import SimpleSwap



simpleswap = SimpleSwap("YOUR-API-KEY")



#...

Currency API:

Get Currency Info:
currency = simpleswap.currency.get_currency("btc")



print(currency.name) # Bitcoin
Get All Currencies Available:
currencies = simpleswap.currency.get_all_currencies()



for currency in currencies:

    print(currency.name) # Bitcoin, Ethereum, etc

Exchange API:

Create Exchange:
exchange = simpleswap.exchange.create_exchange(

    "btc",

    "eth",

    0.1,

    "0xBF651C3EC24c099C182410a0F9BF13ac9facFF92")



print(exchange.id) # abdef1234
Get Exchange by ID:
exchange = simpleswap.exchange.get_exchange("abdef1234")



print(exchange.id) # abdef1234
Get Exchanges:
after_date = datetime(2024, 9, 18, 0, 0, 0)

# or

before_date = datetime(2024, 9, 19, 0, 0, 0)



exchanges = simpleswap.exchange.get_exchanges(

    limit=50,

    offset=3,

    after_date=after_date,

    before_date=before_date)



for exchange in exchanges:

    print(exchange.id) # abdef1234
Check Exchange:
is_valid = simpleswap.exchange.check_exchange(

    "btc",

    "eth",

    0.1)



print(is_valid) # True
Get Estimated Exchanged Value:
value = simpleswap.exchange.get_estimated(

    "btc",

    "eth",

    0.1)



print(value) # 2.52735024
Get Exchange Ranges for Currency:
ranges = simpleswap.exchange.get_ranges(

    "btc",

    "eth")



print(ranges.min) # 0.001

Market API:

Get Market Info:
market_rates = simpleswap.market.get_market_info()



for market_rate in market_rates:

    print(market_rate.min) # 0.001

    print(market_rate.max) # 100

    print(market_rate.rate) # 100000.5

Pairs API:

Get Currency Pairs:
pairs = simpleswap.pairs.get_pairs("btc")



for pair in pairs:

    print(pair) # eth
Get All Currencies Pairs:
pairs = simpleswap.pairs.get_all_pairs()



for item in pairs.btc:

    print(item) # eth, etc

Don't forget to view API docs on simpleswap.io

Keep in touch with me @codingtelegrambots

Be first to join my channel for incomming updates @drkhedr_projects

Visit my websites:

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

simpleswap-1.0.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

simpleswap-1.0.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file simpleswap-1.0.0.tar.gz.

File metadata

  • Download URL: simpleswap-1.0.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for simpleswap-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c527a0eba65912d960fb798ace8cec1e9ec13310d0e8b959f3a49023f940ddf0
MD5 da4c15c18ba2f80e7c82b65945427c7d
BLAKE2b-256 1b5541a25340e2c269a9abe3ac1d21082852e567e43172d4a002cd531d355556

See more details on using hashes here.

File details

Details for the file simpleswap-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: simpleswap-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for simpleswap-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6800c0adc26d8c54032f5fed2deeecdb00e3e1bb652c45e06524ad068f667690
MD5 51e78e5f4efb168aa31dbad75524e9d5
BLAKE2b-256 806db595c8768b2014fb2a44687e6c12dd706e68c63f49e29ceaed7f5daa0068

See more details on using hashes here.

Supported by

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