Python SDK for the SplitNOW API - OTC Liquidity Aggregator
Project description
SplitNOW Python SDK
Python SDK (API wrapper) for SplitNOW, the multi-wallet instant crypto exchange. 🪼
Install
pip install splitnow
Usage Example
You'll need to create a SplitNOW API key if you don't have one already:
- Create a SplitNOW account at https://splitnow.io/auth/register
- Head to the API keys page on your account dashboard at https://splitnow.io/account/api-keys
- Copy your account's API key and store it in a safe place.
This example demonstrates splitting 10 SOL evenly across 2 wallets through Binance & Bybit:
# First, import the SplitNOW SDK into your file:
from splitnow import (SplitNow, AssetId, NetworkId, WalletDistribution)
SPLITNOW_API_KEY = "replace_me" # Get a free API key at: https://splitnow.io/auth/register
# Next, initialize the SplitNOW SDK with your API key:
client = SplitNow(api_key=SPLITNOW_API_KEY)
# (Optional) Check health
health = client.get_health()
print(f"API Status: {health}")
# Step 1/3: Creating and fetching a quote
quote_data = client.create_and_fetch_quote(
from_amount=10.0,
from_asset_id=AssetId.SOL,
from_network_id=NetworkId.SOLANA,
to_asset_id=AssetId.SOL,
to_network_id=NetworkId.SOLANA,
wait_time=1.0
)
print(f"Quote ID: {quote_data.quote_id}")
print(f"Available rates: {len(quote_data.rates)}")
print("Top 5 rates (with 1% slippage buffer):")
# (Optional) Sort by rate descending
sorted_rates = sorted(quote_data.rates, key=lambda x: x.exchange_rate, reverse=True)
for rate in sorted_rates[:5]:
if rate.exchange_rate > 0:
print(f" - {rate.exchange_id}: {rate.exchange_rate:.6f}")
# Step 2/3: Creating and fetching an order
best_rate = sorted_rates[0] if sorted_rates else None
if best_rate and best_rate.exchange_rate > 0:
order_data = client.create_and_fetch_order(
quote_id=quote_data.quote_id,
from_amount=10.0,
from_asset_id=AssetId.SOL,
from_network_id=NetworkId.SOLANA,
wallet_distributions=[
WalletDistribution(
to_address="7ingPqZUYmuso5HakTLgoXjMpETpbZYzxeQBJChGrQn5",
to_pct_bips=5000, # 50%
to_asset_id=AssetId.SOL,
to_network_id=NetworkId.SOLANA,
to_exchanger_id="binance"
),
WalletDistribution(
to_address="92CzWZt7fD5ffhwkRNBKHxqHahVTPeWedd5UYmdmHjMw",
to_pct_bips=5000, # 50%
to_asset_id=AssetId.SOL,
to_network_id=NetworkId.SOLANA,
to_exchanger_id="bybit"
)
],
wait_time=1.0
)
print(f"Order ID: {order_data.order_id}")
print(f"Deposit Address: {order_data.deposit_address}")
print(f"Deposit Amount: {order_data.deposit_amount}")
# The unique deposit address and amount to send to start the order
deposit_address = order_data.deposit_address
deposit_amount = order_data.deposit_amount
order_id_for_status = order_data.order_id
else:
print("Skipped (no valid rates)")
order_id_for_status = None
# Step 3/3: Fetching an order status
if order_id_for_status:
order_status = client.get_order_status(order_id_for_status)
print(f"Order Status: {order_status.order_status}")
print(f"Status Text: {order_status.order_status_text}")
Understanding The 3-Step Flow
To ensure a seamless SplitNOW API integration for your use case, you must first understand the 3-step flow when using the SplitNOW API.
Below is a short explainer of each step so that you can best fit each step into your own software & workflows.
Step 1/3: client.create_and_fetch_quote() - Creating and fetching a quote
quote_data = client.create_and_fetch_quote(
from_amount=10.0,
from_asset_id=AssetId.SOL,
from_network_id=NetworkId.SOLANA,
to_asset_id=AssetId.SOL,
to_network_id=NetworkId.SOLANA
)
- Save
quote_data.quote_idbecause you need this value to create your order in the next step. - You'll also probably want to do something such as filter through
quote_data.ratesto see which exchanges are available and at what rate. - If the
exchange_ratekey of a rate object in thequote_data.ratesarray is0, the pair might not be supported on that exchange. - You can pick any exchange no matter what, though. Our systems fall back to the next best rate if your selection is unavailable!
Step 2/3: client.create_and_fetch_order() - Creating and fetching an order
order_data = client.create_and_fetch_order(
quote_id=quote_data.quote_id,
from_amount=10.0,
from_asset_id=AssetId.SOL,
from_network_id=NetworkId.SOLANA,
wallet_distributions=[...]
)
- Remember to pass in the
quote_idfrom the previous step! - The
order_dataobject contains important information you'll need for initiating the order:order_data.deposit_address&order_data.deposit_amount. - Once you've sent the deposit, we take care of everything else automatically!
- Save
order_data.order_idso you can check the status of your order anytime.
Step 3/3: client.get_order_status() - Fetching an order status
order_status = client.get_order_status(order_id)
- Remember to pass in the
order_idfrom the previous step! - Your 6-digit order ID is returned as
order_status.order_id. - You'll probably want to do something with
order_status.order_statussuch as update your app's client or trigger a notification once the order status changes. - If you want a human-readable order status such as for your UI, use
order_status.order_status_text. - Once
order_status.order_statusiscompleted, it's all done and the wallets are funded as requested! Enjoy!
Full Reference
This Python SDK includes 10 functions that wrap around the SplitNOW API to help you get up and running with creating quotes & orders quickly, no matter your use case:
get_health
def get_health() -> bool
- Checks whether the SplitNOW API is healthy.
- Returns: A
boolindicating API health status.
API Reference: GET /health/
get_assets
def get_assets() -> List[Asset]
- Gets a list of available asset IDs and network IDs.
- Returns: A
List[Asset]array.
💡 Pro Tip: When creating quotes & orders, the asset_id key of each Asset can be used for from_asset_id & to_asset_id.
💡 Pro Tip: When creating quotes & orders, the network_id key of a corresponding Asset can be used for from_network_id & to_network_id.
API Reference: GET /assets/
get_asset_prices
def get_asset_prices() -> Dict[str, Optional[float]]
- Gets the current USD price of each available asset by ID.
- Returns: A
Dict[str, Optional[float]]where each key is an asset ID and each value is its price.
API Reference: GET /assets/prices/
get_asset_deposit_limits
def get_asset_deposit_limits() -> List[AssetLimit]
- Gets the minimum and maximum deposit (if any) for each available asset.
- Returns: A
List[AssetLimit]array.
API Reference: GET /assets/limits/
get_exchangers
def get_exchangers() -> List[Exchanger]
- Get a list of available exchanger IDs.
- Returns: A
List[Exchanger]array.
💡 Pro Tip: When creating quotes & orders, the id key of each Exchanger can be used for to_exchanger_id.
API Reference: GET /exchangers/
create_and_fetch_quote
def create_and_fetch_quote(
from_amount: float,
from_asset_id: Union[str, AssetId],
from_network_id: Union[str, NetworkId],
to_asset_id: Union[str, AssetId],
to_network_id: Union[str, NetworkId],
wait_time: float = 1.0
) -> QuoteData
- Creates and fetches a quote.
- Parameters:
from_amount: A numerical amount of tokens to split.from_asset_id: The input asset ID returned fromget_assets.from_network_id: A corresponding input network ID returned fromget_assets.to_asset_id: The output asset ID returned fromget_assets.to_network_id: A corresponding output network ID returned fromget_assets.wait_time: Time to wait (in seconds) after creating the quote before fetching it. Default is 1.0.
- Returns: A
QuoteDataobject.
API Reference: POST /quotes/, GET /quotes/{id}
create_and_fetch_order
def create_and_fetch_order(
quote_id: str,
from_amount: float,
from_asset_id: Union[str, AssetId],
from_network_id: Union[str, NetworkId],
wallet_distributions: List[WalletDistribution],
wait_time: float = 1.0
) -> OrderData
- Creates and fetches an order.
- Parameters:
quote_id: A quote ID returned fromcreate_and_fetch_quote.from_amount: A numerical amount of tokens to split.from_asset_id: The input asset ID returned fromget_assets.from_network_id: A corresponding input network ID returned fromget_assets.wallet_distributions: AList[WalletDistribution]containing recipient wallets and distribution preferences.wait_time: Time to wait (in seconds) after creating the order before fetching it. Default is 1.0.
- Returns: An
OrderDataobject.
API Reference: POST /orders/, GET /orders/{id}
get_quote
def get_quote(quote_id: str) -> Quote
- Fetches a quote by its ID.
- Parameters:
quote_id: The quote ID to fetch.
- Returns: A
Quoteobject.
API Reference: GET /quotes/{id}
get_order
def get_order(order_id: str) -> Order
- Fetches an order by its ID.
- Parameters:
order_id: The order ID to fetch.
- Returns: An
Orderobject.
API Reference: GET /orders/{id}
get_order_status
def get_order_status(order_id: str) -> OrderStatusData
- Fetches the status of an order by its ID.
- Parameters:
order_id: The order ID to fetch.
- Returns: An
OrderStatusDataobject.
API Reference: GET /orders/{id}
Rate Limits
The default rate-limit of each API key is 60 requests per minute.
Don't hesitate to contact SplitNOW if you need more. We scale to meet any demand instantly!
Security
Never expose your SplitNOW API key to clients! If you think your API key may have been accidentally leaked, please contact support right away so that we can get you set up with a fresh one.
Compliance & Restricted Regions
Our API services are not available to users in the Restricted Regions, directly or indirectly, in accordance with our Terms of Service.
Support
- Official API docs: https://splitnow.io/api/docs
- Free 24/7 email support: support@splitnow.io
- Free community support: SplitNOW API Developers Chat
License
Unlicensed (Whitelabelled)
More information: https://unlicense.org
© 2025 SplitOTC, Ltd.
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
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 splitnow-1.0.0.tar.gz.
File metadata
- Download URL: splitnow-1.0.0.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdfeccbd1b2a76989e098ea672a4f4fe7bc6759bcb80e0af64704197ff48e31d
|
|
| MD5 |
efbf2906c7cba3eb70fed3fc9f1b751f
|
|
| BLAKE2b-256 |
7a1a7cc161148a8a6bfd53e95a14c49b93d9b900fc29cf582a64710a8fc90d9a
|
File details
Details for the file splitnow-1.0.0-py3-none-any.whl.
File metadata
- Download URL: splitnow-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d62dd4c2a60955e347859adbee3cf0c40479356f8a604bcd371fc62c0d399958
|
|
| MD5 |
e5837436d18e257af314407f86608503
|
|
| BLAKE2b-256 |
d8203fb57167a15ae2d0b91a5a4a5c3e981db9acf8f3c7dcc14149a7542f5b01
|