Client / SDK for Lyra Exchange, types, automated trading algorithms, vault executors, and more.
Currently, the binary needs to be compiled from source.
git clone https://github.com/lyra-finance/cockpit.git
cd cockpit
# if cargo is not installed:
# curl https://sh.rustup.rs -sSf | sh
cargo build --releaseEvery binary from the repo (e.g. a CLI) expects a set of environment variables to be set, such as public / private keys. There are two ways of setting them:
- Create a
.env.keys.stagingand/or.env.keys.prodfiles and fill them with the env variables below.
SESSION_PRIVATE_KEY=0x0000000000000000000000000000000000000000000000000000000000000000
OWNER_PUBLIC_KEY=0x0000000000000000000000000000000000000000Make sure to never commit the secretes to the repo! The .env.keys.* patterns is present in .gitignore already.
- Set the environment variables via AWS parameter store using the following path rules:
- Add
SESSION_KEY_NAMEandOWNER_KEY_NAMEto the .env files (e.g..env.keys.stagingor.env.keys.prod)
SESSION_KEY_NAME=alice_session
OWNER_KEY_NAME=bob_owner- Use the following paths for the AWS parameter store:
"/session_keys/prod/{}"or"/session_keys/staging/{}"forSESSION_PRIVATE_KEYwhere{}is the key name ( e.g."/session_keys/prod/alice_session")"/owners/prod/{}"or"/owners/staging/{}"forOWNER_PUBLIC_KEYwhere{}is the key name ( e.g."/owners/prod/bob_owner")
The parameters should use a secret string type.
cargo build --releaseto build the release binarycargo buildto build the debug binary
The CLI is one of the several apps built by the repo. It supports sending API requests to the Lyra Exchange.
To run an API RPC request (e.g. sending an order or getting ticker), two approaches are supported:
- Create a JSON file with
rpc_params.jsonname and place the request parameters there. For example, to callpublic/get_ticker, the following json will work:
{
"instrument_name": "ETH-PERP"
}- Then call the CLI using
target/release/lyra-client rpc -m public/get_ticker -f rpc_params.json - Alternatively the json string can be supplied via
--inlineor-iparameter:target/release/lyra-client rpc -m public/get_ticker -i '{"instrument_name": "ETH-USDC"}'
The CLI also supports printing orderbook for any instrument (even if not supported by the Lyra UI):
target/release/lyra-client orderbook -i ETH-USDC
For more info: target/release/lyra-client -h.
