Close an entire position. If you want to reduce a position, use the openPosition method in the opposite direction of the current position.
Forces the accountSubscriber to fetch account updates from rpc
Get the address for the Clearing House User's account. NOT the user's wallet address.
Optional extra accounts to subcribe to. Always subscribes to base clearing house state and market account state by default. You should only subscribe to optional extra accounts if required, to avoid overloading your RPC.
Promise
Shorthand function to subscribe to all available Clearing House State Accounts
Promise
Unsubscribe from all currently subscribed state accounts
Update the wallet to use for clearing house transactions and linked user account
Generated using TypeDoc
ClearingHouse
This class is the main way to interact with Drift Protocol. It allows you to subscribe to the various accounts where the Market's state is stored, as well as: opening positions, liquidating, settling funding, depositing & withdrawing, and more.
The default way to construct a ClearingHouse instance is using the from method. This will create an instance using the static WebSocketClearingHouseAccountSubscriber, which will use a websocket for each state account subscription. Alternatively, if you want to implement your own method of subscribing to the state accounts on the blockchain, you can implement a ClearingHouseAccountSubscriber and use it in the ClearingHouse.constructor