rakuten_trading 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +455 -0
  4. data/Rakefile +8 -0
  5. data/docs/CfdOrderBody.md +9 -0
  6. data/docs/CfdOrderBody1.md +9 -0
  7. data/docs/CfdTrade.md +28 -0
  8. data/docs/InlineResponse200.md +22 -0
  9. data/docs/InlineResponse2001.md +9 -0
  10. data/docs/InlineResponse2001Candlesticks.md +12 -0
  11. data/docs/InlineResponse2002.md +14 -0
  12. data/docs/InlineResponse2003.md +15 -0
  13. data/docs/InlineResponse2004.md +9 -0
  14. data/docs/InlineResponse2005.md +8 -0
  15. data/docs/InlineResponse2006.md +19 -0
  16. data/docs/InlineResponse2007.md +18 -0
  17. data/docs/Order.md +9 -0
  18. data/docs/OrderData.md +18 -0
  19. data/docs/OrderDetail.md +33 -0
  20. data/docs/OrderResponse.md +29 -0
  21. data/docs/PrivateApi.md +518 -0
  22. data/docs/PublicApi.md +304 -0
  23. data/docs/Trade.md +12 -0
  24. data/git_push.sh +55 -0
  25. data/lib/rakuten_trading/api/private_api.rb +537 -0
  26. data/lib/rakuten_trading/api/public_api.rb +315 -0
  27. data/lib/rakuten_trading/api_client.rb +388 -0
  28. data/lib/rakuten_trading/api_error.rb +57 -0
  29. data/lib/rakuten_trading/configuration.rb +212 -0
  30. data/lib/rakuten_trading/models/cfd_order_body.rb +224 -0
  31. data/lib/rakuten_trading/models/cfd_order_body_1.rb +224 -0
  32. data/lib/rakuten_trading/models/cfd_trade.rb +417 -0
  33. data/lib/rakuten_trading/models/inline_response_200.rb +357 -0
  34. data/lib/rakuten_trading/models/inline_response_200_1.rb +226 -0
  35. data/lib/rakuten_trading/models/inline_response_200_1_candlesticks.rb +251 -0
  36. data/lib/rakuten_trading/models/inline_response_200_2.rb +275 -0
  37. data/lib/rakuten_trading/models/inline_response_200_3.rb +281 -0
  38. data/lib/rakuten_trading/models/inline_response_200_4.rb +226 -0
  39. data/lib/rakuten_trading/models/inline_response_200_5.rb +217 -0
  40. data/lib/rakuten_trading/models/inline_response_200_6.rb +327 -0
  41. data/lib/rakuten_trading/models/inline_response_200_7.rb +317 -0
  42. data/lib/rakuten_trading/models/order.rb +224 -0
  43. data/lib/rakuten_trading/models/order_data.rb +337 -0
  44. data/lib/rakuten_trading/models/order_detail.rb +440 -0
  45. data/lib/rakuten_trading/models/order_response.rb +427 -0
  46. data/lib/rakuten_trading/models/trade.rb +253 -0
  47. data/lib/rakuten_trading/version.rb +14 -0
  48. data/lib/rakuten_trading.rb +57 -0
  49. data/rakuten_trading.gemspec +38 -0
  50. data/rakuten_trading_api.yml +1256 -0
  51. data/spec/api/private_api_spec.rb +151 -0
  52. data/spec/api/public_api_spec.rb +94 -0
  53. data/spec/api_client_spec.rb +225 -0
  54. data/spec/base_object_spec.rb +109 -0
  55. data/spec/configuration_spec.rb +41 -0
  56. data/spec/models/cfd_order_body_1_spec.rb +52 -0
  57. data/spec/models/cfd_order_body_spec.rb +52 -0
  58. data/spec/models/cfd_trade_spec.rb +166 -0
  59. data/spec/models/inline_response_200_1_candlesticks_spec.rb +70 -0
  60. data/spec/models/inline_response_200_1_spec.rb +52 -0
  61. data/spec/models/inline_response_200_2_spec.rb +82 -0
  62. data/spec/models/inline_response_200_3_spec.rb +88 -0
  63. data/spec/models/inline_response_200_4_spec.rb +52 -0
  64. data/spec/models/inline_response_200_5_spec.rb +46 -0
  65. data/spec/models/inline_response_200_6_spec.rb +112 -0
  66. data/spec/models/inline_response_200_7_spec.rb +106 -0
  67. data/spec/models/inline_response_200_spec.rb +130 -0
  68. data/spec/models/order_data_spec.rb +106 -0
  69. data/spec/models/order_detail_spec.rb +196 -0
  70. data/spec/models/order_response_spec.rb +172 -0
  71. data/spec/models/order_spec.rb +52 -0
  72. data/spec/models/trade_spec.rb +70 -0
  73. data/spec/spec_helper.rb +110 -0
  74. metadata +201 -0
@@ -0,0 +1,1256 @@
1
+ openapi: 3.0.0
2
+ info:
3
+ title: API(証拠金取引所)
4
+ description: >
5
+ 本APIを利用することにより、取り扱っている銘柄一覧の取得、ローソク足データの取得、板の取得、歩値の取得、注文、残高照会といった操作を行う事ができます。
6
+
7
+ ## 留意事項
8
+ - APIキーはお客様のアカウント情報と紐付いております。もし第三者がお客様のAPIキーを知った場合、遠隔で売買注文の操作が可能となります。APIキーを第三者へ渡す事はセキュリティリスクを鑑みお控えください。
9
+ - 他社が提供するAPI機能を使用した自動売買取引ツールは、ご自身の判断と責任でご利用ください。
10
+ - リクエストパラメーターやレスポンスの日時についてはミリ秒のtimestamp(Unix Time)を用います。
11
+ - 日時の範囲検索は「以上・未満」で検索します。
12
+
13
+ version: "1.0.0"
14
+ servers:
15
+ - url: https://exchange.rakuten-wallet.co.jp/api/v1
16
+ tags:
17
+ - name: public
18
+ description: パブリックAPI
19
+ - name: private
20
+ description: プライベートAPI
21
+
22
+ paths:
23
+ /cfd/symbol:
24
+ get:
25
+ summary: 銘柄一覧取得
26
+ description: >
27
+ 利用可能な全銘柄の一覧を取得します。
28
+ tags:
29
+ - public
30
+ operationId: get_symbol
31
+ parameters:
32
+ - name: authority
33
+ in: query
34
+ description: PERSONAL, CORPORATE。
35
+ required: false
36
+ schema:
37
+ type: string
38
+ enum:
39
+ - PERSONAL
40
+ - CORPORATE
41
+ example: CORPORATE
42
+ responses:
43
+ 200:
44
+ description: 成功
45
+ content:
46
+ application/json:
47
+ schema:
48
+ type: array
49
+ items:
50
+ type: object
51
+ properties:
52
+ id:
53
+ description: シンボルID
54
+ type: integer
55
+ format: int64
56
+ example: 7
57
+ authority:
58
+ description: 口座種別
59
+ type: string
60
+ example: PERSONAL
61
+ tradeType:
62
+ description: 取引タイプ
63
+ type: string
64
+ example: CFD
65
+ currencyPair:
66
+ description: 通貨ペア
67
+ type: string
68
+ example: BTC_JPY
69
+ baseCurrency:
70
+ description: ベース通貨
71
+ type: string
72
+ example: BTC
73
+ quoteCurrency:
74
+ description: クォート通貨
75
+ type: string
76
+ example: JPY
77
+ baseScale:
78
+ description: 数量の小数点以下桁数(ベース通貨桁数)。例) 1の場合0.1など
79
+ type: integer
80
+ example: 2
81
+ quoteScale:
82
+ description: 価格の小数点以下桁数(クォート通貨桁数)。例) 0の場合、50000など
83
+ type: integer
84
+ example: 0
85
+ baseStepAmount:
86
+ description: 取扱単位(注文数量の最小単位)
87
+ type: string
88
+ example: "0.01"
89
+ minOrderAmount:
90
+ description: 1回の最小注文数量
91
+ type: string
92
+ example: "0.01"
93
+ maxOrderAmount:
94
+ description: 1回の最大注文数量
95
+ type: string
96
+ example: "10.00"
97
+ makerTradeFeePercent:
98
+ description: メイカー約定手数料率%
99
+ type: string
100
+ example: "-0.23"
101
+ takerTradeFeePercent:
102
+ description: テイカー約定手数料率%
103
+ type: string
104
+ example: "0.23"
105
+ closeOnly:
106
+ description: 新規停止(決済・取消のみ可能)
107
+ type: boolean
108
+ example: false
109
+ viewOnly:
110
+ description: レポート閲覧のみ可能
111
+ type: boolean
112
+ example: false
113
+ enabled:
114
+ description: 有効
115
+ type: boolean
116
+ example: true
117
+
118
+ /candlestick:
119
+ get:
120
+ summary: ローソク取得
121
+ description: >
122
+ 指定された銘柄のローソク足データを取得します。データは指定された範囲で検索され、最新のデータから最大500件まで取得することが可能です。
123
+ tags:
124
+ - public
125
+ operationId: get_candlestick
126
+ parameters:
127
+ - name: symbolId
128
+ in: query
129
+ description: シンボルID
130
+ required: true
131
+ schema:
132
+ type: integer
133
+ format: int64
134
+ example: 7
135
+ - name: candlestickType
136
+ in: query
137
+ description: ローソク足の種類。ISO8601フォーマットに準拠。
138
+ required: true
139
+ schema:
140
+ type: string
141
+ enum:
142
+ - PT1M
143
+ - PT5M
144
+ - PT15M
145
+ - PT30M
146
+ - PT1H
147
+ - PT4H
148
+ - PT8H
149
+ - P1D
150
+ - P1W
151
+ - P1M
152
+ example: PT1H
153
+ - name: dateFrom
154
+ in: query
155
+ description: 取得開始日時。UNIXタイムスタンプ(ミリ秒)で指定。
156
+ required: false
157
+ schema:
158
+ type: integer
159
+ format: int64
160
+ example: 1611029776000
161
+ - name: dateTo
162
+ in: query
163
+ description: 取得終了日時。UNIXタイムスタンプ(ミリ秒)で指定。
164
+ required: false
165
+ schema:
166
+ type: integer
167
+ format: int64
168
+ example: 1611129776000
169
+ responses:
170
+ 200:
171
+ description: 成功
172
+ content:
173
+ application/json:
174
+ schema:
175
+ type: object
176
+ properties:
177
+ symbolId:
178
+ type: integer
179
+ format: int64
180
+ example: 7
181
+ candlesticks:
182
+ type: array
183
+ items:
184
+ type: object
185
+ properties:
186
+ open:
187
+ type: string
188
+ example: "3633849"
189
+ high:
190
+ type: string
191
+ example: "3878414"
192
+ low:
193
+ type: string
194
+ example: "3615752"
195
+ close:
196
+ type: string
197
+ example: "3802653"
198
+ volume:
199
+ type: string
200
+ example: "94.71"
201
+ time:
202
+ type: integer
203
+ format: int64
204
+ example: 1646891040000
205
+ timestamp:
206
+ type: integer
207
+ format: int64
208
+ example: 1646899209917
209
+ /orderbook:
210
+ get:
211
+ summary: 板取得
212
+ tags:
213
+ - public
214
+ operationId: get_orderbook
215
+ parameters:
216
+ - name: symbolId
217
+ in: query
218
+ description: シンボルID
219
+ required: true
220
+ schema:
221
+ type: integer
222
+ format: int64
223
+ example: 7
224
+ responses:
225
+ 200:
226
+ description: 成功
227
+ content:
228
+ application/json:
229
+ schema:
230
+ type: object
231
+ properties:
232
+ symbolId:
233
+ type: integer
234
+ format: int64
235
+ example: 7
236
+ asks:
237
+ type: array
238
+ description: 売り板
239
+ items:
240
+ $ref: '#/components/schemas/Order'
241
+ bids:
242
+ type: array
243
+ description: 買い板
244
+ items:
245
+ $ref: '#/components/schemas/Order'
246
+ bestAsk:
247
+ type: string
248
+ example: "3633849"
249
+ bestBid:
250
+ type: string
251
+ example: "3633749"
252
+ midPrice:
253
+ type: string
254
+ example: "3633799"
255
+ spread:
256
+ type: string
257
+ example: "100"
258
+ timestamp:
259
+ type: integer
260
+ format: int64
261
+ example: 1646979758829
262
+
263
+ /ticker:
264
+ get:
265
+ summary: ティッカー取得
266
+ operationId: get_ticker
267
+ tags:
268
+ - public
269
+ parameters:
270
+ - name: symbolId
271
+ in: query
272
+ description: シンボルID
273
+ required: true
274
+ schema:
275
+ type: integer
276
+ format: int64
277
+ example: 7
278
+ responses:
279
+ 200:
280
+ description: 成功
281
+ content:
282
+ application/json:
283
+ schema:
284
+ type: object
285
+ properties:
286
+ symbolId:
287
+ type: integer
288
+ format: int64
289
+ example: 7
290
+ bestAsk:
291
+ type: string
292
+ example: "3802663"
293
+ description: 直近の売り板の最良価格
294
+ bestBid:
295
+ type: string
296
+ example: "3802643"
297
+ description: 直近の買い板の最良価格
298
+ open:
299
+ type: string
300
+ example: "3633849"
301
+ high:
302
+ type: string
303
+ example: "3878414"
304
+ low:
305
+ type: string
306
+ example: "3615752"
307
+ last:
308
+ type: string
309
+ example: "3802653"
310
+ volume:
311
+ type: string
312
+ example: "94.71"
313
+ description: 直近24時間の出来高
314
+ timestamp:
315
+ type: integer
316
+ format: int64
317
+ example: 1647239612000
318
+
319
+ /trades:
320
+ get:
321
+ summary: 歩み値取得
322
+ operationId: get_trades
323
+ tags:
324
+ - public
325
+ parameters:
326
+ - name: symbolId
327
+ in: query
328
+ description: シンボルID
329
+ required: true
330
+ schema:
331
+ type: integer
332
+ format: int64
333
+ example: 7
334
+ responses:
335
+ 200:
336
+ description: 成功
337
+ content:
338
+ application/json:
339
+ schema:
340
+ type: object
341
+ properties:
342
+ symbolId:
343
+ type: integer
344
+ format: int64
345
+ example: 7
346
+ trades:
347
+ type: array
348
+ items:
349
+ $ref: '#/components/schemas/Trade'
350
+ timestamp:
351
+ type: integer
352
+ format: int64
353
+ example: 1611029776000
354
+ /asset:
355
+ get:
356
+ summary: 残高一覧取得
357
+ operationId: get_asset
358
+ security:
359
+ - ApiKeyAuth: []
360
+ - SignatureAuth: []
361
+ tags:
362
+ - private
363
+ description: >
364
+ アカウントの資産情報(各通貨の保有量)を取得します。
365
+ responses:
366
+ 200:
367
+ description: 成功
368
+ content:
369
+ application/json:
370
+ schema:
371
+ type: array
372
+ items:
373
+ type: object
374
+ properties:
375
+ currency:
376
+ type: string
377
+ description: 通貨
378
+ example: JPY
379
+ onhandAmount:
380
+ type: string
381
+ description: 保有数量
382
+ example: "10000000"
383
+ /cfd/equitydata:
384
+ get:
385
+ summary: 証拠金関連項目取得
386
+ operationId: get_equitydata
387
+ security:
388
+ - ApiKeyAuth: []
389
+ - SignatureAuth: []
390
+ tags:
391
+ - private
392
+ description: >
393
+ 口座の証拠金関連情報を取得します。これには建玉評価損益、必要証拠金、証拠金維持率などが含まれます。
394
+ responses:
395
+ 200:
396
+ description: 証拠金関連情報の取得に成功しました。
397
+ content:
398
+ application/json:
399
+ schema:
400
+ type: object
401
+ properties:
402
+ floatingProfit:
403
+ type: string
404
+ description: 建玉評価損益
405
+ example: "93"
406
+ floatingPositionFee:
407
+ type: string
408
+ description: 建玉管理料
409
+ example: "0"
410
+ remainingFloatingPositionFee:
411
+ type: string
412
+ description: 建玉管理料(未実現)
413
+ example: "123"
414
+ floatingTradeFee:
415
+ type: string
416
+ description: 想定約定手数料
417
+ example: "12"
418
+ floatingProfitAll:
419
+ type: string
420
+ description: 総評価損益(建玉評価損益 - 建玉管理料(未実現) - 想定約定手数料)
421
+ example: "0"
422
+ usedMargin:
423
+ type: string
424
+ description: 必要証拠金
425
+ example: "672.05"
426
+ necessaryMargin:
427
+ type: string
428
+ description: 注文中証拠金
429
+ example: "802000"
430
+ balance:
431
+ type: string
432
+ description: 証拠金残高
433
+ example: "81456"
434
+ equity:
435
+ type: string
436
+ description: 純資産額
437
+ example: "81456"
438
+ marginMaintenancePercent:
439
+ type: string
440
+ description: 証拠金維持率%
441
+ example: "207.58"
442
+ usableAmount:
443
+ type: string
444
+ description: 建玉可能額
445
+ example: "81455"
446
+ withdrawableAmount:
447
+ type: string
448
+ description: 出金可能額
449
+ example: "814553"
450
+ withdrawalAmountReserved:
451
+ type: string
452
+ description: 出金依頼中金額
453
+ example: "25000"
454
+
455
+ /cfd/order:
456
+ get:
457
+ summary: 注文一覧取得
458
+ operationId: get_order
459
+ tags:
460
+ - private
461
+ security:
462
+ - ApiKeyAuth: []
463
+ - SignatureAuth: []
464
+ description: >
465
+ 指定された条件にマッチする注文一覧を取得します。このエンドポイントを通じて、特定のシンボル、注文タイプ、または期間に関する注文の詳細情報を照会することができます。
466
+ parameters:
467
+ - name: symbolId
468
+ in: query
469
+ description: シンボルID
470
+ required: true
471
+ schema:
472
+ type: integer
473
+ format: int64
474
+ - name: id
475
+ in: query
476
+ description: 注文IDの配列
477
+ required: false
478
+ schema:
479
+ type: array
480
+ items:
481
+ type: integer
482
+ format: int64
483
+ - name: dateFrom
484
+ in: query
485
+ description: 取得開始日時(注文成立日時)。UNIXタイムスタンプ(ミリ秒)で指定。
486
+ required: false
487
+ schema:
488
+ type: integer
489
+ format: int64
490
+ - name: dateTo
491
+ in: query
492
+ description: 取得終了日時(注文成立日時)。UNIXタイムスタンプ(ミリ秒)で指定。
493
+ required: false
494
+ schema:
495
+ type: integer
496
+ format: int64
497
+ - name: orderBehavior
498
+ in: query
499
+ description: 注文の挙動(OPEN, CLOSE)
500
+ required: false
501
+ schema:
502
+ type: string
503
+ - name: orderSide
504
+ in: query
505
+ description: 売買方向(SELL, BUY)
506
+ required: false
507
+ schema:
508
+ type: string
509
+ - name: orderPattern
510
+ in: query
511
+ description: 注文パターン(NORMAL, OCO, IFD, IFD_OCO)
512
+ required: false
513
+ schema:
514
+ type: array
515
+ items:
516
+ type: string
517
+ - name: orderType
518
+ in: query
519
+ description: 執行条件(MARKET, LIMIT, STOP)
520
+ required: false
521
+ schema:
522
+ type: array
523
+ items:
524
+ type: string
525
+ - name: closeBehavior
526
+ in: query
527
+ description: 決済挙動(CROSS, FIFO)
528
+ required: false
529
+ schema:
530
+ type: array
531
+ items:
532
+ type: string
533
+ - name: orderStatus
534
+ in: query
535
+ description: 注文ステータス(WORKING_ORDER, PARTIAL_FILL)
536
+ required: false
537
+ schema:
538
+ type: array
539
+ items:
540
+ type: string
541
+ - name: postOnly
542
+ in: query
543
+ description: メイカー注文のみ許可
544
+ required: false
545
+ schema:
546
+ type: boolean
547
+ - name: size
548
+ in: query
549
+ description: 取得件数。デフォルトは30、最大は500。
550
+ required: false
551
+ schema:
552
+ type: integer
553
+ default: 30
554
+ maximum: 500
555
+ responses:
556
+ 200:
557
+ description: 注文一覧の取得に成功しました。
558
+ content:
559
+ application/json:
560
+ schema:
561
+ type: array
562
+ items:
563
+ $ref: '#/components/schemas/OrderDetail'
564
+ post:
565
+ summary: 注文
566
+ operationId: order
567
+ security:
568
+ - ApiKeyAuth: []
569
+ - SignatureAuth: []
570
+ tags:
571
+ - private
572
+ requestBody:
573
+ required: true
574
+ content:
575
+ application/json:
576
+ schema:
577
+ type: object
578
+ properties:
579
+ symbolId:
580
+ type: integer
581
+ format: int64
582
+ example: 7
583
+ orderPattern:
584
+ type: string
585
+ example: "NORMAL"
586
+ orderData:
587
+ $ref: '#/components/schemas/OrderData'
588
+ responses:
589
+ 200:
590
+ description: 注文が成功しました
591
+ content:
592
+ application/json:
593
+ schema:
594
+ type: array
595
+ items:
596
+ $ref: '#/components/schemas/OrderResponse'
597
+
598
+ put:
599
+ summary: 注文訂正
600
+ operationId: order_amend
601
+ security:
602
+ - ApiKeyAuth: []
603
+ - SignatureAuth: []
604
+ tags:
605
+ - private
606
+ requestBody:
607
+ required: true
608
+ content:
609
+ application/json:
610
+ schema:
611
+ type: object
612
+ properties:
613
+ symbolId:
614
+ type: integer
615
+ format: int64
616
+ example: 7
617
+ orderPattern:
618
+ type: string
619
+ example: "NORMAL"
620
+ orderData:
621
+ $ref: '#/components/schemas/OrderData'
622
+ responses:
623
+ 200:
624
+ description: 注文訂正が成功しました
625
+ content:
626
+ application/json:
627
+ schema:
628
+ type: array
629
+ items:
630
+ $ref: '#/components/schemas/OrderResponse'
631
+
632
+ delete:
633
+ summary: 注文取消
634
+ operationId: order_cancel
635
+ security:
636
+ - ApiKeyAuth: []
637
+ - SignatureAuth: []
638
+ tags:
639
+ - private
640
+ parameters:
641
+ - name: symbolId
642
+ in: query
643
+ description: シンボルID
644
+ required: true
645
+ schema:
646
+ type: integer
647
+ format: int64
648
+ example: 7
649
+ - name: id
650
+ in: query
651
+ description: 注文ID
652
+ required: true
653
+ schema:
654
+ type: integer
655
+ format: int64
656
+ example: 944
657
+ responses:
658
+ 200:
659
+ description: 注文取消が成功しました
660
+ content:
661
+ application/json:
662
+ schema:
663
+ type: array
664
+ items:
665
+ $ref: '#/components/schemas/OrderResponse'
666
+ /cfd/trade:
667
+ get:
668
+ summary: 約定履歴取得
669
+ operationId: get_cfd_trades
670
+ tags:
671
+ - private
672
+ security:
673
+ - ApiKeyAuth: []
674
+ - SignatureAuth: []
675
+ description: >
676
+ 指定された条件に基づくCFD取引の約定履歴(トレード)を取得します。これにより、ユーザーは過去の取引データを分析することができます。
677
+ parameters:
678
+ - name: symbolId
679
+ in: query
680
+ description: シンボルID
681
+ required: true
682
+ schema:
683
+ type: integer
684
+ format: int64
685
+ - name: id
686
+ in: query
687
+ description: 約定IDの配列
688
+ required: false
689
+ schema:
690
+ type: array
691
+ items:
692
+ type: integer
693
+ format: int64
694
+ - name: dateFrom
695
+ in: query
696
+ description: 取得開始日時(作成日時)。UNIXタイムスタンプ(ミリ秒)で指定。直近48時間。
697
+ required: false
698
+ schema:
699
+ type: integer
700
+ format: int64
701
+ - name: dateTo
702
+ in: query
703
+ description: 取得終了日時(作成日時)。UNIXタイムスタンプ(ミリ秒)で指定。直近48時間。
704
+ required: false
705
+ schema:
706
+ type: integer
707
+ format: int64
708
+ - name: orderBehavior
709
+ in: query
710
+ description: 注文の挙動(OPEN, CLOSE)
711
+ required: false
712
+ schema:
713
+ type: string
714
+ - name: tradeBehavior
715
+ in: query
716
+ description: トレードの挙動(OPEN, CLOSE)
717
+ required: false
718
+ schema:
719
+ type: string
720
+ - name: orderSide
721
+ in: query
722
+ description: 売買方向(SELL, BUY)
723
+ required: false
724
+ schema:
725
+ type: string
726
+ - name: orderPattern
727
+ in: query
728
+ description: 注文パターン(NORMAL, OCO, IFD, IFD_OCO, LOSS_CUT, CLOSE_ALL)
729
+ required: false
730
+ schema:
731
+ type: array
732
+ items:
733
+ type: string
734
+ - name: orderType
735
+ in: query
736
+ description: 執行条件(MARKET, LIMIT, STOP)
737
+ required: false
738
+ schema:
739
+ type: array
740
+ items:
741
+ type: string
742
+ - name: tradeAction
743
+ in: query
744
+ description: 約定アクション(MAKER, TAKER)
745
+ required: false
746
+ schema:
747
+ type: string
748
+ - name: orderId
749
+ in: query
750
+ description: 注文IDの配列
751
+ required: false
752
+ schema:
753
+ type: array
754
+ items:
755
+ type: integer
756
+ format: int64
757
+ - name: positionId
758
+ in: query
759
+ description: 建玉IDの配列
760
+ required: false
761
+ schema:
762
+ type: array
763
+ items:
764
+ type: integer
765
+ format: int64
766
+ - name: size
767
+ in: query
768
+ description: 取得件数。デフォルトは30、最大は500。
769
+ required: false
770
+ schema:
771
+ type: integer
772
+ default: 30
773
+ maximum: 500
774
+ responses:
775
+ 200:
776
+ description: 約定履歴の取得に成功しました。
777
+ content:
778
+ application/json:
779
+ schema:
780
+ type: array
781
+ items:
782
+ $ref: '#/components/schemas/CfdTrade'
783
+
784
+ /cfd/position:
785
+ get:
786
+ summary: 建玉一覧取得
787
+ security:
788
+ - ApiKeyAuth: []
789
+ - SignatureAuth: []
790
+ operationId: get_position
791
+ tags:
792
+ - private
793
+ parameters:
794
+ - name: symbolId
795
+ in: query
796
+ description: シンボルID。特定の銘柄に対する建玉のみを取得したい場合に指定します。
797
+ required: false
798
+ schema:
799
+ type: integer
800
+ format: int64
801
+ example: 7
802
+ - name: id
803
+ in: query
804
+ description: 建玉ID。特定の建玉情報のみを取得したい場合に指定します。
805
+ required: false
806
+ schema:
807
+ type: array
808
+ items:
809
+ type: integer
810
+ format: int64
811
+ - name: dateFrom
812
+ in: query
813
+ description: 取得開始日時。指定日時以上の建玉を検索します。
814
+ required: false
815
+ schema:
816
+ type: integer
817
+ format: int64
818
+ example: 1611029776000
819
+ - name: dateTo
820
+ in: query
821
+ description: 取得終了日時。指定日時未満の建玉を検索します。
822
+ required: false
823
+ schema:
824
+ type: integer
825
+ format: int64
826
+ example: 1611129776000
827
+ responses:
828
+ 200:
829
+ description: 成功
830
+ content:
831
+ application/json:
832
+ schema:
833
+ type: array
834
+ items:
835
+ type: object
836
+ properties:
837
+ id:
838
+ type: integer
839
+ format: int64
840
+ description: 建玉ID
841
+ example: 13714
842
+ symbolId:
843
+ type: integer
844
+ format: int64
845
+ description: シンボルID
846
+ example: 12
847
+ positionStatus:
848
+ type: string
849
+ description: 建玉ステータス(OPEN, PARTIALLY_CLOSED)
850
+ example: OPEN
851
+ orderSide:
852
+ type: string
853
+ description: 売買方向(SELL, BUY)
854
+ example: SELL
855
+ price:
856
+ type: string
857
+ description: 建値
858
+ example: "0.054"
859
+ amount:
860
+ type: string
861
+ description: 建玉数量
862
+ example: "0.012"
863
+ remainingAmount:
864
+ type: string
865
+ description: 未決済建玉数量
866
+ example: "0.012"
867
+ leverage:
868
+ type: string
869
+ description: レバレッジ
870
+ example: "1.4"
871
+ usedMargin:
872
+ type: string
873
+ description: 必要証拠金
874
+ example: "2688"
875
+ floatingProfit:
876
+ type: string
877
+ description: 建玉評価損益
878
+ example: "-135"
879
+ createdAt:
880
+ type: integer
881
+ format: int64
882
+ description: 建玉作成日時
883
+ example: 1657445402372
884
+ updatedAt:
885
+ type: integer
886
+ format: int64
887
+ description: 建玉更新日時
888
+ example: 1657545114403
889
+
890
+
891
+
892
+ components:
893
+ schemas:
894
+ Order:
895
+ type: object
896
+ properties:
897
+ price:
898
+ type: string
899
+ example: "3633849"
900
+ amount:
901
+ type: string
902
+ example: "0.01"
903
+ assetAmount:
904
+ type: string
905
+ example: "0.072"
906
+ Trade:
907
+ type: object
908
+ properties:
909
+ id:
910
+ type: integer
911
+ format: int64
912
+ example: 25
913
+ description: 約定履歴ID
914
+ orderSide:
915
+ type: string
916
+ price:
917
+ type: string
918
+ example: "5000000"
919
+ amount:
920
+ type: string
921
+ example: "0.5"
922
+ assetAmount:
923
+ type: string
924
+ example: "2500000"
925
+ description: 総額。価格 * 数量 * 円換算価格(買いの場合は買い板ベストBid, 売りの場合は売り板ベストAsk)。円換算価格取得不可時はnull
926
+ tradedAt:
927
+ type: integer
928
+ format: int64
929
+ example: 1644161460996
930
+ OrderData:
931
+ type: object
932
+ required:
933
+ - orderBehavior
934
+ - orderSide
935
+ - orderType
936
+ - amount
937
+ properties:
938
+ orderBehavior:
939
+ type: string
940
+ description: 注文の種類(新規または決済)
941
+ example: OPEN
942
+ positionId:
943
+ type: integer
944
+ format: int64
945
+ description: 決済対象の建玉ID。決済注文の場合必須。
946
+ example: 956
947
+ orderSide:
948
+ type: string
949
+ description: 売買方向(BUYまたはSELL)
950
+ example: BUY
951
+ orderType:
952
+ type: string
953
+ description: 注文タイプ(LIMIT, MARKET, STOP)
954
+ example: LIMIT
955
+ price:
956
+ type: string
957
+ description: 注文価格。指値注文や逆指値注文の場合必須。
958
+ example: "3500000"
959
+ amount:
960
+ type: string
961
+ description: 注文数量
962
+ example: "0.1"
963
+ orderExpire:
964
+ type: string
965
+ description: 注文有効期限(GTC, DAY)
966
+ example: GTC
967
+ leverage:
968
+ type: number
969
+ format: float
970
+ description: レバレッジ倍率。新規注文の場合のみ。
971
+ example: 2.0
972
+ closeBehavior:
973
+ type: string
974
+ description: 建玉決済の挙動(CROSS, FIFO)
975
+ example: CROSS
976
+ postOnly:
977
+ type: boolean
978
+ description: メイカー注文のみ許可するかどうか
979
+ example: false
980
+ ifdCloseLimitPrice:
981
+ type: string
982
+ description: IFD決済指値注文価格
983
+ example: "3800000"
984
+ ifdCloseStopPrice:
985
+ type: string
986
+ description: IFD決済逆指値注文価格
987
+ example: "3200000"
988
+ OrderDetail:
989
+ type: object
990
+ properties:
991
+ id:
992
+ type: integer
993
+ format: int64
994
+ symbolId:
995
+ type: integer
996
+ format: int64
997
+ orderBehavior:
998
+ type: string
999
+ orderSide:
1000
+ type: string
1001
+ orderPattern:
1002
+ type: string
1003
+ orderType:
1004
+ type: string
1005
+ closeBehavior:
1006
+ type: string
1007
+ price:
1008
+ type: string
1009
+ averagePrice:
1010
+ type: string
1011
+ amount:
1012
+ type: string
1013
+ remainingAmount:
1014
+ type: string
1015
+ orderStatus:
1016
+ type: string
1017
+ postOnly:
1018
+ type: boolean
1019
+ oco1OrderId:
1020
+ type: integer
1021
+ format: int64
1022
+ oco2OrderId:
1023
+ type: integer
1024
+ format: int64
1025
+ ifdOpenOrderId:
1026
+ type: integer
1027
+ format: int64
1028
+ ifdCloseLimitPrice:
1029
+ type: string
1030
+ ifdCloseStopPrice:
1031
+ type: string
1032
+ positionId:
1033
+ type: integer
1034
+ format: int64
1035
+ orderExpire:
1036
+ type: string
1037
+ expireBusinessDate:
1038
+ type: integer
1039
+ leverage:
1040
+ type: string
1041
+ necessaryMargin:
1042
+ type: string
1043
+ businessDate:
1044
+ type: integer
1045
+ orderCreatedAt:
1046
+ type: integer
1047
+ format: int64
1048
+ createdAt:
1049
+ type: integer
1050
+ format: int64
1051
+ updatedAt:
1052
+ type: integer
1053
+ format: int64
1054
+ OrderResponse:
1055
+ type: object
1056
+ properties:
1057
+ id:
1058
+ type: integer
1059
+ format: int64
1060
+ description: 注文ID
1061
+ example: 944
1062
+ symbolId:
1063
+ type: integer
1064
+ format: int64
1065
+ description: シンボルID
1066
+ example: 7
1067
+ orderBehavior:
1068
+ type: string
1069
+ description: 注文の種類(新規または決済)
1070
+ example: OPEN
1071
+ orderSide:
1072
+ type: string
1073
+ description: 売買方向(BUYまたはSELL)
1074
+ example: BUY
1075
+ orderPattern:
1076
+ type: string
1077
+ description: 注文パターン(NORMAL, OCO, IFD, IFD_OCO)
1078
+ example: NORMAL
1079
+ orderType:
1080
+ type: string
1081
+ description: 注文タイプ(LIMIT, MARKET, STOP)
1082
+ example: LIMIT
1083
+ price:
1084
+ type: string
1085
+ description: 注文価格
1086
+ example: "5500000"
1087
+ averagePrice:
1088
+ type: string
1089
+ description: 平均約定価格
1090
+ example: "0"
1091
+ amount:
1092
+ type: string
1093
+ description: 注文数量
1094
+ example: "0.20"
1095
+ remainingAmount:
1096
+ type: string
1097
+ description: 未約定数量
1098
+ example: "0.20"
1099
+ orderStatus:
1100
+ type: string
1101
+ description: 注文ステータス(WORKING_ORDER, PARTIAL_FILL等)
1102
+ example: WORKING_ORDER
1103
+ postOnly:
1104
+ type: boolean
1105
+ description: メイカー注文のみ許可されたかどうか
1106
+ example: false
1107
+ oco1OrderId:
1108
+ type: integer
1109
+ format: int64
1110
+ description: OCO1注文ID
1111
+ oco2OrderId:
1112
+ type: integer
1113
+ format: int64
1114
+ description: OCO2注文ID
1115
+ ifdOpenOrderId:
1116
+ type: integer
1117
+ format: int64
1118
+ description: IFD新規注文ID
1119
+ ifdCloseLimitPrice:
1120
+ type: string
1121
+ description: IFD決済指値注文価格
1122
+ ifdCloseStopPrice:
1123
+ type: string
1124
+ description: IFD決済逆指値注文価格
1125
+ positionId:
1126
+ type: integer
1127
+ format: int64
1128
+ description: 決済対象建玉ID
1129
+ orderExpire:
1130
+ type: string
1131
+ description: 有効期限タイプ
1132
+ example: GTC
1133
+ leverage:
1134
+ type: string
1135
+ description: レバレッジ倍率
1136
+ example: "1.2"
1137
+ necessaryMargin:
1138
+ type: string
1139
+ description: 注文中証拠金
1140
+ example: "246459"
1141
+ createdAt:
1142
+ type: integer
1143
+ format: int64
1144
+ description: 注文作成日時
1145
+ example: 1646551682584
1146
+ updatedAt:
1147
+ type: integer
1148
+ format: int64
1149
+ description: 注文更新日時
1150
+ example: 1646551837901
1151
+ CfdTrade:
1152
+ type: object
1153
+ properties:
1154
+ id:
1155
+ type: integer
1156
+ description: トレードID
1157
+ example: 1959
1158
+ symbolId:
1159
+ type: integer
1160
+ description: シンボルID
1161
+ example: 12
1162
+ orderBehavior:
1163
+ type: string
1164
+ description: 新規注文または決済注文
1165
+ example: OPEN
1166
+ tradeBehavior:
1167
+ type: string
1168
+ description: 新規約定または決済約定
1169
+ example: OPEN
1170
+ orderSide:
1171
+ type: string
1172
+ description: 売買方向
1173
+ example: BUY
1174
+ orderPattern:
1175
+ type: string
1176
+ description: 注文方法
1177
+ example: NORMAL
1178
+ orderType:
1179
+ type: string
1180
+ description: 執行条件
1181
+ example: LIMIT
1182
+ tradeAction:
1183
+ type: string
1184
+ description: 約定アクション
1185
+ example: TAKER
1186
+ price:
1187
+ type: string
1188
+ description: 約定価格
1189
+ example: "0.049"
1190
+ amount:
1191
+ type: string
1192
+ description: 約定数量
1193
+ example: "0.048"
1194
+ profit:
1195
+ type: string
1196
+ description: 売買損益
1197
+ example: "0"
1198
+ fee:
1199
+ type: string
1200
+ description: 約定手数料
1201
+ example: "38"
1202
+ positionFee:
1203
+ type: string
1204
+ description: 実現建玉管理料(円)
1205
+ example: "71"
1206
+ closeTradeProfit:
1207
+ type: string
1208
+ description: 決済損益(円)
1209
+ example: "60"
1210
+ assetAmount:
1211
+ type: string
1212
+ description: 約定代金(円)
1213
+ example: "0.003"
1214
+ openPrice:
1215
+ type: string
1216
+ description: 建値
1217
+ example: "0.049"
1218
+ jpyConversion:
1219
+ type: string
1220
+ description: 円換算価格(約定時点)
1221
+ example: "5499999"
1222
+ orderId:
1223
+ type: integer
1224
+ description: 注文ID
1225
+ example: 1399
1226
+ positionId:
1227
+ type: integer
1228
+ description: 建玉ID
1229
+ example: 2041
1230
+ businessDate:
1231
+ type: integer
1232
+ description: 取引日
1233
+ example: 20220629
1234
+ createdAt:
1235
+ type: integer
1236
+ format: int64
1237
+ description: 作成日時
1238
+ example: 1655081092602
1239
+ updatedAt:
1240
+ type: integer
1241
+ format: int64
1242
+ description: 更新日時
1243
+ example: 1655081092602
1244
+
1245
+ securitySchemes:
1246
+ ApiKeyAuth:
1247
+ type: apiKey
1248
+ in: header
1249
+ name: API-KEY
1250
+ SignatureAuth:
1251
+ type: apiKey
1252
+ in: header
1253
+ name: SIGNATURE
1254
+ security:
1255
+ - ApiKeyAuth: []
1256
+ - SignatureAuth: []