Skip to content

Commit

Permalink
Merge pull request #27 from script3/position-management
Browse files Browse the repository at this point in the history
Position management
  • Loading branch information
mootz12 authored Dec 7, 2024
2 parents 588ffe0 + 8b2993b commit ac8f90d
Show file tree
Hide file tree
Showing 31 changed files with 2,765 additions and 1,609 deletions.
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ For an example config file that is configured to interact with [Blend v1 mainnet
| `blndAddress` | The address of the BLND token contract. |
| `keypair` | The secret key for the bot's auction creating account. This should be different from the fillers as auction creation and auction bidding can happen simultaneously. **Keep this secret and secure!** |
| `fillers` | A list of accounts that will bid and fill on auctions. |
| `priceSources` | A list of assets that will have prices sourced from exchanges instead of the pool oracle. |
| `priceSources` | (Optional) A list of assets that will have prices sourced from exchanges instead of the pool oracle. |
| `profits` | (Optional) A list of auction profits to define different profit percentages used for matching auctions.
| `slackWebhook` | (Optional) A slack webhook URL to post updates to (https://hooks.slack.com/services/). Leave undefined if no webhooks are required. |

#### Fillers
Expand All @@ -64,8 +65,10 @@ The `fillers` array contains configurations for individual filler accounts. The
|-------|-------------|
| `name` | A unique name for this filler account. Used in logs and slack notifications. |
| `keypair` | The secret key for this filler account. **Keep this secret and secure!** |
| `minProfitPct` | The minimum profit percentage required for the filler to bid on an auction. |
| `minHealthFactor` | The minimum health factor the filler will take on during liquidation and bad debt auctions. |
| `primaryAsset` | The primary asset the filler will use as collateral in the pool. |
| `defaultProfitPct` | The default profit percentage required for the filler to bid on an auction, as a decimal. (e.g. 0.08 = 8%) |
| `minHealthFactor` | The minimum health factor the filler will take on during liquidation and bad debt auctions, as calculated by `collateral / liabilities`. |
| `minPrimaryCollateral` | The minimum amount of the primary asset the Filler will maintain as collateral in the pool. |
| `forceFill` | Boolean flag to indicate if the bot should force fill auctions even if profit expectations aren't met to ensure pool health. |
| `supportedBid` | An array of asset addresses that this filler bot is allowed to bid with. Bids are taken as additional liabilities (dTokens) for liquidation and bad debt auctions, and tokens for interest auctions. Must include the `backstopTokenAddress` to bid on interest auctions. |
| `supportedLot` | An array of asset addresses that this filler bot is allowed to receive. Lots are given as collateral (bTokens) for liquidation auctions and tokens for interest and bad debt auctions. The filler should have trustlines to all assets that are Stellar assets. Must include `backstopTokenAddress` to bid on bad debt auctions. |
Expand All @@ -86,6 +89,18 @@ Each price source has the following fields:
| `type` | The type of price source (e.g., "coinbase", "binance"). |
| `symbol` | The trading symbol used by the price source for this asset. |

#### Profits

The `profits` list defines target profit percentages based on the assets that make up the bid and lot of a given auction. This allows fillers to have flexability in the profit they target. The profit percentage chosen will be the first entry in the `profits` list that supports all bid and lot assets in the auction. If no profit entry is found, the `defaultProfitPct` value defined by the filler will be used.

Each profit entry has the following fields:

| Field | Description |
|-------|-------------|
| `profitPct` | The profit percentage required to bid for the auction, as a decimal. (e.g. 0.08 = 8%) |
| `supportedBid` | An array of asset addresses that the auction bid can contain for this `profitPct` to be used. If any auction bid asset exists outside this list, the `profitPct` will not be used. |
| `supportedLot` | An array of asset addresses that the auction lot can contain for this `profitPct` to be used. If any auction lot asset exists outside this list, the `profitPct` will not be used. |

## Build

If you make modifications to the bot, you can build a new dockerfile by running:
Expand Down
17 changes: 16 additions & 1 deletion example.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
{
"name": "example-liquidator",
"keypair": "S...",
"minProfitPct": 0.10,
"defaultProfitPct": 0.10,
"minHealthFactor": 1.5,
"forceFill": true,
"primaryAsset": "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75",
"minPrimaryCollateral": "10000000000",
"supportedBid": [
"CAS3FL6TLZKDGGSISDBWGGPXT3NRR4DYTZD7YOD3HMYO6LTJUVGRVEAM",
"CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75",
Expand All @@ -27,6 +29,19 @@
]
}
],
"profits": [
{
"profitPct": 0.05,
"supportedBid": [
"CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",
"CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75"
],
"supportedLot": [
"CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",
"CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75"
]
}
],
"priceSources": [
{
"assetId": "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",
Expand Down
Loading

0 comments on commit ac8f90d

Please sign in to comment.