Skip to content

Commit

Permalink
Improve network setup v2 client docs
Browse files Browse the repository at this point in the history
  • Loading branch information
samtin0x committed Sep 17, 2024
1 parent 8e17ce5 commit d6fac07
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 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
10 changes: 5 additions & 5 deletions v4-client-py-v2/documentation/network_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ CUSTOM_NETWORK = Network(
"https://your-custom-rest-url.com",
"wss://your-custom-websocket-url.com/ws",
NodeConfig(
"your-chain-id",
secure_channel("your-node-url.com:443"),
"your-address-prefix",
"your-denom",
),
"dydx-testnet-4",
secure_channel("test-dydx-grpc.kingnodes.com"),
"adv4tnt",
"ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
),
)
```

Expand Down

0 comments on commit d6fac07

Please sign in to comment.