# 配置
| 時間 | 變更者 | 異動內容 |
| -------- | -------- | -------- |
| 2024-04-18 | Junx | 新增合約相關配置 |
| 2024-04-29|Junx|redis key增加`orchid`前墜與刪除合約配置`funding_fee_direction`,增加資金池做市配置範例|
|2024-05-07|Junx|合約配置新增`ˋ訂單簿備用數量上下限`|
|2024-05-14|Junx|移除交易狀態`3: 不可交易`|
## 合約全域基礎配置
| redis Key | redis type | value type |TTL |
| -------- | -------- | -------- |-------- |
| orchid:contract_setting | Key | json |-1|
```
{
"max_position": 20
}
```
| 參數名 | 類型 | 範例 |備註|
| -------- | -------- | -------- | -------- |
| max_position | int| 20|一個用戶可以同時開啟的最大倉位數|
## 合約基礎配置
| redis Key | 範例 |redis type | value type |TTL |
| -------- | -------- | -------- |-------- |-------- |
| orchid:contract_pair:{幣對/交易對} | orchid:contract_pair:BTC/USDT | Key | json |-1|
```
{
"crypto": "BTC",
"crypto_price_unit": "USDT",
"print_scale": 4,
"quantity_scale": 2,
"unit": "0.00001",
"funding_fee_payment_frequency": 8,
"funding_fee_rate": "0.1",
"pair_status": 1,
"min_order_book_quantity": "0.1",
"max_order_book_quantity": "1",
"contract": {
"open_slippage": "0.01",
"close_slippage": "0.01",
"risk_rate": "10.1",
"max_profit_multiples": 5,
"open_fee": "0.01",
"close_fee": "0.01",
"system_max_long_position_quantity": "500",
"system_max_short_position_quantity": "500",
"init_leverage": 5,
"min_leverage": 1,
"max_leverage": 10,
"open_position_max_margin": "1000.1,
"open_position_min_margin": "10.1"
"status": 1
},
"thousand_contract": {
"open_slippage": "0.01",
"close_slippage": "0.01",
"risk_rate": "10.1",
"max_profit_multiples": 5,
"open_fee": "0.01",
"close_fee": "0.01",
"system_max_long_position_quantity": "500",
"system_max_short_position_quantity": "500",
"init_leverage": 5,
"min_leverage": 1,
"max_leverage": 10,
"sharerate_fee": "0.01",
"open_position_max_margin": "1000.1",
"open_position_min_margin": "10.1"
"status": 1
}
}
```
| 參數名 | 類型 | 範例 |備註|
| -------- | -------- | -------- | -------- |
| crypto | string| BTC|幣種(交易資產)|
|crypto_price_unit| string| USDT|計價(計價資產)|
|print_scale|int|4|價格精度|
|quantity_scale|int|2|數量精度|
|unit|string|2|最低一張需要多少交易資產 ex: 0.00001等於一張BTC|
|funding_fee_payment_frequency|int|8|資金費支付頻率(小時) ex: 8h|
|funding_fee_rate|string|0.1|資金費率 ex: 0.1%|
|pair_status|int|1|幣對/交易對狀態 1:上線 2:下線(強平後下架)|
|min_order_book_quantity|string|0.1|訂單簿備用數量下限|
|max_order_book_quantity|string|1|訂單簿備用數量上限|
|contract.open_slippage|string|0.1|`普通/永續合約` 開倉基礎滑點%|
|contract.close_slippage|string|0.1|`普通/永續合約` 平倉基礎滑點%|
|contract.risk_rate|string|10.1|`普通/永續合約` 爆倉風險率|
|contract.max_profit_multiples|int|10|`普通/永續合約` 最大止盈倍數|
|contract.open_fee|string|0.01|`普通/永續合約` 開倉手續費%|
|contract.close_fee|string|0.01|`普通/永續合約` 平倉手續費%|
|contract.system_max_long_position_quantity|string|500|`普通/永續合約` 平台最大多方持倉量(幣量)|
|contract.system_max_short_position_quantity|string|500|`普通/永續合約` 平台最大空方持倉量(幣量)|
|contract.open_position_max_margin|string|1000|`普通/永續合約` 開倉最大保證金(USDT)|
|contract.open_position_min_margin|string|10|`普通/永續合約` 開倉最小保證金(USDT)|
|contract.init_leverage|int|5|`普通/永續合約` 初始槓桿|
|contract.min_leverage|int|1|`普通/永續合約` 最小槓桿|
|contract.max_leverage|int|10|`普通/永續合約` 最大槓桿|
|contract.status|int|1|`普通/永續合約` 交易狀態 1: 可開倉 2: 不可開倉|
|thousand_contract.open_slippage|string|0.1|`千倍/閃電合約` 開倉基礎滑點%|
|thousand_contract.close_slippage|string|0.1|`千倍/閃電合約` 平倉基礎滑點%|
|thousand_contract.risk_rate|string|10.1|`千倍/閃電合約` 爆倉風險率|
|thousand_contract.max_profit_multiples|int|10|`千倍/閃電合約` 最大止盈倍數|
|thousand_contract.open_fee|string|0.01|`千倍/閃電合約` 開倉手續費%|
|thousand_contract.close_fee|string|0.01|`千倍/閃電合約` 平倉手續費%|
|thousand_contract.system_max_long_position_quantity|string|500|`千倍/閃電合約` 平台最大多方持倉量(幣量)|
|thousand_contract.system_max_short_position_quantity|string|500|`千倍/閃電合約` 平台最大空方持倉量(幣量)|
|thousand_contract.open_position_max_margin|string|1000|`千倍/閃電合約` 開倉最大保證金(USDT)|
|thousand_contract.open_position_min_margin|string|10|`千倍/閃電合約` 開倉最小保證金(USDT)|
|thousand_contract.init_leverage|int|5|`千倍/閃電合約` 初始槓桿|
|thousand_contract.min_leverage|int|1|`千倍/閃電合約` 最小槓桿|
|thousand_contract.max_leverage|int|10|`千倍/閃電合約` 最大槓桿|
|thousand_contract.sharerate_fee|string|0.01|`千倍/閃電合約` sharerate|
|thousand_contract.status|int|1|`千倍/閃電合約` 交易狀態 1: 可開倉 2: 不可開倉|
> 可開倉:所有交易行為正常開啟
不可開倉:下單按鈕無法點擊,顯示暫停交易,其他交易正常,可平倉,可爆倉
不可交易:下單按鈕無法點擊,顯示暫停交易,所有交易都停止,包含平倉和爆倉。
## 合約幣對/交易對清單
| redis Key | redis type | value type |TTL |
| -------- | -------- | -------- |-------- |
| orchid:contract_pairs | Key | json |-1|
```
[
"BTC/USDT",
"ETH/USDT"
]
```
## 合約資金池做市配置
| redis Key | 範例 | redis type | value type |TTL |
| -------- | -------- |-------- |-------- |-------- |
| contract_risk:extreme_market_making:{pair} | contract_risk:extreme_market_making:BTC/USDT | Key | JSON |-1|
| contract_risk:regular_market_making:{pair} | contract_risk:regular_market_making:BTC/USDT | Key | JSON |-1|
```
JSON 極限做市 example
{
"trigger_line": "10000500",
"range": "0.001",
"enable": true
}
```
```
JSON 常規做市 example
{
"trigger_line": "10000500",
"range": "0.001",
"duration": 10,
"interval": 600
"enable": false
}
```
| 參數名 | 類型 | 範例 |備註|
| -------- | -------- | -------- | -------- |
| trigger_line | string| 120000.59|水位線|
| range | string| 0.001|做市區間|
| duration | int| 5|做市週期(秒)|
| interval | int| 600|做市間隔(秒)|
| enable | bool| true|啟用否|