Skip to content

Commit

Permalink
DriftUser update for index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
3thereum authored Nov 17, 2023
1 parent 971ac53 commit 73fae35
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Note: requires Python >= 3.10.

from solana.keypair import Keypair
from driftpy.drift_client import DriftClient
from driftpy.drift_user import User
from driftpy.drift_user import DriftUser
from driftpy.constants.numeric_constants import BASE_PRECISION, AMM_RESERVE_PRECISION

from anchorpy import Provider, Wallet
Expand Down Expand Up @@ -68,12 +68,12 @@ leverage = await drift_user.get_leverage()
print('current leverage:', leverage / 10_000)

# you can also inspect other accounts information using the (authority=) flag
bigz_acc = User(drift_client, authority=PublicKey('bigZ'))
bigz_acc = DriftUser(drift_client, authority=PublicKey('bigZ'))
leverage = await bigz_acc.get_leverage()
print('bigZs leverage:', leverage / 10_000)

# clearing house user calls can be expensive on the rpc so we can cache them
drift_user = User(drift_client, use_cache=True)
drift_user = DriftUser(drift_client, use_cache=True)
await drift_user.set_cache()

# works without any rpc calls (uses the cached data)
Expand Down

0 comments on commit 73fae35

Please sign in to comment.