-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrestapi.yaml
More file actions
2158 lines (2114 loc) · 54.9 KB
/
restapi.yaml
File metadata and controls
2158 lines (2114 loc) · 54.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: "3.0.3"
info:
title: QuasarX API
description: QuasarX Rest API接口
version: "0.0.1"
servers:
- url: http://localhost:19107/v0
paths:
/stocks/simple:
get:
summary: stock's symbol and name
description: 获取所有股票的代码和名称
tags:
- Stocks
responses:
'200':
description: An array of stocks
content:
application/json:
schema:
$ref: "#/components/schemas/StockList"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/stocks/detail:
get:
summary: stock detail info
description: 当前时刻股票的信息(价格/量/换手率等)
tags:
- Stocks
parameters:
- in: query
name: id
schema:
type: string
description: 要获取的合约代码
responses:
'200':
description: An array of stocks
content:
application/json:
schema:
$ref: "#/components/schemas/StockDetail"
/stocks/history:
get:
summary: get stock history
description: 获取指数信息
tags:
- Stocks
parameters:
- in: query
name: id
schema:
type: string
description: 要获取的代码
example: 000001
- in: query
name: type
schema:
type: string
description: 数据频率
example: 1d
- in: query
name: start
schema:
type: integer
description: 起始时间
- in: query
name: end
schema:
type: integer
description: 结束时间
- in: query
name: right
schema:
type: integer
description: 复权方式,1-后复权
responses:
'200':
description: An array of stocks
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Quote"
/stocks/params:
get:
summary: 获取股票下单参数
description: 获取股票下单参数
tags:
- Stocks
responses:
'200':
description: An array of stocks
content:
application/json:
schema:
type: object
properties:
order_limit:
type: integer
description: 每秒下单最大次数
daily_limit:
type: integer
description: 每日下单最大次数
cancel_limit:
type: integer
description: 每秒撤单最大次数
put:
summary: 股票下单参数设置
description: 股票下单参数设置
tags:
- Stocks
requestBody:
description: 下单参数
required: true
content:
application/json:
schema:
type: object
properties:
order_limit:
type: integer
description: 每秒下单最大次数
daily_limit:
type: integer
description: 每日下单最大次数
cancel_limit:
type: integer
description: 每秒撤单最大次数
responses:
'200':
description: success or not
/stocks/sector/flow:
get:
summary: get flow info
description: 获取板块资金流信息
tags:
- Sector
parameters:
- in: query
name: type
schema:
type: integer
description: 1- 所有历史 0- 当日信息
responses:
'200':
description: An array of sectors
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/SectorItem"
/stocks/sector/quote:
get:
summary: 行业板块实时行情
description: 获取当前所有行业板块的实时行情数据,按涨跌幅排名
tags:
- Sector
responses:
'200':
description: 行业板块行情列表
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
date:
type: string
description: 日期
example: "2025-06-03"
data:
type: array
items:
$ref: "#/components/schemas/SectorQuote"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/stocks/verbose:
get:
summary: stock verbose info
description: 股票的详细信息(基本面/板块/十大股东/主营业务等)
tags:
- Stocks
parameters:
- in: query
name: id
schema:
type: integer
description: 要获取的合约代码
responses:
'200':
description: An array of sectors
content:
application/json:
schema:
type: object
/stocks/privilege:
get:
summary: 查询股票的交易权限
description: 查询股票的交易权限
tags:
- Stocks
parameters:
- in: query
name: id
schema:
type: string
description: 要查询的股票代码
responses:
'200':
description: An array of stocks
content:
application/json:
schema:
type: object
properties:
forbid:
type: boolean
description: 是否禁止交易
message:
type: string
description: 禁止交易原因
'400':
description: 失败
content:
application/json:
schema:
type: object
properties:
error:
type: integer
description: 失败错误码
/stocks/range:
get:
summary: 获取股票当日涨跌停价格
description: 获取股票当日涨跌停价格
tags:
- Stocks
parameters:
- in: query
name: id
schema:
type: string
description: 要获取的股票代码
responses:
'200':
description: An array of stocks
content:
application/json:
schema:
type: object
properties:
code:
type: string
description: 股票代码
upper:
type: number
description: 股票涨停价
lower:
type: number
description: 股票跌停价
/options/detail:
get:
summary: 当前期权的信息
description: 当前期权的信息(基本信息、希腊字母及隐波等)
tags:
- Options
parameters:
- in: query
name: id
schema:
type: string
description: 要获取的期权代码
- in: query
name: type
schema:
type: integer
description: 期权代码类型 0-上交所深交所etf期权, 1-期货类期权
responses:
'200':
description: An array of stocks
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: 期权名称
symbol:
type: string
description: 期权代码
/index/quote:
get:
summary: get index info
description: 获取指数信息
tags:
- Index
parameters:
- in: query
name: id
schema:
type: string
description: 要获取的指数代码,多个时用逗号分开
responses:
'200':
description: An array of stocks
content:
application/json:
schema:
$ref: "#/components/schemas/IndexQuote"
/simulate:
post:
summary: simulate a exchange
description: 交易所仿真
tags:
- Simulate
requestBody:
description: 交易所信息
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/SimulateRequest"
responses:
'200':
description: success or not
/risk/stoploss:
post:
summary: stoploss
description: 止损设置
tags:
- Risk
requestBody:
description: 止损参数
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/StopLossRequest"
responses:
'200':
description: success or not
content:
application/json:
schema:
$ref: "#/components/schemas/StopLossResponse"
delete:
summary: stoploss
description: 删除设置的止损
tags:
- Risk
parameters:
- in: query
name: id
schema:
type: integer
description: 要删除的id
responses:
'200':
description: success
get:
summary: stoploss
description: 获取所有设置的止损
tags:
- Risk
responses:
'200':
description: success
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/StopLossList"
/risk/var:
post:
summary: run strategy for VaR
description: 计算策略的VaR
tags:
- Risk
requestBody:
description: 计算VaR的参数
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/VaRRequest"
responses:
'200':
description: success or not
content:
application/json:
schema:
$ref: "#/components/schemas/VaRResponse"
get:
summary: get strategy of history VaR
description: 获取历史计算出的策略的VaR
tags:
- Risk
parameters:
- in: query
name: id
schema:
type: integer
description: 佣金id
responses:
'200':
description: success or not
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/VaRHistoryItem"
/risk/drawdown:
get:
summary: drawdown
description: 获取给定时间范围内的最大回撤
tags:
- Risk
parameters:
- in: query
name: range
schema:
type: integer
enum: [0, 1]
description: 0-近90天,1-指定时间开始
example: 0
- in: query
name: symbol
schema:
type: string
description: 多个合约或者指定的持仓
example: ap2501C2508,ap2502C2509
- in: query
name: datetime
schema:
type: integer
description: 可选, 当type=1时指定的时间,单位s
example: 1739174267836
responses:
'200':
description: success or not
content:
application/json:
schema:
type: array
items:
type: number
/risk/capital:
get:
summary: get capital risk config
description: 获取总资金风控配置和状态
tags:
- Risk
responses:
'200':
description: success
content:
application/json:
schema:
$ref: "#/components/schemas/CapitalRiskConfig"
post:
summary: set capital risk config
description: 设置总资金止损配置
tags:
- Risk
requestBody:
description: 总资金风控参数
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CapitalRiskSetRequest"
responses:
'200':
description: success
content:
application/json:
schema:
$ref: "#/components/schemas/CapitalRiskConfig"
'400':
description: invalid parameters
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/risk/daily:
get:
summary: get daily loss risk config
description: 获取单日亏损风控配置和状态
tags:
- Risk
responses:
'200':
description: success
content:
application/json:
schema:
$ref: "#/components/schemas/DailyRiskConfig"
post:
summary: set daily loss risk config
description: 设置单日亏损限额配置
tags:
- Risk
requestBody:
description: 单日亏损风控参数
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/DailyRiskSetRequest"
responses:
'200':
description: success
content:
application/json:
schema:
$ref: "#/components/schemas/DailyRiskConfig"
'400':
description: invalid parameters
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/risk/closeall:
post:
summary: close all positions
description: 手动触发全部平仓(资金风控触发时使用)
tags:
- Risk
requestBody:
description: 平仓确认参数
required: true
content:
application/json:
schema:
type: object
properties:
confirm:
type: boolean
description: 确认平仓,必须为 true 才会执行
example: true
responses:
'200':
description: success
content:
application/json:
schema:
$ref: "#/components/schemas/CloseAllResponse"
'400':
description: confirmation required
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
'500':
description: close failed
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/risk/factor/liquidity:
get:
summary: liquidity
description: 获取给定时间范围内的流动性风险因子
tags:
- Risk
parameters:
- in: query
name: symbol
schema:
type: string
description: 多个合约或者指定的持仓
example: ap2501C2508,ap2502C2509
- in: query
name: datetime
schema:
type: integer
description: 可选, 当type=1时指定的时间,单位s
example: 1739174267836
responses:
'200':
description: success or not
content:
application/json:
schema:
type: array
items:
type: number
/portfolio:
put:
summary: portfolio
description: 创建一个投资组合PH
tags:
- Portfolio
requestBody:
description: 投资组合参数
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/PortfolioRequest"
responses:
'200':
description: success or not
content:
application/json:
schema:
$ref: "#/components/schemas/PortfolioResponse"
/commission:
get:
summary: commission
description: 获取佣金
tags:
- User
parameters:
- in: query
name: id
schema:
type: string
description: 代码,可选,只针对期货
example: 12
- in: query
name: broker
schema:
type: string
description: 代理商,保留
- in: query
name: type
schema:
type: integer
description: 类型, 0-股票 1-期货 2-期权
enum: [0, 1, 2]
responses:
'200':
description: success or not
content:
application/json:
schema:
type: array
description: 返回的佣金信息
items:
$ref: "#/components/schemas/CommissionItem"
/strategy/metric:
get:
summary: metric
description: 获取策略的评价指标
tags:
- Strategy
parameters:
- in: query
name: id
schema:
type: integer
description: 要获取的策略id, 0-表示一直持有的策略
responses:
'200':
description: success
content:
application/json:
schema:
$ref: "#/components/schemas/StrategyMetrics"
/strategy:
get:
summary: 获取所有策略的名字
description: 获取所有策略的名字
tags:
- Strategy
responses:
'200':
description: success
content:
application/json:
schema:
type: array
items:
type: string
description: 策略的名字
example: random
post:
summary: 部署指定的某个策略
description: 部署指定的某个策略
tags:
- Strategy
requestBody:
description: 参数
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/StrategyRequest"
responses:
'200':
description: success
/backtest:
post:
summary: 对某个策略做回测
description: 对某个策略做回测
tags:
- Backtest
requestBody:
description: 参数
required: true
content:
application/json:
schema:
type: object
properties:
script:
type: string
description: 策略图的json
example: ""
responses:
'200':
description: success
content:
application/json:
schema:
$ref: "#/components/schemas/BacktestResponse"
'404':
description: fail
/strategy/nodes:
get:
summary: 获取所有策略节点参数等信息
description: 获取策略节点信息
tags:
- Strategy
responses:
'200':
description: success
content:
application/json:
schema:
/strategy/node:
get:
summary: 策略节点上的下载功能,如下载调试输出
description: 策略节点上的下载功能,如下载调试输出
tags:
- Strategy
parameters:
- in: query
name: strategy
schema:
type: string
description: 对应的策略名
- in: query
name: label
schema:
type: string
description: 对应的debug节点标签
responses:
'200':
description: success
content:
application/json:
schema:
put:
summary: 策略节点上的上传功能,如上传模型
description: 策略节点上的上传功能,如上传模型
tags:
- Strategy
responses:
'200':
description: success
content:
application/json:
schema:
/predict/montecarlo:
post:
summary: predict price of asset
description: use monte carlo predict price
tags:
- Predict
requestBody:
description: 参数
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/MonteCarloRequest"
responses:
'200':
description: success
content:
application/json:
schema:
$ref: "#/components/schemas/MonteCarloResponse"
/predict/finity:
post:
summary: predict price of asset
description: use finity difference method to predict
tags:
- Predict
responses:
'200':
description: success
content:
application/json:
schema:
type: object
properties:
symbols:
type: string
example: 111000,000001
/predict/operation:
put:
summary: set prediction
description: 设置预测的操作,即接下来某个时间内应该执行的操作
tags:
- Predict
requestBody:
description: 预测参数
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/PredictionOperationRequest"
responses:
'200':
description: success
get:
summary: get prediction
description: 获取预设置的操作
tags:
- Predict
parameters:
- in: query
name: symbol
schema:
type: string
description: symbol
- in: query
name: exchange
schema:
type: string
description: exchange
responses:
'200':
description: success
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/PredictionItem"
delete:
summary: delete prediction
description: 删除预设置的操作
tags:
- Predict
parameters:
- in: query
name: symbol
schema:
type: string
description: symbol
- in: query
name: index
schema:
type: integer
description: index of query prediction
- in: query
name: exchange
schema:
type: integer
description: 0-simulate, 1-xtp, 2-ctp
responses:
'200':
description: success
/future/simple:
get:
summary: all future info
description: get future name and symbol
tags:
- Future
responses:
'200':
description: success
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/FutureItem"
/feature:
get:
summary: features
description: get features of symbol
tags:
- Feature
parameters:
- in: query
name: symbol
schema:
type: string
description: symbol
- in: query
name: start
schema:
type: integer
description: start time
- in: query
name: end
schema:
type: integer
description: end time
responses:
'200':
description: success
content:
application/json:
schema:
type: array
items:
type: number
/data/sync:
get:
summary: sync data
description: 同步服务保存的数据,同步完成后清空当前服务保存的数据
tags:
- Data
responses:
'200':
description: success
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Quote"
/user/login:
post:
summary: login
description: 登录服务
tags:
- User
requestBody:
description: 参数
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/LoginRequest"
responses:
'200':
description: success
content:
application/json:
schema:
$ref: "#/components/schemas/LoginResponse"
/user/status:
get:
summary: cpu/memory info
description: 获取服务器状态信息
tags:
- User
responses:
'200':
description: success
/user/logout:
post:
summary: logout
description: 登出服务
tags:
- User
requestBody:
description: 参数
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/LogoutRequest"
responses:
'200':
description: success
/user/switch:
post:
summary: 切换当前用户
description: 切换当前用户
tags:
- User
requestBody:
description: 参数
required: true