Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DriftUser update for index.md #39

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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