Skip to content

Commit

Permalink
Merge branch 'dev' into update/kdf-config
Browse files Browse the repository at this point in the history
  • Loading branch information
smk762 authored Sep 13, 2024
2 parents 4a25535 + d4c504d commit 6ca6123
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 53 deletions.
2 changes: 2 additions & 0 deletions filepathSlugs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2027,6 +2027,7 @@
"example-without-balances",
"balance-infos",
"derivation-method",
"event-stream-config",
"numeric-formats-value",
"fee-info",
"examples",
Expand Down Expand Up @@ -3800,6 +3801,7 @@
"utxo-coin-example",
"antara-smartchain-example",
"1c-evm-like-tokens-eth-erc-20-matic-plg-20-bnb-bep-20",
"gas-limit-options",
"erc-20-token-example",
"bep-20-token-example",
"1d-qrc-20-tokens",
Expand Down
40 changes: 40 additions & 0 deletions src/pages/komodo-defi-framework/api/common_structures/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,46 @@ Where the value indicates:
```
</CollapsibleSection>

### EventStreamConfig

The `EventStreamConfig` object defines which events will be streamed to the client:

| Parameter | Type | Description |
| ------------------------------ | ------ | -------------------------------------------------------------------------------------- |
| access\_control\_allow\_origin | string | Defines CORS whitelist. Use "\*" to allow fromi any origin. |
| active\_events | object | Events to be streamed to the client, along with configuration defineing frequency etc. |
| worker\_path | string | WASM only. Path to a custom `worker.js` file. |

Active events are defined as follows:

* NETWORK: Network status changes. Requires `stream_interval_seconds` configuration.
* HEARTBEAT: Allows clients to easily determine whether channels are functioning. Requires `stream_interval_seconds` configuration.
* COIN\_BALANCE: Balance changes. Does not require `stream_interval_seconds` configuration, as the event is triggered by the balance change.

<Note>
The `COIN_BALANCE` event may not be available for all coins or tokens.
</Note>

An example of the event stream output can then be viewed in [https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/examples/sse/index.html](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/examples/sse/index.html)

<CollapsibleSection expandedText="Hide Example" collapsedText="Show Example">
```json
"event_stream_configuration": {
"access_control_allow_origin": "*",
"active_events": {
"NETWORK": {
"stream_interval_seconds": 1.5,
},
"COIN_BALANCE": {},
"HEATBEAT": {
"stream_interval_seconds": 2.4,
}
},
"worker_path": "index.js"
}
```
</CollapsibleSection>

### NumericFormatsValue

The `NumericFormatsValue` returns a price or amount in three different formats: `fraction`, `rational`, and `decimal`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export const title = "Komodo DeFi Framework Method: Start Simple Market Maker Bot";
export const description = "The Komodo DeFi Framework API allows for simple bot trading via the start_simple_market_maker_bot method.";
export const title =
"Komodo DeFi Framework Method: Start Simple Market Maker Bot";
export const description =
"The Komodo DeFi Framework API allows for simple bot trading via the start_simple_market_maker_bot method.";

# start\_simple\_market\_maker\_bot

Expand All @@ -11,29 +13,29 @@ For convenience, an online [tool for generating configs](https://stats.kmd.io/at

## Arguments

| Structure | Type | Description |
| -------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| price\_url | string | Link to a price service API |
| bot\_refresh\_rate | float | Bot loop interval in seconds (optional, 30 sec default) |
| cfg.name | string | The name assigned to this configuration (e.g. the pair being configured) |
| cfg.name.base | string | Ticker of the coin you wish to sell |
| cfg.name.rel | string | Ticker of the coin you wish to buy |
| cfg.name.max | boolean | Set to `true` if you would like to trade your whole balance (optional) |
| cfg.name.max\_volume.percentage | string | Percentage of balance to trade (optional; can not use at same time as `max_volume.usd`; if greater than 1.0 `max=true` is implied) |
| cfg.name.max\_volume.usd | string | Maximum USD trade volume value to trade (optional; can not use at same time as `max_volume.percentage`; if greater than full balance `max=true` is implied) |
| cfg.name.min\_volume.percentage | string | Minimum percentage of balance to accept in trade (optional, can not use at same time as `min_volume.usd`) |
| cfg.name.min\_volume.usd | float | Minimum USD trade volume of trades accepted for order (optional, can not use at same time as `min_volume.percentage`) |
| cfg.name.min\_base\_price | float | Minimum USD price of base coin to accept in trade (optional) |
| cfg.name.min\_rel\_price | float | Minimum USD price of rel coin to accept in trade (optional) |
| cfg.name.min\_pair\_price | float | Minimum USD price of pair (base/rel) to accept in trade (optional) |
| cfg.name.spread\*\* | string | Target price in relation to prices API value |
| cfg.name.base\_confs | integer | number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set |
| cfg.name.base\_nota | boolean | whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set |
| cfg.name.rel\_confs | integer | number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set |
| cfg.name.rel\_nota | boolean | whether dPoW notarization is required for rel coin atomic swap transaction; default to base coin configuration if not set |
| cfg.name.enable | boolean | Bot will ignore this config entry if set to false |
| cfg.name.price\_elapsed\_validity | float | Will cancel current orders for this pair and not submit a new order if last price update time has been longer than this value in seconds (optional; defaults to 5 minutes) |
| cfg.name.check\_last\_bidirectional\_trade\_thresh\_hold | boolean | Will readjust the calculated cex price if a precedent trade exists for the pair (or reversed pair), applied via a [VWAP logic](https://www.investopedia.com/terms/v/vwap.asp) (optional; defaults to false) |
| Structure | Type | Description |
| -------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| price\_urls | list | Optional. A list of URLs serving price data in JSON format. During each update loop, price data will be sourced from the first working URL in the list. If not defined, a [default list](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/coins/lp_price.rs#L13) will be used. |
| bot\_refresh\_rate | float | Bot loop interval in seconds (optional, 30 sec default) |
| cfg.name | string | The name assigned to this configuration (e.g. the pair being configured) |
| cfg.name.base | string | Ticker of the coin you wish to sell |
| cfg.name.rel | string | Ticker of the coin you wish to buy |
| cfg.name.max | boolean | Set to `true` if you would like to trade your whole balance (optional) |
| cfg.name.max\_volume.percentage | string | Percentage of balance to trade (optional; can not use at same time as `max_volume.usd`; if greater than 1.0 `max=true` is implied) |
| cfg.name.max\_volume.usd | string | Maximum USD trade volume value to trade (optional; can not use at same time as `max_volume.percentage`; if greater than full balance `max=true` is implied) |
| cfg.name.min\_volume.percentage | string | Minimum percentage of balance to accept in trade (optional, can not use at same time as `min_volume.usd`) |
| cfg.name.min\_volume.usd | float | Minimum USD trade volume of trades accepted for order (optional, can not use at same time as `min_volume.percentage`) |
| cfg.name.min\_base\_price | float | Minimum USD price of base coin to accept in trade (optional) |
| cfg.name.min\_rel\_price | float | Minimum USD price of rel coin to accept in trade (optional) |
| cfg.name.min\_pair\_price | float | Minimum USD price of pair (base/rel) to accept in trade (optional) |
| cfg.name.spread\*\* | string | Target price in relation to prices API value |
| cfg.name.base\_confs | integer | number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set |
| cfg.name.base\_nota | boolean | whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set |
| cfg.name.rel\_confs | integer | number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set |
| cfg.name.rel\_nota | boolean | whether dPoW notarization is required for rel coin atomic swap transaction; default to base coin configuration if not set |
| cfg.name.enable | boolean | Bot will ignore this config entry if set to false |
| cfg.name.price\_elapsed\_validity | float | Will cancel current orders for this pair and not submit a new order if last price update time has been longer than this value in seconds (optional; defaults to 5 minutes) |
| cfg.name.check\_last\_bidirectional\_trade\_thresh\_hold | boolean | Will readjust the calculated cex price if a precedent trade exists for the pair (or reversed pair), applied via a [VWAP logic](https://www.investopedia.com/terms/v/vwap.asp) (optional; defaults to false) |

* Percentage values are within the range of 0-1, such that 0.25 = 25%
* For spread, a value of 1.05 equates to 5% over the value returned from the prices API url.
Expand Down Expand Up @@ -81,7 +83,11 @@ The third config tells the bot to:
"mmrpc": "2.0",
"method": "start_simple_market_maker_bot",
"params": {
"price_url": "https://prices.komodo.earth/api/v2/tickers?expire_at=600",
"price_urls": [
"https://prices.komodo.live:1313/api/v2/tickers?expire_at=600",
"https://prices.komodo.earth/api/v2/tickers?expire_at=600",
"https://prices.komodian.info/api/v2/tickers?expire_at=600"
],
"bot_refresh_rate": 60,
"cfg": {
"DASH/KMD": {
Expand Down
Loading

0 comments on commit 6ca6123

Please sign in to comment.