Connect Account
Connect a new trading account (exchange account).
Endpoint
POST /api/v3/tradingAccount/connect
Description
Connects an exchange trading account using API credentials. Once connected, the trading account can be used for trading operations and portfolio management.
Authentication
Requires Bearer token authentication.
Authorization: Bearer {access_token}
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
venue | string | Yes | Exchange venue (e.g., BINANCE, COINBASE) |
apiKey | string | Yes | Exchange API key |
apiSecret | string | Yes | Exchange API secret |
apiPassphrase | string | No | API passphrase (required for some exchanges like Coinbase) |
name | string | No | Custom name for the trading account |
accountType | string | No | Account type (e.g., SPOT, MARGIN, FUTURES) |
Response
Returns the connected trading account object.
| Field | Type | Description |
|---|---|---|
tradingAccountId | string | Unique trading account identifier |
userId | string | User ID |
venue | string | Exchange venue |
name | string | Trading account name |
accountType | string | Account type |
status | string | Account status (ACTIVE, DISABLED) |
createdAt | integer | Creation timestamp (milliseconds) |
updatedAt | integer | Last update timestamp (milliseconds) |
Usage
import requests
headers = {"Authorization": f"Bearer {access_token}"}
# Connect a Binance account
response = requests.post(
"https://cadenza-api-uat.algo724.com/api/v3/tradingAccount/connect",
headers=headers,
json={
"venue": "BINANCE",
"apiKey": "your-api-key",
"apiSecret": "your-api-secret",
"name": "My Binance Account"
}
)
account = response.json()["data"]
trading_account_id = account["tradingAccountId"]
print(f"Connected trading account: {trading_account_id}")
# Connect a Coinbase account (requires passphrase)
response = requests.post(
"https://cadenza-api-uat.algo724.com/api/v3/tradingAccount/connect",
headers=headers,
json={
"venue": "COINBASE",
"apiKey": "your-api-key",
"apiSecret": "your-api-secret",
"apiPassphrase": "your-passphrase",
"name": "My Coinbase Account"
}
)
curl -X POST https://cadenza-api-uat.algo724.com/api/v3/tradingAccount/connect \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
-H "Content-Type: application/json" \
-d '{
"venue": "BINANCE",
"apiKey": "your-api-key",
"apiSecret": "your-api-secret",
"name": "My Trading Account"
}'
Example Response
{
"data": {
"tradingAccountId": "550e8400-e29b-41d4-a716-446655440000",
"userId": "user-uuid-here",
"venue": "BINANCE",
"name": "My Binance Account",
"accountType": "SPOT",
"status": "ACTIVE",
"createdAt": 1703052635110,
"updatedAt": 1703052635110
},
"success": true,
"errno": 0,
"error": null
}
Error Responses
| HTTP Code | Error | Description |
|---|---|---|
| 400 | Invalid request | Missing or invalid parameters |
| 400 | Invalid credentials | API credentials are invalid |
| 401 | Unauthorized | Invalid or expired access token |
| 403 | Forbidden | Insufficient permissions |
Example Error
{
"data": null,
"success": false,
"errno": -120001,
"error": "Invalid API credentials for BINANCE"
}
Notes
- API credentials are validated against the exchange during connection
- Credentials are stored securely and encrypted
- The trading account must have appropriate permissions on the exchange (trading, read balance, etc.)
- Some exchanges require additional fields (passphrase, specific permissions)
- Use
tradingAccount.disconnectto remove a trading account