Skip to content

Commit

Permalink
Add subaccounts explanation to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
samtin0x committed Sep 17, 2024
1 parent 8e17ce5 commit 6696d08
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions v4-client-py-v2/documentation/account_details.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
# Getting Account Order Information
# Getting Account and Subaccount Information

This guide demonstrates how to retrieve information about your account's orders using the dYdX Python SDK.
This guide demonstrates how to retrieve information about your account, subaccounts, and orders using the dYdX Python SDK.

## Understanding Accounts and Subaccounts

**Accounts**
- Your primary identity on dYdX, linked to your blockchain wallet address.
- Acts as a container for all your trading activities and subaccounts.

**Subaccounts**
- Separate trading entities within your main account.
- Each has its own balance, positions, orders, and trading history.
- Every account starts with subaccount 0; additional subaccounts can be created.

**Key Points**
- Subaccounts allow segregation of trading strategies and risk management.
- Losses in one subaccount don't affect others.
- Useful for separating personal trading, algorithms, or different fund allocations.

**API Usage**
- Most operations require both the account address and subaccount number.
- Example: `get_subaccount_orders(address, subaccount_number)`

## Setting Up

Expand All @@ -23,7 +43,7 @@ To retrieve all open orders for an account:
async def get_open_orders(address):
orders = await client.account.get_subaccount_orders(
address,
0,
0, # Subaccount ID
status="OPEN"
)
print("Open orders:", orders)
Expand Down

0 comments on commit 6696d08

Please sign in to comment.