A simple CLI application to interact with Serum to place a new order in orderbook, fetch open orders, metch orders and settle funds.
To initialize a market you have to provide base and quote currencies. You can create tokens and accounts through cli as follow:
$ spl-token create-token This command generates a new token, pass it here:
$ spl-token create-account <GENERATED_TOKEN>This command generates an empty account. Next, mint some tokens as follow:
$ spl-token mint <GENERATED_TOKEN> <AMOUNT_YOU_NEED>Transfer some tokens to your wallet as follow:
$ spl-token transfer <GENERATED_TOKEN> <AMOUNT_YOU_NEED> <YOUR_WALLET_PUBKEY> --fund-recipientYou have to run those commands for creating base and quote currencies, more info is here.
To get help, run:
cargo run -- -hSupported options:
| Option | Description |
|---|---|
-h, --help |
Print help information |
-V, --version |
Print version information |
Supported subcommands:
| Subcommand | Description |
|---|---|
| init | Generate and initialize new accounts on-chain for market, request queue, event queue, bids and asks and also initialize new market |
| lend | Place a new order in orderbook for lending |
| borrow | Place a new order in orderbook for borrowing |
| fetch | Display open orders in orderbook |
| info | Display app's config information |
| clean | Remove config files |
To get help for subcommands, run:
cargo run -- init -h
cargo run -- lend -h
cargo run -- borrow -h
cargo run -- fetch -h
cargo run -- info -h
cargo run -- clean -hTo create a new market you have to initialize it as follow:
cargo run -- init --url <URL> --path <PATH_TO_YOUR_WALLET> --program-id <SERUM_DEX_PROGRAM_ID> --coin-mint <COIN_MINT> --pc-mint <PC_MINT>To place a new order in orderbook for lending or borrowing, run:
cargo run -- lend --wallet <WALLET> --coin-mint <COIN_MINT> --size <SIZE> --rate <INTEREST_RATE>
cargo run -- borrow --wallet <WALLET> --pc-mint <PC_MINT> --size <SIZE> --rate <INTEREST_RATE>Fetch open orders in orderbook:
cargo run -- fetchGet information about application configuration:
cargo run -- infoTo clean config files (running init command will be required again), run:
cargo run -- clean