generated from freight-trust/boilerplate-swagger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.yaml
1243 lines (1224 loc) · 48.8 KB
/
swagger.yaml
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
---
swagger: "2.0"
info:
title: "Margin Estimator API"
version: "2.0.0"
description: Margin Account Management
termsOfService: "https://github.com/freight-trust/legal/blob/master/src/terms-of-service.md"
host: margin.dev.freighttrust.com
basePath: /market/contracts-margin/2.0.0/
schemes:
- https
paths:
/products:
get:
summary: "List All Products"
description: >-
Lists all exchange-traded products
Only `product` and `instrument_type` are returned by default.
Remaining attributes (see response) are returned only if specified in `extrafields`.
parameters:
- $ref: "#/parameters/x_fcx_apikey"
- $ref: "#/parameters/extrafields"
- $ref: "#/parameters/business_date"
- $ref: "#/parameters/live"
- $ref: "#/parameters/live_timestamp"
responses:
"200":
description: OK
headers: {}
examples:
application/json:
business_date: 20200829
live: false
live_timestamp: 0
products:
- product:
instrument_type: option
clearing_house: FREIGHTCX
prod_name: OPT ON SWISS MARKET INDEX
prod_isin: CH0008616382
underlying_isin: CH0009980894
currency: CHF
product_type: OINX
extended_product_type:
margin_style_flag: T
exercise_style_flag: E
product_settlement_type: CASH
final_settlement_time: "09:00"
product_tick_size: 0.1
product_tick_value: 1.0
liquidation_group: PEQ01
xm_eligibility: false
schema:
type: object
properties:
business_date:
$ref: "#/definitions/business_date"
live:
$ref: "#/definitions/live"
live_timestamp:
$ref: "#/definitions/live_timestamp"
products:
type: array
items:
type: object
properties:
product:
$ref: "#/definitions/product_id"
instrument_type:
type: string
enum: [future,option]
description: Product line, i.e. either future or option
clearing_house:
type: string
prod_name:
type: string
prod_isin:
type: string
underlying_isin:
type: string
currency:
type: string
product_type:
type: string
extended_product_type:
type: string
description: refinement of product type, can be empty
margin_style_flag:
type: string
enum: [T,F]
description: T for traditional, F for future-style
exercise_style_flag:
$ref: "#/definitions/exercise_style_flag"
product_settlement_type:
type: string
enum: [PHYSICAL,CASH]
final_settlement_time:
type: string
product_tick_size:
type: number
product_tick_value:
type: number
liquidation_group:
$ref: "#/definitions/liquidation_group"
xm_eligibility:
type: boolean
required:
- product
- instrument_type
/series:
get:
summary: List Series of a Product
description: >-
List all series of exchange traded product(s).
Attributes upto `iid` are returned by default.
Remaining attributes (see response) are returned only if specified in `extrafields`.
parameters:
- $ref: "#/parameters/x_fcx_apikey"
- $ref: "#/parameters/extrafields"
- $ref: "#/parameters/business_date"
- $ref: "#/parameters/live"
- $ref: "#/parameters/live_timestamp"
- name: products
in: query
description: Product ID, there can be multiple instances of the parameter to request series for several products
required: true
type: string
responses:
"200":
description: OK
headers: {}
examples:
application/json:
## @dev - note: YAML is idiotic, numbers that are not for usage in `time` should contain more than 8 digits as it considers
## 2050 base60
## also please explain to me this in YAML
## lang: no
## fucking dumb.
business_date: 20200829
live: false
live_timestamp: 0
list_series:
- product_id: "0x12349876"
contract_maturity: 201906
expiry_maturity: 201906
call_put_flag: C
exercise_price: 160
version_number: "0"
iid: 18249016
schema:
type: object
properties:
business_date:
$ref: "#/definitions/business_date"
live:
$ref: "#/definitions/live"
live_timestamp:
$ref: "#/definitions/live_timestamp"
list_series:
type: array
items:
type: object
properties:
product_id:
$ref: "#/definitions/product_id"
contract_maturity:
$ref: "#/definitions/contract_maturity"
expiry_maturity:
$ref: "#/definitions/expiry_maturity"
call_put_flag:
$ref: "#/definitions/call_put_flag"
exercise_price:
$ref: "#/definitions/exercise_price"
version_number:
$ref: "#/definitions/version_number"
iid:
$ref: "#/definitions/iid"
act_trade_unit_no:
type: number
days_to_expiration:
type: number
trade_unit_value:
type: number
## Going off CME"s stuff
exercise_style_flag:
$ref: "#/definitions/exercise_style_flag"
required:
- product_id
- contract_maturity
- expiry_maturity
- version_number
- iid
/clearing_currencies:
get:
# TL;DL == USD, and everyone else. OK JPY can come2.
summary: List All Clearing Currencies
description: List of clearing currencies that can be used in `estimator` request.
parameters:
- $ref: "#/parameters/x_fcx_apikey"
- $ref: "#/parameters/business_date"
- $ref: "#/parameters/live"
- $ref: "#/parameters/live_timestamp"
responses:
"200":
description: OK
headers: {}
examples:
application/json:
business_date: 20200829
live: false
live_timestamp: 0
clearing_currencies:
- USDC
- CHF
- USD
- GBP
- KRUGERRAND
schema:
type: object
properties:
business_date:
$ref: "#/definitions/business_date"
live:
$ref: "#/definitions/live"
live_timestamp:
$ref: "#/definitions/live_timestamp"
clearing_currencies:
type: array
items:
type: string
/snapshots:
get:
summary: List Available Snapshots
description: List of end-of-day or start-of-day snapshots that can be used in other requests.
parameters:
- $ref: "#/parameters/x_fcx_apikey"
- $ref: "#/parameters/business_date_from"
- $ref: "#/parameters/business_date_to"
responses:
"200":
description: OK
headers: {}
examples:
application/json:
snapshots:
- business_date: 20200829
live: false
otc_available: true
- business_date: 20200801
live: true
otc_available: true
schema:
type: object
properties:
snapshots:
type: array
items:
type: object
properties:
business_date:
$ref: "#/definitions/business_date"
live:
$ref: "#/definitions/live"
otc_available:
$ref: "#/definitions/otc_available"
/live_snapshots:
get:
summary: List Available Live Snapshots for Given Day
description: List of live (intraday) snapshots for given business_date. Contains also start-of-day snapshot.
parameters:
- $ref: "#/parameters/x_fcx_apikey"
- $ref: "#/parameters/business_date"
responses:
"200":
description: OK
headers: {}
examples:
application/json:
snapshots:
- business_date: 20200829
live: true
otc_available: true
live_timestamp: 0
- business_date: 20200829
live: true
otc_available: true
live_timestamp: 1562162876
schema:
type: object
properties:
snapshots:
type: array
items:
type: object
properties:
business_date:
$ref: "#/definitions/business_date"
live:
$ref: "#/definitions/live"
otc_available:
$ref: "#/definitions/otc_available"
live_timestamp:
$ref: "#/definitions/live_timestamp"
/estimator:
post:
summary: Margin Calculation Request
description: >-
# Margin Calculation
Portfolio is sent in the request and margin is returned as a response.
The request can contain exchange traded derivatives (ETD) portfolio or OTC portfolio or both:
- ETD is submitted as
- etd_portfolio: JSON array, see request model
- OTC is submitted as
- otc_csv: with trades in CSV format known from Margin Calculator or Prisma Margin Estimator, see description bellow
- otc_sensitivities: with sensitivities in CSV format
- otc_fpml: FpMl
- otc_cb202: i.e. EurexOTC CB202 or CB207 report
- Future: `product`, `maturity` as YYYYMM (DD can be added but is ignored)
- Option: `product`, `maturity` as YYYYMM (DD can be added but is ignored), `call_put_flag`, `exercise_price`
- Flex Future: `instrument_type`: "Flex Future", `product`, `maturity` as YYYYMMDD
- Flex Option: `instrument_type`: "Flex Option", `product`, `maturity` as YYYYMMDD, `call_put_flag`, `exercise_price`, `exercise_style`
Example of minimal request with one future contract:
parameters:
- $ref: "#/parameters/x_fcx_apikey"
- name: body
in: body
schema:
type: object
example:
portfolio_components:
- type: etd_portfolio
etd_portfolio:
- line_no: 1
product_id: FEXD
maturity: 202812
net_ls_balance: 10
- line_no: 2
product_id: OESX
maturity: 202812
call_put_flag: C
exercise_price: 2400
net_ls_balance: -10
properties:
snapshot:
$ref: "#/definitions/snapshot"
clearing_currency:
$ref: "#/definitions/clearing_currency"
is_cross_margined:
type: boolean
description: enable cross-margining between OTC and Fixed Income
example: True
portfolio_components:
type: array
description: array of portfolio components
items:
type: object
description: one portfolio component, only type and one structure relevant for the type is filled
required:
- type
properties:
type:
type: string
description: type of this component
example: etd_portfolio
etd_portfolio:
type: array
items:
type: object
properties:
line_no:
$ref: "#/definitions/line_no"
product_id:
$ref: "#/definitions/product_id"
maturity:
$ref: "#/definitions/maturity"
call_put_flag:
$ref: "#/definitions/call_put_flag"
exercise_price:
$ref: "#/definitions/exercise_price"
version_number:
$ref: "#/definitions/version_number"
iid:
$ref: "#/definitions/iid"
instrument_type:
$ref: "#/definitions/instrument_type"
exercise_style:
$ref: "#/definitions/exercise_style"
net_ea:
$ref: "#/definitions/net_ea"
net_ls_balance:
$ref: "#/definitions/net_ls_balance"
required:
- line_no
- net_ls_balance
otc_csv:
$ref: "#/definitions/otc_csv"
otc_sensitivities:
$ref: "#/definitions/otc_sensitivities"
otc_cb202:
$ref: "#/definitions/otc_cb202"
otc_fpml:
$ref: "#/definitions/otc_fpml"
responses:
"200":
description: OK
headers: {}
examples:
application/json:
business_date: 20200829
live: false
live_timestamp: 0
clearing_currency: USDC
errors:
- line_no: 2
error_msg: "Line 1 instrument iid not recognized: 736947"
portfolio_margin:
- liquidation_group: PEQ01
liquidation_group_split: PFI01_HP2_T0-99999
initial_margin: 3161.708587
market_risk: 3155.266149
liquidity_addon: 6.442439
long_option_credit: 0
time_to_expiry_adjustment: 0
premium_margin: 0
market_risk_per_rms:
- rms_name: SIMPLE STRESS VAR 3
simulation_type: Historical
rms_market_risk: 4991.692879
weighting_factor: 0.51
drilldowns:
- line_no: 1
product_id: OGBL
call_put_flag: C
exercise_price: 160
version_number: "0"
iid: 18249016
maturity: 201806
net_ls_balance: 10
liquidation_group: PFI01
liquidation_group_split: PFI01_HP2_T0-99999
component_margin: 2382.083819
component_margin_currency: USDC
premium_margin: 0
premium_margin_currency: USDC
schema:
type: object
properties:
business_date:
$ref: "#/definitions/business_date"
live:
$ref: "#/definitions/live"
live_timestamp:
$ref: "#/definitions/live_timestamp"
clearing_currency:
$ref: "#/definitions/clearing_currency"
errors:
type: array
items:
type: object
properties:
line_no:
type: string
error_msg:
type: string
portfolio_margin:
type: array
description: Margin on LGS level, higher levels can be summed on UI. Also initial margin can be calculated as a sum of all components except premium margin
items:
type: object
properties:
liquidation_group:
$ref: "#/definitions/liquidation_group"
liquidation_group_split:
$ref: "#/definitions/liquidation_group_split"
initial_margin:
type: number
description: Initial margin on liquidation group split level, equals to market risk plus add ons
market_risk:
type: number
description: Market risk from ReportCP046
liquidity_addon:
type: number
description: Liqu risk from ReportCP046
long_option_credit:
type: number
description: Long option credit from ReportCP046
time_to_expiry_adjustment:
type: number
description: Time to Expiry Adjustment a.k.a. TEA from ReportCP046, introducedwith Prisma R8.0
premium_margin:
type: number
description: Premium margin from ReportCP046
market_risk_per_rms:
type: array
items:
type: object
properties:
rms_name:
type: string
description: Risk Measure Set name
simulation_type:
type: string
enum: [Historical, Stress, Event]
description: Risk Measure Set type
rms_market_risk:
type: number
description: RMS market risk before weighting
weighting_factor:
type: number
description: RMS weighting factor to be applied before aggregation to LGS level
drilldowns:
type: array
description: Margin figures on position level. Full business key is used, it is not possible to map to input line_no one to one because positions may be aggregated or split
items:
type: object
properties:
line_no:
$ref: "#/definitions/line_no"
product_id:
$ref: "#/definitions/product_id"
maturity:
$ref: "#/definitions/maturity"
call_put_flag:
$ref: "#/definitions/call_put_flag"
exercise_price:
$ref: "#/definitions/exercise_price"
version_number:
$ref: "#/definitions/version_number"
iid:
$ref: "#/definitions/iid"
instrument_type:
$ref: "#/definitions/instrument_type"
exercise_style:
$ref: "#/definitions/exercise_style"
net_ls_balance:
$ref: "#/definitions/net_ls_balance"
liquidation_group:
$ref: "#/definitions/liquidation_group"
liquidation_group_split:
$ref: "#/definitions/liquidation_group_split"
component_margin:
$ref: "#/definitions/component_margin"
component_margin_currency:
$ref: "#/definitions/component_margin_currency"
premium_margin:
type: number
description: Premium margin for the position
premium_margin_currency:
type: string
description: Currency of premium margin - currency of the product, can be different from clearing currency
otc_drilldowns:
type: array
description: Margin figures and short trade desription on OTC trade level. Internal Trade Id is used as a key.
items:
type: object
properties:
trade_id:
$ref: "#/definitions/trade_id"
liquidation_group:
$ref: "#/definitions/liquidation_group"
liquidation_group_split:
$ref: "#/definitions/liquidation_group_split"
npv:
type: number
description: Net Present Value of the trade in notional currency
dv01:
type: number
description: DV01 sensitivity of the trade in notional currency
component_margin:
$ref: "#/definitions/component_margin"
component_margin_currency:
$ref: "#/definitions/component_margin_currency"
type:
$ref: "#/definitions/otc_type"
pay:
$ref: "#/definitions/pay"
receive:
$ref: "#/definitions/receive"
notional:
$ref: "#/definitions/notional"
notional_currency:
$ref: "#/definitions/notional_currency"
maturity:
$ref: "#/definitions/otc_maturity"
/otc_trade_details:
post:
summary: OTC Trade Details
description: >-
Return a short human-readable description of OTC trade, e.g. to display on a GUI.
The description is not complete, i.e. it is not sufficient to evaluate the trade.
parameters:
- $ref: "#/parameters/x_fcx_apikey"
- name: body
in: body
schema:
type: object
example:
portfolio_components:
- type: otc_csv
otc_csv:
csv: internalTradeID,tradeType,currency,effectiveDate,terminationDate,legType,legSpread,legIndex,interestFixedAmount,notional,paymentPeriod,periodStartVNS,compounding,compoundingIndexPeriod,stub,firstRate,firstInterpolationTenor,secondInterpolationTenor,dayCountMethod,businessDayConvention,paymentCalendar,adjustment,rollMethod,legType,legSpread,legIndex,interestFixedAmount,notional,paymentPeriod,periodStartVNS,compounding,compoundingIndexPeriod,stub,firstRate,firstInterpolationTenor,secondInterpolationTenor,dayCountMethod,businessDayConvention,paymentCalendar,adjustment,rollMethod\n1,FRA,USDC,20/12/2018,20/08/2019,fixedLeg,0.15,,,100000000,3M,,,,,,,,ACT/360,,,,,floatingLeg,,,,100000000,3M,,,,,,,,ACT/360,,,,
properties:
snapshot:
$ref: "#/definitions/snapshot"
portfolio_components:
type: array
description: array of portfolio components
items:
type: object
description: one portfolio component, only type and one structure relevant for the type is filled
required:
- type
properties:
type:
type: string
description: type of this component
example: etd_portfolio
otc_csv:
$ref: "#/definitions/otc_csv"
otc_cb202:
$ref: "#/definitions/otc_cb202"
otc_fpml:
$ref: "#/definitions/otc_fpml"
responses:
"200":
description: OK
headers: {}
examples:
application/json:
business_date: 20200829
live: false
live_timestamp: 0
otc_trade_details:
- trade_id: "1"
type: FRA
pay: Fixed 0.15%
receive: USDC-USDCIBOR-3M
notional: 100000000
notional_currency: USDC
maturity: 0.8Y
schema:
type: object
properties:
business_date:
$ref: "#/definitions/business_date"
live:
$ref: "#/definitions/live"
live_timestamp:
$ref: "#/definitions/live_timestamp"
otc_trade_details:
type: array
items:
type: object
description: details of one OTC trade
properties:
trade_id:
$ref: "#/definitions/trade_id"
type:
$ref: "#/definitions/otc_type"
pay:
$ref: "#/definitions/pay"
receive:
$ref: "#/definitions/receive"
notional:
$ref: "#/definitions/notional"
notional_currency:
$ref: "#/definitions/notional_currency"
maturity:
$ref: "#/definitions/otc_maturity"
/otc_sensitivites:
post:
summary: OTC Sensitivities
description: >-
Return a table of DV01 (delta) sensitivities of OTC portfolio, per curve and maturity bucket. The sensitivity table is accepted as `otc_sensitivities` input for `estimator` request and can be used instead of the whole OTC portfolio for faster margin computation.
externalDocs:
url: https://github.com/Deutsche-Boerse-Risk/CloudPrismaMarginEstimator/raw/master/templates/otc/OTC_sensitivities_template.xlsm
description: Example of the DV01 Sensitivities table as Excel sheet
parameters:
- $ref: "#/parameters/x_fcx_apikey"
- name: body
in: body
schema:
type: object
example:
portfolio_components:
- type: otc_csv
otc_csv:
csv: internalTradeID,tradeType,currency,effectiveDate,terminationDate,legType,legSpread,legIndex,interestFixedAmount,notional,paymentPeriod,periodStartVNS,compounding,compoundingIndexPeriod,stub,firstRate,firstInterpolationTenor,secondInterpolationTenor,dayCountMethod,businessDayConvention,paymentCalendar,adjustment,rollMethod,legType,legSpread,legIndex,interestFixedAmount,notional,paymentPeriod,periodStartVNS,compounding,compoundingIndexPeriod,stub,firstRate,firstInterpolationTenor,secondInterpolationTenor,dayCountMethod,businessDayConvention,paymentCalendar,adjustment,rollMethod\n1,FRA,USDC,20/12/2018,20/08/2019,fixedLeg,0.15,,,100000000,3M,,,,,,,,ACT/360,,,,,floatingLeg,,,,100000000,3M,,,,,,,,ACT/360,,,,
properties:
snapshot:
$ref: "#/definitions/snapshot"
portfolio_components:
type: array
description: array of portfolio components
items:
type: object
description: one portfolio component, only type and one structure relevant for the type is filled
required:
- type
properties:
type:
type: string
description: type of this component
example: otc_csv
otc_csv:
$ref: "#/definitions/otc_csv"
otc_cb202:
$ref: "#/definitions/otc_cb202"
otc_fpml:
$ref: "#/definitions/otc_fpml"
responses:
"200":
description: OK
headers: {}
examples:
application/json:
business_date: 20200829
live: false
live_timestamp: 0
curves:
- USDC.EONIA
dv01_per_maturity:
- maturity: ON
dv01:
- 123.456
csv: Maturity,USDC.EONIA\nON,123.456
schema:
type: object
properties:
business_date:
$ref: "#/definitions/business_date"
live:
$ref: "#/definitions/live"
live_timestamp:
$ref: "#/definitions/live_timestamp"
curves:
type: array
items:
type: string
description: name of a interest rate curve
example: USDC.USDCIBOR.1M
dv01_per_maturity:
type: array
items:
type: object
description: DV01 for different curves of one maturity
properties:
maturity:
$ref: "#/definitions/otc_maturity"
dv01:
type: array
items:
type: number
example: -284.40
csv:
type: string
description: the DV01 table as one string in format that can be directly submitted to margin estimation
# @dev the `URI` SCHEMA is NOT AUTHORITATIVE, For the sake of Sanity and Readability we just use /{component}
# we can figure out the actual `URN` SCHEMA later
/greeks:
post:
summary: Greek Calculation Request
description: >-
Calculate analytical greeks (sensitivities) for given exchange traded instruments.
The instruments are specified by a technical `iid` that can be obtained by `series` query.
Two types of greeks are "typically" (read: easier to?) offered:
- numerical derivative of change in instrument price in product currency w.r.t. change in given variable, e.g. DELTA is w.r.t. change in underlying price
- the above greek converted to USDC:
- USDCO_DELTA, USDCO_GAMMA: (_underlying price_ + _price offset_) \* _greek_ \* _fx conversion to USDC_
- USDCO_RHO, USDCO_THETA, USDCO_VEGA: _greek_ \* _fx conversion to USDC_
To get a position greek, the instrument greek has to be multiplied by position size and trade unit value (TUV).
parameters:
- $ref: "#/parameters/x_fcx_apikey"
- name: body
in: body
schema:
type: object
example:
greek_types:
- USDCO_DELTA
- USDCO_VEGA
underlying_shifts_rel:
- -0.01
- 0.01
iids:
- 26807581
- 27471356
properties:
snapshot:
$ref: "#/definitions/snapshot"
greek_types:
$ref: "#/definitions/greek_types"
underlying_shifts_rel:
$ref: "#/definitions/underlying_shifts_rel"
iids:
$ref: "#/definitions/iids"
required:
- greek_types
- iids
responses:
"200":
description: OK
headers: {}
examples:
application/json:
business_date: 20200829
live: false
live_timestamp: 0
greek_types:
- USDCO_DELTA
underlying_shifts_rel:
- -0.01
- 0.01
greeks:
- iid: 26807581
values: [[674.0,565.0]]
- iid: 27471356
values: [[0.65957,0.68090]]
schema:
type: object
properties:
business_date:
$ref: "#/definitions/business_date"
live:
$ref: "#/definitions/live"
live_timestamp:
$ref: "#/definitions/live_timestamp"
greek_types:
$ref: "#/definitions/greek_types"
underlying_shifts_rel:
$ref: "#/definitions/underlying_shifts_rel"
greeks:
type: array
items:
type: object
description: Array of arrays of greeks for given instrument per greek type and per underlying shift rel, in the order given by type and shift vectors
properties:
iid:
$ref: "#/definitions/iid"
values:
type: array
items:
type: number
/stressmatrix:
post:
summary: Stress Matrix Request
description: >-
Calculate theoretical prices of given exchange traded instruments in stressed scenarios.
The scenario can have shifted underlying price and/or volatility.
For futures, volatility shift has no effect and the underlying price shift changes
directly the future price, theoretical pricing model is not used.
parameters:
- $ref: "#/parameters/x_fcx_apikey"
- name: body
in: body
schema:
type: object
example:
underlying_shifts_rel:
- 0.01
volatility_shifts:
- -0.10
- 0.10
volatility_shift_type: ABSOLUTE
iids:
- 26807581
- 27471356
properties:
snapshot:
$ref: "#/definitions/snapshot"
underlying_shifts_rel:
$ref: "#/definitions/underlying_shifts_rel"
volatility_shifts:
$ref: "#/definitions/volatility_shifts"
volatility_shift_type:
$ref: "#/definitions/volatility_shift_type"
iids:
$ref: "#/definitions/iids"
required:
- iids
responses:
"200":
description: OK
headers: {}
examples:
application/json:
business_date: 20200829
live: false
live_timestamp: 0
underlying_shifts_rel:
- '0.01'
volatility_shifts:
- '-0.1'
- '+0.1'
volatility_shift_type: RELATIVE
stress_matrix:
- iid: 26807581
values: [[0.65957],[0.68090]]
- iid: 27471356
values: [[0.65957],[0.68090]]
schema:
type: object
properties:
business_date:
$ref: "#/definitions/business_date"
live:
$ref: "#/definitions/live"
live_timestamp:
$ref: "#/definitions/live_timestamp"
underlying_shifts_rel:
$ref: "#/definitions/underlying_shifts_rel"
volatility_shifts:
$ref: "#/definitions/volatility_shifts"
volatility_shift_type:
$ref: "#/definitions/volatility_shift_type"
stress_matrix:
type: array
items:
type: object
description: Array of arrays of prices for given instrument per underlying price shift and volatility shift, in the order given by price and vola shift vectors
properties:
iid:
$ref: "#/definitions/iid"
values:
type: array
items:
type: array
items:
type: number
/config/{param}:
get:
summary: Read configuration parameter
parameters:
- $ref: "#/parameters/x_fcx_apikey"
- name: param
in: path
description: name of the parameter
required: true
type: string
responses:
200:
description: OK
examples:
application/json:
max_body_size: 262144000
schema:
type: object
properties:
max_body_size:
type: number
description: maximum allowed body size of request in bytes
parameters:
x_fcx_apikey:
name: X-FCX-APIKEY
in: header
description: your key, obtain it by registering at [FREIGHT.CX](https://console.developer.freight.cx/)
type: string
required: true
extrafields:
name: extrafields
in: query
description: comma-separated list of optional fields that should be returned in addition to the default set of response fields. Alternatively can be specified also as multiple parameter instances instead of comma-separated list.
required: false
collectionFormat: csv
type: array
items:
type: string
business_date:
name: business_date
in: query
type: number
description: Business date as of which the result is calculated, in YYYYMMDD format
## NOTE: WE USE BURGESS TO DERVICE BUSINESS DAY CONVENTIONS
## SEE: https://github.com/freight-trust/burgess
## FROM BURGESS: https://github.com/freight-trust/burgess/blob/master/logic/DayType.json
# ]
# "enumBusiness": {
# "CommodityBusiness": "When calculating the number of days between two dates the count includes only commodity business days.",
# [ "$lib": "FpML_5_10", "CME_SubmissionIRS_1_0", "CME_ClearedConfirm_1_17", "$value": "CommodityBusiness",
# "CurrencyBusiness": "When calculating the number of days between two dates the count includes only currency business days.",
# [ "$lib": "FpML_5_10", "CME_SubmissionIRS_1_0", "CME_ClearedConfirm_1_17", "$value": "CurrencyBusiness",
# "ExchangeBusiness": "When calculating the number of days between two dates the count includes only stock exchange business days.",