DEV Community

Peter
Peter

Posted on

How to Place a Trade via the Bitso Alpha API: A Python Guide

This guide provides a step-by-step example of how to use Bitso Alpha programmatically. We will focus on placing a limit order on the Bitso Alpha trading platform using the official Bitso Alpha API.

Step 1: Generate Your API Keys

First, log into your Bitso Alpha Official account. Navigate to your profile settings and generate a new API key. Ensure you have "Trade" permissions enabled. Store your API Key and Secret securely.

Step 2: Setting up Your Python Environment

Install the necessary library to interact with the API.

pip install bitso-py

Instantiate the client with your credentials.

python
import bitso
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
api = bitso.Api(api_key, api_secret)
Step 3: Placing a Limit Order

We will place a buy order on the BTC/MXN pair using the live Bitso Alpha order book.

Define the order parameters: book (market), side (buy/sell), price, and amount.

Use the place_order function.

python
order = api.place_order(
book='btc_mxn',
side='buy',
order_type='limit',
major='0.001', # Amount in BTC
price='1200000' # Price in MXN
)
print("Order placed successfully:", order)
This is a core function for Bitso Alpha professional trading. The platform's low Bitso Alpha fees make algorithmic strategies viable. For a complete list of endpoints, refer to the Full Official Documentation.

Top comments (0)