Skip to content

Commit

Permalink
feat: make limonade smart (#290)
Browse files Browse the repository at this point in the history
* checkpoint

* go

* remove unncessary dep

* go

* go

* go

* go

* go

* timeout

* go

* go

* smart limonade

* improve description

* add error handling

* restore chagne

* hermes

* hermes

* added sample config

* clarify comment, make stalenessthreshold milliseconds

* add price band

* go

* add publish time

* only update if more recent price

* evaluate staleness in isOffMarket

* remove double negative

* add interval

* improve hermes timeout:

* refactor hermes timeout

* add readme
  • Loading branch information
guibescos authored Dec 12, 2024
1 parent ee9c93d commit 3f2af65
Show file tree
Hide file tree
Showing 6 changed files with 334 additions and 14 deletions.
126 changes: 116 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions scripts/limonade/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ npm run limonade -- \
--api-key <API_KEY_FOR_LIMO_PROFILE> \
--rpc-endpoint <RPC_URL>
```

## Using Hermes prices

Limonade can use Hermes prices to only submit opportunities that are likely to be executed against (because their implied price is close to the current market price of the pair). This is done with the optional `--price-config` argument that takes in the path to a `price-config.yaml` with the assets whose prices you want subscribe to.

Please see `price-config.sample.yaml` for a sample config. The `id` field corresponds to the [Pyth Price Feed Id](https://www.pyth.network/developers/price-feed-ids) of the asset and the `mint` is simply the SPL mint of the token.
9 changes: 6 additions & 3 deletions scripts/limonade/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "limonade",
"version": "0.2.4",
"version": "0.3.0",
"description": "This script is used to submit new opportunities fetched from the limo program to the express relay.",
"main": "index.js",
"scripts": {
Expand All @@ -16,17 +16,20 @@
"devDependencies": {
"@types/node": "catalog:",
"@types/yargs": "catalog:",
"typescript": "catalog:",
"jest": "catalog:"
"jest": "catalog:",
"typescript": "catalog:"
},
"dependencies": {
"@coral-xyz/anchor": "catalog:",
"@coral-xyz/anchor-cli": "catalog:",
"@kamino-finance/limo-sdk": "catalog:",
"@pythnetwork/express-relay-js": "workspace:*",
"@pythnetwork/hermes-client": "^1.2.0",
"@solana/spl-token": "^0.4.9",
"@solana/web3.js": "catalog:",
"axios": "^1.7.3",
"bs58": "^6.0.0",
"yaml": "^2.6.1",
"yargs": "catalog:"
}
}
6 changes: 6 additions & 0 deletions scripts/limonade/price-config.sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- alias: SOL
mint: So11111111111111111111111111111111111111112
id: ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d
- alias: USDC
mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
id: eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a
Loading

0 comments on commit 3f2af65

Please sign in to comment.