@vibek/cli 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@ Vibek 是一个个人自用的 CTP 量化交易项目,提供后台行情与交
10
10
  不建议直接用于他人的生产或实盘交易环境。
11
11
 
12
12
  Vibek 可能连接真实期货账户,但不构成投资建议,也不对交易损失负责。使用者应自行评估并承担风险;
13
- 首次使用请保持 `live_enabled = false`,先在 CTP 测试环境、Paper 模式和离线回测中完成充分验证。
13
+ 首次使用应先在 CTP 测试环境、Paper 模式和离线回测中完成充分验证;Live 策略必须显式加载并启动。
14
14
 
15
15
  ## 运行环境
16
16
 
@@ -50,38 +50,34 @@ vibek --default-config > ~/.config/vibek/config.toml
50
50
  ${EDITOR:-vi} ~/.config/vibek/config.toml
51
51
  ```
52
52
 
53
- 填写账号时,账号表名必须是 `<broker_id>-<user>`。下面是一份最小起步配置:
53
+ 账号名由 `broker_id-user` 自动生成。配置只支持一个账号:
54
54
 
55
55
  ```toml
56
- version = 1
57
- active_account = "9999-account"
58
-
59
- [accounts."9999-account".identity]
56
+ [account]
60
57
  broker_id = "9999"
61
58
  user = "account"
62
59
 
63
- [accounts."9999-account".ctp]
60
+ [account.ctp]
64
61
  market_front = "tcp://行情前置地址:端口"
65
62
  trader_front = "tcp://交易前置地址:端口"
66
63
  app_id = "你的-app-id"
67
64
  production_mode = true
68
65
 
69
- [accounts."9999-account".trading]
70
- live_enabled = false
66
+ [account.trading]
71
67
  max_order_volume = 1
72
68
  max_position = 2
73
69
  max_active_orders = 2
74
70
  allow_short = true
75
71
  ```
76
72
 
77
- `production_mode` 选择 CTP API 的生产/评测模式;它不等于允许实盘交易。
78
- `live_enabled` 是独立的实盘总闸,默认应保持关闭。
73
+ `production_mode` 选择 CTP API 的生产/评测模式;它不决定策略使用 Paper 还是 Live。
74
+ 换号时修改 `[account]`,然后执行 `vibek daemon restart`。
79
75
 
80
76
  ### 2. 校验配置
81
77
 
82
78
  ```bash
83
79
  vibek config
84
- vibek account current
80
+ vibek status
85
81
  ```
86
82
 
87
83
  配置有未知字段、类型错误、账号引用错误或风控值越界时,`vibek config` 会直接指出问题。
@@ -135,9 +131,7 @@ Web 工作台本身不会自动启动交易 daemon。需要行情、账户或策
135
131
  | 命令 | 用途 |
136
132
  | --- | --- |
137
133
  | `vibek status` | 汇总账号、daemon、行情、交易连接和策略状态 |
138
- | `vibek account list` | 列出本机配置的账号 |
139
- | `vibek account use <名称>` | 切换当前账号 |
140
- | `vibek account show` | 查询当前柜台资金 |
134
+ | `vibek account` | 查询当前柜台资金 |
141
135
  | `vibek positions` | 查询实时持仓 |
142
136
  | `vibek orders` | 查询当前交易日委托 |
143
137
  | `vibek trades` | 查询当前交易日成交 |
@@ -176,7 +170,7 @@ vibek strategy unload <策略实例ID>
176
170
  vibek backtest ./my-strategy.ts --help
177
171
  ```
178
172
 
179
- Live 模式必须显式使用 `--mode live`,并同时通过账号配置中的 `live_enabled`、委托限制和持仓核对。
173
+ Live 模式必须显式使用 `--mode live`、显式启动,并通过委托限制和持仓核对。
180
174
  不要用尚未在 Paper 和回测中验证的策略直接连接实盘。
181
175
 
182
176
  ## 配置和数据位置
@@ -1,58 +1,50 @@
1
- # Vibek configuration
2
- # 复制到平台配置目录,或运行 `vibek --default-config` 输出同等模板。
3
- # 修改后运行 `vibek config` 校验;daemon 配置重启后生效。
4
- version = 1
5
-
6
- # active_account = "9999-account"
1
+ [account]
2
+ broker_id = ""
3
+ user = ""
4
+
5
+ [account.ctp]
6
+ market_front = ""
7
+ trader_front = ""
8
+ front_candidates = []
9
+ app_id = ""
10
+ production_mode = true
11
+
12
+ [account.logging]
13
+ level = "info"
14
+
15
+ [account.market]
16
+ db_path = ""
17
+ record_instruments = []
18
+ max_future_tick_ms = 5000
19
+
20
+ [account.trading]
21
+ max_order_volume = 10
22
+ max_position = 20
23
+ max_active_orders = 5
24
+ allow_short = true
25
+
26
+ [account.schedule]
27
+ enabled = true
28
+ day_start = "08:45"
29
+ day_stop = "15:15"
30
+ night_start = "20:45"
31
+ night_stop = "02:35"
32
+ max_start_attempts = 4
33
+ retry_base_ms = 30000
34
+ tick_ms = 30000
35
+
36
+ [account.notifications]
37
+ bark_key = ""
38
+ bark_signal_keys = []
39
+ telegram_bot_token = ""
40
+ telegram_chat_id = ""
7
41
 
8
42
  [storage]
9
- # data_root = "~/.vibek"
43
+ data_root = "~/.vibek"
10
44
 
11
45
  [server]
12
- # daemon_port = 3111
13
- # webui_port = 3211
46
+ daemon_port = 3111
47
+ webui_port = 3211
14
48
 
15
49
  [network]
16
- # telegram_proxy = "http://127.0.0.1:7890"
17
-
18
- # [accounts."9999-account".identity]
19
- # broker_id = "9999"
20
- # user = "account"
21
-
22
- # [accounts."9999-account".ctp]
23
- # market_front = "tcp://host:port"
24
- # trader_front = "tcp://host:port"
25
- # front_candidates = ["主线@1.2.3.4", "备用@1.2.3.5"]
26
- # app_id = "client-id"
27
- # production_mode = true
28
-
29
- # [accounts."9999-account".logging]
30
- # level = "info" # trace | debug | info | warn | error
31
-
32
- # [accounts."9999-account".market]
33
- # db_path = ""
34
- # record_instruments = ["NI2609.SHFE", "IF2609.CFFEX"]
35
- # max_future_tick_ms = 5000
36
-
37
- # [accounts."9999-account".trading]
38
- # live_enabled = false
39
- # max_order_volume = 10
40
- # max_position = 20
41
- # max_active_orders = 5
42
- # allow_short = true
43
-
44
- # [accounts."9999-account".schedule]
45
- # enabled = true
46
- # day_start = "08:45"
47
- # day_stop = "15:15"
48
- # night_start = "20:45"
49
- # night_stop = "02:35"
50
- # max_start_attempts = 4
51
- # retry_base_ms = 30000
52
- # tick_ms = 30000
53
-
54
- # [accounts."9999-account".notifications]
55
- # bark_key = ""
56
- # bark_signal_keys = []
57
- # telegram_bot_token = ""
58
- # telegram_chat_id = ""
50
+ telegram_proxy = ""