<aside> ➡️

See the full list of input and return types with detailed explanations in the API Reference

</aside>

Initialisation

from b2b_sdk import Client, ClientOptions

# You can get those variables at the B2B section of your partner account
sdk = Client(
    ClientOptions(
        domain="b2b.swapduck.space",
        partner_id="stinky-duck-HbMytL",
        public_key="changeme",
        private_key="changeme",
    )
)

Testing

# This will call some endpoints on our side
sdk.test()

Getting the XML pairs list

<aside> ℹ️

Our XML file is based on the BestChange XML format. Currencies not present on BestChange will have IDs based on their name and network.

</aside>

xml = sdk.get_xml("my-personal-xml")
# drop the .xml extension at the end
# ex.: /rates/xml/my-personal-xml.xml -> my-personal-xml

Estimating rate

Listing currencies

currencies = sdk.list_currencies()

Getting a rate estimation

estimation = sdk.estimate_rate(
	EstimateDTO(
	  amount_left="1",
	  currency_left_name="BTC",
	  currency_left_network="BTC",
	  currency_right_name="USDT",
	  currency_right_network="TRC20",
	)
)

Order processing

Creating an order