Skip to content

Commit

Permalink
Update 'Examples' section in index.md (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
3thereum authored Nov 15, 2023
1 parent 8ec7a73 commit 88c6e1f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ wallet = Wallet(kp)
connection = AsyncClient(config.default_http)
provider = Provider(connection, wallet)

drfit_client = DriftClient.from_config(config, provider)
drift_user = User(clearing_house)
drift_client = DriftClient.from_config(config, provider)
drift_user = User(drift_client)

# open a 10 SOL long position
sig = await drift_client.open_position(
Expand All @@ -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 = ser(clearing_house, authority=PublicKey('bigZ'))
bigz_acc = User(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(clearing_house, use_cache=True)
drift_user = User(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 88c6e1f

Please sign in to comment.