Files
trade-drift-dlob/README.md
2023-05-23 12:40:57 -07:00

73 lines
1.8 KiB
Markdown

<div align="center">
<img height="120x" src="https://uploads-ssl.webflow.com/611580035ad59b20437eb024/616f97a42f5637c4517d0193_Logo%20(1)%20(1).png" />
<h1 style="margin-top:20px;">DLOB Serverfor Drift Protocol v2</h1>
<p>
<a href="https://docs.drift.trade/tutorial-keeper-bots"><img alt="Docs" src="https://img.shields.io/badge/docs-tutorials-blueviolet" /></a>
<a href="https://discord.com/channels/849494028176588802/878700556904980500"><img alt="Discord Chat" src="https://img.shields.io/discord/889577356681945098?color=blueviolet" /></a>
<a href="https://opensource.org/licenses/Apache-2.0"><img alt="License" src="https://img.shields.io/github/license/project-serum/anchor?color=blueviolet" /></a>
</p>
</div>
# Run the example client
Modify the variables at the top of `example/client.ts` to match your environment.
```shell
yarn run example
dlob orders count: 38
maxSlot from DLOB init orders: 165107666
Initialized DLOb from server
DLOB for market 0:
Asks
[13] limit 21
[12] limit 20.32
[11] limit 17.73
[10] limit 15.63
[9] limit 15.32
[8] limit 14.35
[7] limit 14.32
[6] limit 14.3
[5] limit 14.23
[4] limit 14.2
[3] vAMMNode 13.896583
[2] limit 13.896194
[1] triggerMarket 0
Bids
[0] limit 13.879792
[1] vAMMNode 13.771213
[2] limit 13.37
[3] limit 13
[4] limit 13
[5] limit 12.45
[6] limit 12
[7] limit 10.37
[8] limit 10
[9] limit 9.97
[10] limit 9.42
[11] limit 9
[12] limit 8.89
[13] limit 8
```
# Setting up
## Setup Environment
```shell
cp .env.example .env
```
Update values in `.env` accordingly
* `ANCHOR_PRIVATE_KEY`: can be a number array (as in example), or a path to a `keypair.json` as generated by `solana-keygen`, it needs to be an initialized user in order to load `DriftClient`.
* `ENV` should be a drift env: `devnet` or `mainnet-beta`
## Run
```shell
yarn run dev
```