📖 OpenBook
📖 A CLI, TUI and SDK to interact with the OpenBook market on the Solana blockchain.
[!WARNING]
The current release is not yet production-ready. This project is still undergoing active development.
Table of Contents
🚀 Installation
To install openbook
cli, use the following Cargo command:
✨ Functionalities
- Fetch market info in the OpenBook market.
- Place a limit bid in the OpenBook market.
- Cancel an existing order in the OpenBook market.
- Settle balances in the OpenBook market.
- Cancel settle place order in the OpenBook market.
- Cancel settle place bid order in the OpenBook market.
- Cancel settle place ask order in the OpenBook market.
- Consume events instructions in the OpenBook market.
- Consume events permissioned instructions in the OpenBook market.
- Load orders for a specific owner in the OpenBook market.
- Find open orders accounts for a specific owner in the OpenBook market.
Usage
Before using the openbook
crate or CLI ot TUI, make sure to set the following environment variables:
[!NOTE] Certain RPC methods, like
getProgramAccounts
, are no longer available onapi.mainnet-beta.solana.com
. We recommend utilizing helius.dev as an alternative.
⌨ Usage as TUI
https://github.com/GigaDAO/openbook/assets/62179149/23b411ac-243c-4f89-b8a2-fcc021eb9fdd
[!NOTE] To interact with the openbook market by placing bids or asking, you'll need to set up an open order account for your wallet. In future releases, this crate will automatically fetch your associated open order account. However, for now, if you already have one, you'll need to set up this environment variable before launching the tui:
⌨ Usage as CLI
Fetch Market Info:
Place a limit bid order:
Place a limit ask order:
Cancel all limit orders:
Settle balances:
Cancel Settle Place Order:
Cancel Settle Place Bid Order:
Cancel Settle Place Ask Order:
Fetch all orders for current owner (bids + asks):
Make match orders transaction:
Make consume events instruction:
Make consume events permissioned instruction:
💻 Usage as Dependency
[]
= "0.0.10"
use ;
use Market;
use read_keypair;
use Side;
use CommitmentConfig;
use OrderReturnType;
async
🎨 Options
Option | Default Value | Description |
---|---|---|
place -t <TARGET_AMOUNT_QUOTE> -s <SIDE> -b <BEST_OFFSET_USDC> -e -p <PRICE_TARGET> |
- | Place a limit order with the specified parameters. |
cancel -e |
- | Cancel all existing order for the current owner. |
settle -e |
- | Settle balances in the OpenBook market. |
cancel-settle-place -u <USDC_ASK_TARGET> -b <TARGET_USDC_BID> -p <PRICE_JLP_USDC_BID> -a <ASK_PRICE_JLP_USDC> |
- | Cancel all limit orders, settle balances, and place new bid and ask orders. |
cancel-settle-place-bid -b <TARGET_SIZE_USDC_BID> -p <BID_PRICE_JLP_USDC> |
- | Cancel all limit orders, settle balances, and place a bid order. |
cancel-settle-place-ask -a <TARGET_SIZE_USDC_ASK> -p <ASK_PRICE_JLP_USDC> |
- | Cancel all limit orders, settle balances, and place an ask order. |
match --limit <LIMIT> |
- | Match orders transaction with the specified limit. |
consume --limit <LIMIT> |
- | Consume events instruction with the specified limit. |
consume-permissioned --limit <LIMIT> |
- | Consume events permissioned instruction with the specified limit. |
load |
- | Load orders for the current owner, bids + asks. |
info |
- | Fetch OpenBook market info. |
tui |
- | launch tui. |
🤝 Contributing
Contributions and feedback are welcome! If you'd like to contribute, report an issue, or suggest an enhancement, please engage with the project on GitHub. Your contributions help improve this CLI and library for the community.
📄 License
This project is licensed under the MIT License.