rakuten_trading 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +455 -0
- data/Rakefile +8 -0
- data/docs/CfdOrderBody.md +9 -0
- data/docs/CfdOrderBody1.md +9 -0
- data/docs/CfdTrade.md +28 -0
- data/docs/InlineResponse200.md +22 -0
- data/docs/InlineResponse2001.md +9 -0
- data/docs/InlineResponse2001Candlesticks.md +12 -0
- data/docs/InlineResponse2002.md +14 -0
- data/docs/InlineResponse2003.md +15 -0
- data/docs/InlineResponse2004.md +9 -0
- data/docs/InlineResponse2005.md +8 -0
- data/docs/InlineResponse2006.md +19 -0
- data/docs/InlineResponse2007.md +18 -0
- data/docs/Order.md +9 -0
- data/docs/OrderData.md +18 -0
- data/docs/OrderDetail.md +33 -0
- data/docs/OrderResponse.md +29 -0
- data/docs/PrivateApi.md +518 -0
- data/docs/PublicApi.md +304 -0
- data/docs/Trade.md +12 -0
- data/git_push.sh +55 -0
- data/lib/rakuten_trading/api/private_api.rb +537 -0
- data/lib/rakuten_trading/api/public_api.rb +315 -0
- data/lib/rakuten_trading/api_client.rb +388 -0
- data/lib/rakuten_trading/api_error.rb +57 -0
- data/lib/rakuten_trading/configuration.rb +212 -0
- data/lib/rakuten_trading/models/cfd_order_body.rb +224 -0
- data/lib/rakuten_trading/models/cfd_order_body_1.rb +224 -0
- data/lib/rakuten_trading/models/cfd_trade.rb +417 -0
- data/lib/rakuten_trading/models/inline_response_200.rb +357 -0
- data/lib/rakuten_trading/models/inline_response_200_1.rb +226 -0
- data/lib/rakuten_trading/models/inline_response_200_1_candlesticks.rb +251 -0
- data/lib/rakuten_trading/models/inline_response_200_2.rb +275 -0
- data/lib/rakuten_trading/models/inline_response_200_3.rb +281 -0
- data/lib/rakuten_trading/models/inline_response_200_4.rb +226 -0
- data/lib/rakuten_trading/models/inline_response_200_5.rb +217 -0
- data/lib/rakuten_trading/models/inline_response_200_6.rb +327 -0
- data/lib/rakuten_trading/models/inline_response_200_7.rb +317 -0
- data/lib/rakuten_trading/models/order.rb +224 -0
- data/lib/rakuten_trading/models/order_data.rb +337 -0
- data/lib/rakuten_trading/models/order_detail.rb +440 -0
- data/lib/rakuten_trading/models/order_response.rb +427 -0
- data/lib/rakuten_trading/models/trade.rb +253 -0
- data/lib/rakuten_trading/version.rb +14 -0
- data/lib/rakuten_trading.rb +57 -0
- data/rakuten_trading.gemspec +38 -0
- data/rakuten_trading_api.yml +1256 -0
- data/spec/api/private_api_spec.rb +151 -0
- data/spec/api/public_api_spec.rb +94 -0
- data/spec/api_client_spec.rb +225 -0
- data/spec/base_object_spec.rb +109 -0
- data/spec/configuration_spec.rb +41 -0
- data/spec/models/cfd_order_body_1_spec.rb +52 -0
- data/spec/models/cfd_order_body_spec.rb +52 -0
- data/spec/models/cfd_trade_spec.rb +166 -0
- data/spec/models/inline_response_200_1_candlesticks_spec.rb +70 -0
- data/spec/models/inline_response_200_1_spec.rb +52 -0
- data/spec/models/inline_response_200_2_spec.rb +82 -0
- data/spec/models/inline_response_200_3_spec.rb +88 -0
- data/spec/models/inline_response_200_4_spec.rb +52 -0
- data/spec/models/inline_response_200_5_spec.rb +46 -0
- data/spec/models/inline_response_200_6_spec.rb +112 -0
- data/spec/models/inline_response_200_7_spec.rb +106 -0
- data/spec/models/inline_response_200_spec.rb +130 -0
- data/spec/models/order_data_spec.rb +106 -0
- data/spec/models/order_detail_spec.rb +196 -0
- data/spec/models/order_response_spec.rb +172 -0
- data/spec/models/order_spec.rb +52 -0
- data/spec/models/trade_spec.rb +70 -0
- data/spec/spec_helper.rb +110 -0
- metadata +201 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 62ae45c0c7603ce947bdbab7ab5fc2faf9c0699277e12d9ce28df39ea559d403
|
4
|
+
data.tar.gz: 06e8eb544a700403ed1b5358cfb840cc9f99a997c17993578ce572c80f0326f5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 15b7cf992a4887761dfd453b884eb67fb1e6873a3d7bf08355a7fb8ad11e60eb62fa294a07e5b1b61ac997d703cd7396a3e5f8fa75c57df1aede56c6bb2533f1
|
7
|
+
data.tar.gz: 851fc70c38f95a4da2c8674000f5036aeaa9ad37271a27a37d8c9b6a6416d3c317257d0c777e5592d16c17d4184a453c5030beeb2c308cdbe2682243e0862017
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,455 @@
|
|
1
|
+
# rakuten_trading
|
2
|
+
|
3
|
+
RakutenTrading - the Ruby gem for the API(証拠金取引所)
|
4
|
+
|
5
|
+
本APIを利用することにより、取り扱っている銘柄一覧の取得、ローソク足データの取得、板の取得、歩値の取得、注文、残高照会といった操作を行う事ができます。 ## 留意事項 - APIキーはお客様のアカウント情報と紐付いております。もし第三者がお客様のAPIキーを知った場合、遠隔で売買注文の操作が可能となります。APIキーを第三者へ渡す事はセキュリティリスクを鑑みお控えください。 - 他社が提供するAPI機能を使用した自動売買取引ツールは、ご自身の判断と責任でご利用ください。 - リクエストパラメーターやレスポンスの日時についてはミリ秒のtimestamp(Unix Time)を用います。 - 日時の範囲検索は「以上・未満」で検索します。
|
6
|
+
|
7
|
+
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
8
|
+
|
9
|
+
- API version: 1.0.0
|
10
|
+
- Package version: 1.0.0
|
11
|
+
- Build package: io.swagger.codegen.v3.generators.ruby.RubyClientCodegen
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
### Build a gem
|
16
|
+
|
17
|
+
To build the Ruby code into a gem:
|
18
|
+
|
19
|
+
```shell
|
20
|
+
gem build rakuten_trading.gemspec
|
21
|
+
```
|
22
|
+
|
23
|
+
Then either install the gem locally:
|
24
|
+
|
25
|
+
```shell
|
26
|
+
gem install ./rakuten_trading-1.0.0.gem
|
27
|
+
```
|
28
|
+
(for development, run `gem install --dev ./rakuten_trading-1.0.0.gem` to install the development dependencies)
|
29
|
+
|
30
|
+
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
31
|
+
|
32
|
+
Finally add this to the Gemfile:
|
33
|
+
|
34
|
+
gem 'rakuten_trading', '~> 1.0.0'
|
35
|
+
|
36
|
+
### Install from Git
|
37
|
+
|
38
|
+
If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
|
39
|
+
|
40
|
+
gem 'rakuten_trading', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
|
41
|
+
|
42
|
+
### Include the Ruby code directly
|
43
|
+
|
44
|
+
Include the Ruby code directly using `-I` as follows:
|
45
|
+
|
46
|
+
```shell
|
47
|
+
ruby -Ilib script.rb
|
48
|
+
```
|
49
|
+
|
50
|
+
## Getting Started
|
51
|
+
|
52
|
+
Please follow the [installation](#installation) procedure and then run the following code:
|
53
|
+
```ruby
|
54
|
+
# Load the gem
|
55
|
+
require 'rakuten_trading'
|
56
|
+
# Setup authorization
|
57
|
+
RakutenTrading.configure do |config|
|
58
|
+
# Configure API key authorization: ApiKeyAuth
|
59
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
60
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
61
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
62
|
+
|
63
|
+
# Configure API key authorization: SignatureAuth
|
64
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
65
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
66
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
67
|
+
end
|
68
|
+
|
69
|
+
api_instance = RakutenTrading::PrivateApi.new
|
70
|
+
|
71
|
+
begin
|
72
|
+
#残高一覧取得
|
73
|
+
result = api_instance.get_asset
|
74
|
+
p result
|
75
|
+
rescue RakutenTrading::ApiError => e
|
76
|
+
puts "Exception when calling PrivateApi->get_asset: #{e}"
|
77
|
+
end
|
78
|
+
# Setup authorization
|
79
|
+
RakutenTrading.configure do |config|
|
80
|
+
# Configure API key authorization: ApiKeyAuth
|
81
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
82
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
83
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
84
|
+
|
85
|
+
# Configure API key authorization: SignatureAuth
|
86
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
87
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
88
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
89
|
+
end
|
90
|
+
|
91
|
+
api_instance = RakutenTrading::PrivateApi.new
|
92
|
+
symbol_id = 789 # Integer | シンボルID
|
93
|
+
opts = {
|
94
|
+
id: [56], # Array<Integer> | 約定IDの配列
|
95
|
+
date_from: 789, # Integer | 取得開始日時(作成日時)。UNIXタイムスタンプ(ミリ秒)で指定。直近48時間。
|
96
|
+
date_to: 789, # Integer | 取得終了日時(作成日時)。UNIXタイムスタンプ(ミリ秒)で指定。直近48時間。
|
97
|
+
order_behavior: 'order_behavior_example', # String | 注文の挙動(OPEN, CLOSE)
|
98
|
+
trade_behavior: 'trade_behavior_example', # String | トレードの挙動(OPEN, CLOSE)
|
99
|
+
order_side: 'order_side_example', # String | 売買方向(SELL, BUY)
|
100
|
+
order_pattern: ['order_pattern_example'], # Array<String> | 注文パターン(NORMAL, OCO, IFD, IFD_OCO, LOSS_CUT, CLOSE_ALL)
|
101
|
+
order_type: ['order_type_example'], # Array<String> | 執行条件(MARKET, LIMIT, STOP)
|
102
|
+
trade_action: 'trade_action_example', # String | 約定アクション(MAKER, TAKER)
|
103
|
+
order_id: [56], # Array<Integer> | 注文IDの配列
|
104
|
+
position_id: [56], # Array<Integer> | 建玉IDの配列
|
105
|
+
size: 30 # Integer | 取得件数。デフォルトは30、最大は500。
|
106
|
+
}
|
107
|
+
|
108
|
+
begin
|
109
|
+
#約定履歴取得
|
110
|
+
result = api_instance.get_cfd_trades(symbol_id, opts)
|
111
|
+
p result
|
112
|
+
rescue RakutenTrading::ApiError => e
|
113
|
+
puts "Exception when calling PrivateApi->get_cfd_trades: #{e}"
|
114
|
+
end
|
115
|
+
# Setup authorization
|
116
|
+
RakutenTrading.configure do |config|
|
117
|
+
# Configure API key authorization: ApiKeyAuth
|
118
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
119
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
120
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
121
|
+
|
122
|
+
# Configure API key authorization: SignatureAuth
|
123
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
124
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
125
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
126
|
+
end
|
127
|
+
|
128
|
+
api_instance = RakutenTrading::PrivateApi.new
|
129
|
+
|
130
|
+
begin
|
131
|
+
#証拠金関連項目取得
|
132
|
+
result = api_instance.get_equitydata
|
133
|
+
p result
|
134
|
+
rescue RakutenTrading::ApiError => e
|
135
|
+
puts "Exception when calling PrivateApi->get_equitydata: #{e}"
|
136
|
+
end
|
137
|
+
# Setup authorization
|
138
|
+
RakutenTrading.configure do |config|
|
139
|
+
# Configure API key authorization: ApiKeyAuth
|
140
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
141
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
142
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
143
|
+
|
144
|
+
# Configure API key authorization: SignatureAuth
|
145
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
146
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
147
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
148
|
+
end
|
149
|
+
|
150
|
+
api_instance = RakutenTrading::PrivateApi.new
|
151
|
+
symbol_id = 789 # Integer | シンボルID
|
152
|
+
opts = {
|
153
|
+
id: [56], # Array<Integer> | 注文IDの配列
|
154
|
+
date_from: 789, # Integer | 取得開始日時(注文成立日時)。UNIXタイムスタンプ(ミリ秒)で指定。
|
155
|
+
date_to: 789, # Integer | 取得終了日時(注文成立日時)。UNIXタイムスタンプ(ミリ秒)で指定。
|
156
|
+
order_behavior: 'order_behavior_example', # String | 注文の挙動(OPEN, CLOSE)
|
157
|
+
order_side: 'order_side_example', # String | 売買方向(SELL, BUY)
|
158
|
+
order_pattern: ['order_pattern_example'], # Array<String> | 注文パターン(NORMAL, OCO, IFD, IFD_OCO)
|
159
|
+
order_type: ['order_type_example'], # Array<String> | 執行条件(MARKET, LIMIT, STOP)
|
160
|
+
close_behavior: ['close_behavior_example'], # Array<String> | 決済挙動(CROSS, FIFO)
|
161
|
+
order_status: ['order_status_example'], # Array<String> | 注文ステータス(WORKING_ORDER, PARTIAL_FILL)
|
162
|
+
post_only: true, # BOOLEAN | メイカー注文のみ許可
|
163
|
+
size: 30 # Integer | 取得件数。デフォルトは30、最大は500。
|
164
|
+
}
|
165
|
+
|
166
|
+
begin
|
167
|
+
#注文一覧取得
|
168
|
+
result = api_instance.get_order(symbol_id, opts)
|
169
|
+
p result
|
170
|
+
rescue RakutenTrading::ApiError => e
|
171
|
+
puts "Exception when calling PrivateApi->get_order: #{e}"
|
172
|
+
end
|
173
|
+
# Setup authorization
|
174
|
+
RakutenTrading.configure do |config|
|
175
|
+
# Configure API key authorization: ApiKeyAuth
|
176
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
177
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
178
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
179
|
+
|
180
|
+
# Configure API key authorization: SignatureAuth
|
181
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
182
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
183
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
184
|
+
end
|
185
|
+
|
186
|
+
api_instance = RakutenTrading::PrivateApi.new
|
187
|
+
opts = {
|
188
|
+
symbol_id: 789, # Integer | シンボルID。特定の銘柄に対する建玉のみを取得したい場合に指定します。
|
189
|
+
id: [56], # Array<Integer> | 建玉ID。特定の建玉情報のみを取得したい場合に指定します。
|
190
|
+
date_from: 789, # Integer | 取得開始日時。指定日時以上の建玉を検索します。
|
191
|
+
date_to: 789 # Integer | 取得終了日時。指定日時未満の建玉を検索します。
|
192
|
+
}
|
193
|
+
|
194
|
+
begin
|
195
|
+
#建玉一覧取得
|
196
|
+
result = api_instance.get_position(opts)
|
197
|
+
p result
|
198
|
+
rescue RakutenTrading::ApiError => e
|
199
|
+
puts "Exception when calling PrivateApi->get_position: #{e}"
|
200
|
+
end
|
201
|
+
# Setup authorization
|
202
|
+
RakutenTrading.configure do |config|
|
203
|
+
# Configure API key authorization: ApiKeyAuth
|
204
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
205
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
206
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
207
|
+
|
208
|
+
# Configure API key authorization: SignatureAuth
|
209
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
210
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
211
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
212
|
+
end
|
213
|
+
|
214
|
+
api_instance = RakutenTrading::PrivateApi.new
|
215
|
+
body = RakutenTrading::CfdOrderBody1.new # CfdOrderBody1 |
|
216
|
+
|
217
|
+
|
218
|
+
begin
|
219
|
+
#注文
|
220
|
+
result = api_instance.order(body)
|
221
|
+
p result
|
222
|
+
rescue RakutenTrading::ApiError => e
|
223
|
+
puts "Exception when calling PrivateApi->order: #{e}"
|
224
|
+
end
|
225
|
+
# Setup authorization
|
226
|
+
RakutenTrading.configure do |config|
|
227
|
+
# Configure API key authorization: ApiKeyAuth
|
228
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
229
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
230
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
231
|
+
|
232
|
+
# Configure API key authorization: SignatureAuth
|
233
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
234
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
235
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
236
|
+
end
|
237
|
+
|
238
|
+
api_instance = RakutenTrading::PrivateApi.new
|
239
|
+
body = RakutenTrading::CfdOrderBody.new # CfdOrderBody |
|
240
|
+
|
241
|
+
|
242
|
+
begin
|
243
|
+
#注文訂正
|
244
|
+
result = api_instance.order_amend(body)
|
245
|
+
p result
|
246
|
+
rescue RakutenTrading::ApiError => e
|
247
|
+
puts "Exception when calling PrivateApi->order_amend: #{e}"
|
248
|
+
end
|
249
|
+
# Setup authorization
|
250
|
+
RakutenTrading.configure do |config|
|
251
|
+
# Configure API key authorization: ApiKeyAuth
|
252
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
253
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
254
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
255
|
+
|
256
|
+
# Configure API key authorization: SignatureAuth
|
257
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
258
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
259
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
260
|
+
end
|
261
|
+
|
262
|
+
api_instance = RakutenTrading::PrivateApi.new
|
263
|
+
symbol_id = 789 # Integer | シンボルID
|
264
|
+
id = 789 # Integer | 注文ID
|
265
|
+
|
266
|
+
|
267
|
+
begin
|
268
|
+
#注文取消
|
269
|
+
result = api_instance.order_cancel(symbol_id, id)
|
270
|
+
p result
|
271
|
+
rescue RakutenTrading::ApiError => e
|
272
|
+
puts "Exception when calling PrivateApi->order_cancel: #{e}"
|
273
|
+
end
|
274
|
+
# Setup authorization
|
275
|
+
RakutenTrading.configure do |config|
|
276
|
+
# Configure API key authorization: ApiKeyAuth
|
277
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
278
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
279
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
280
|
+
|
281
|
+
# Configure API key authorization: SignatureAuth
|
282
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
283
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
284
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
285
|
+
end
|
286
|
+
|
287
|
+
api_instance = RakutenTrading::PublicApi.new
|
288
|
+
symbol_id = 789 # Integer | シンボルID
|
289
|
+
candlestick_type = 'candlestick_type_example' # String | ローソク足の種類。ISO8601フォーマットに準拠。
|
290
|
+
opts = {
|
291
|
+
date_from: 789, # Integer | 取得開始日時。UNIXタイムスタンプ(ミリ秒)で指定。
|
292
|
+
date_to: 789 # Integer | 取得終了日時。UNIXタイムスタンプ(ミリ秒)で指定。
|
293
|
+
}
|
294
|
+
|
295
|
+
begin
|
296
|
+
#ローソク取得
|
297
|
+
result = api_instance.get_candlestick(symbol_id, candlestick_type, opts)
|
298
|
+
p result
|
299
|
+
rescue RakutenTrading::ApiError => e
|
300
|
+
puts "Exception when calling PublicApi->get_candlestick: #{e}"
|
301
|
+
end
|
302
|
+
# Setup authorization
|
303
|
+
RakutenTrading.configure do |config|
|
304
|
+
# Configure API key authorization: ApiKeyAuth
|
305
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
306
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
307
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
308
|
+
|
309
|
+
# Configure API key authorization: SignatureAuth
|
310
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
311
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
312
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
313
|
+
end
|
314
|
+
|
315
|
+
api_instance = RakutenTrading::PublicApi.new
|
316
|
+
symbol_id = 789 # Integer | シンボルID
|
317
|
+
|
318
|
+
|
319
|
+
begin
|
320
|
+
#板取得
|
321
|
+
result = api_instance.get_orderbook(symbol_id)
|
322
|
+
p result
|
323
|
+
rescue RakutenTrading::ApiError => e
|
324
|
+
puts "Exception when calling PublicApi->get_orderbook: #{e}"
|
325
|
+
end
|
326
|
+
# Setup authorization
|
327
|
+
RakutenTrading.configure do |config|
|
328
|
+
# Configure API key authorization: ApiKeyAuth
|
329
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
330
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
331
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
332
|
+
|
333
|
+
# Configure API key authorization: SignatureAuth
|
334
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
335
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
336
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
337
|
+
end
|
338
|
+
|
339
|
+
api_instance = RakutenTrading::PublicApi.new
|
340
|
+
opts = {
|
341
|
+
authority: 'authority_example' # String | PERSONAL, CORPORATE。
|
342
|
+
}
|
343
|
+
|
344
|
+
begin
|
345
|
+
#銘柄一覧取得
|
346
|
+
result = api_instance.get_symbol(opts)
|
347
|
+
p result
|
348
|
+
rescue RakutenTrading::ApiError => e
|
349
|
+
puts "Exception when calling PublicApi->get_symbol: #{e}"
|
350
|
+
end
|
351
|
+
# Setup authorization
|
352
|
+
RakutenTrading.configure do |config|
|
353
|
+
# Configure API key authorization: ApiKeyAuth
|
354
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
355
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
356
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
357
|
+
|
358
|
+
# Configure API key authorization: SignatureAuth
|
359
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
360
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
361
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
362
|
+
end
|
363
|
+
|
364
|
+
api_instance = RakutenTrading::PublicApi.new
|
365
|
+
symbol_id = 789 # Integer | シンボルID
|
366
|
+
|
367
|
+
|
368
|
+
begin
|
369
|
+
#ティッカー取得
|
370
|
+
result = api_instance.get_ticker(symbol_id)
|
371
|
+
p result
|
372
|
+
rescue RakutenTrading::ApiError => e
|
373
|
+
puts "Exception when calling PublicApi->get_ticker: #{e}"
|
374
|
+
end
|
375
|
+
# Setup authorization
|
376
|
+
RakutenTrading.configure do |config|
|
377
|
+
# Configure API key authorization: ApiKeyAuth
|
378
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
379
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
380
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
381
|
+
|
382
|
+
# Configure API key authorization: SignatureAuth
|
383
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
384
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
385
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
386
|
+
end
|
387
|
+
|
388
|
+
api_instance = RakutenTrading::PublicApi.new
|
389
|
+
symbol_id = 789 # Integer | シンボルID
|
390
|
+
|
391
|
+
|
392
|
+
begin
|
393
|
+
#歩み値取得
|
394
|
+
result = api_instance.get_trades(symbol_id)
|
395
|
+
p result
|
396
|
+
rescue RakutenTrading::ApiError => e
|
397
|
+
puts "Exception when calling PublicApi->get_trades: #{e}"
|
398
|
+
end
|
399
|
+
```
|
400
|
+
|
401
|
+
## Documentation for API Endpoints
|
402
|
+
|
403
|
+
All URIs are relative to *https://exchange.rakuten-wallet.co.jp/api/v1*
|
404
|
+
|
405
|
+
Class | Method | HTTP request | Description
|
406
|
+
------------ | ------------- | ------------- | -------------
|
407
|
+
*RakutenTrading::PrivateApi* | [**get_asset**](docs/PrivateApi.md#get_asset) | **GET** /asset | 残高一覧取得
|
408
|
+
*RakutenTrading::PrivateApi* | [**get_cfd_trades**](docs/PrivateApi.md#get_cfd_trades) | **GET** /cfd/trade | 約定履歴取得
|
409
|
+
*RakutenTrading::PrivateApi* | [**get_equitydata**](docs/PrivateApi.md#get_equitydata) | **GET** /cfd/equitydata | 証拠金関連項目取得
|
410
|
+
*RakutenTrading::PrivateApi* | [**get_order**](docs/PrivateApi.md#get_order) | **GET** /cfd/order | 注文一覧取得
|
411
|
+
*RakutenTrading::PrivateApi* | [**get_position**](docs/PrivateApi.md#get_position) | **GET** /cfd/position | 建玉一覧取得
|
412
|
+
*RakutenTrading::PrivateApi* | [**order**](docs/PrivateApi.md#order) | **POST** /cfd/order | 注文
|
413
|
+
*RakutenTrading::PrivateApi* | [**order_amend**](docs/PrivateApi.md#order_amend) | **PUT** /cfd/order | 注文訂正
|
414
|
+
*RakutenTrading::PrivateApi* | [**order_cancel**](docs/PrivateApi.md#order_cancel) | **DELETE** /cfd/order | 注文取消
|
415
|
+
*RakutenTrading::PublicApi* | [**get_candlestick**](docs/PublicApi.md#get_candlestick) | **GET** /candlestick | ローソク取得
|
416
|
+
*RakutenTrading::PublicApi* | [**get_orderbook**](docs/PublicApi.md#get_orderbook) | **GET** /orderbook | 板取得
|
417
|
+
*RakutenTrading::PublicApi* | [**get_symbol**](docs/PublicApi.md#get_symbol) | **GET** /cfd/symbol | 銘柄一覧取得
|
418
|
+
*RakutenTrading::PublicApi* | [**get_ticker**](docs/PublicApi.md#get_ticker) | **GET** /ticker | ティッカー取得
|
419
|
+
*RakutenTrading::PublicApi* | [**get_trades**](docs/PublicApi.md#get_trades) | **GET** /trades | 歩み値取得
|
420
|
+
|
421
|
+
## Documentation for Models
|
422
|
+
|
423
|
+
- [RakutenTrading::CfdOrderBody](docs/CfdOrderBody.md)
|
424
|
+
- [RakutenTrading::CfdOrderBody1](docs/CfdOrderBody1.md)
|
425
|
+
- [RakutenTrading::CfdTrade](docs/CfdTrade.md)
|
426
|
+
- [RakutenTrading::InlineResponse200](docs/InlineResponse200.md)
|
427
|
+
- [RakutenTrading::InlineResponse2001](docs/InlineResponse2001.md)
|
428
|
+
- [RakutenTrading::InlineResponse2001Candlesticks](docs/InlineResponse2001Candlesticks.md)
|
429
|
+
- [RakutenTrading::InlineResponse2002](docs/InlineResponse2002.md)
|
430
|
+
- [RakutenTrading::InlineResponse2003](docs/InlineResponse2003.md)
|
431
|
+
- [RakutenTrading::InlineResponse2004](docs/InlineResponse2004.md)
|
432
|
+
- [RakutenTrading::InlineResponse2005](docs/InlineResponse2005.md)
|
433
|
+
- [RakutenTrading::InlineResponse2006](docs/InlineResponse2006.md)
|
434
|
+
- [RakutenTrading::InlineResponse2007](docs/InlineResponse2007.md)
|
435
|
+
- [RakutenTrading::Order](docs/Order.md)
|
436
|
+
- [RakutenTrading::OrderData](docs/OrderData.md)
|
437
|
+
- [RakutenTrading::OrderDetail](docs/OrderDetail.md)
|
438
|
+
- [RakutenTrading::OrderResponse](docs/OrderResponse.md)
|
439
|
+
- [RakutenTrading::Trade](docs/Trade.md)
|
440
|
+
|
441
|
+
## Documentation for Authorization
|
442
|
+
|
443
|
+
|
444
|
+
### ApiKeyAuth
|
445
|
+
|
446
|
+
- **Type**: API key
|
447
|
+
- **API key parameter name**: API-KEY
|
448
|
+
- **Location**: HTTP header
|
449
|
+
|
450
|
+
### SignatureAuth
|
451
|
+
|
452
|
+
- **Type**: API key
|
453
|
+
- **API key parameter name**: SIGNATURE
|
454
|
+
- **Location**: HTTP header
|
455
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# RakutenTrading::CfdOrderBody
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**symbol_id** | **Integer** | | [optional]
|
7
|
+
**order_pattern** | **String** | | [optional]
|
8
|
+
**order_data** | [**OrderData**](OrderData.md) | | [optional]
|
9
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# RakutenTrading::CfdOrderBody1
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**symbol_id** | **Integer** | | [optional]
|
7
|
+
**order_pattern** | **String** | | [optional]
|
8
|
+
**order_data** | [**OrderData**](OrderData.md) | | [optional]
|
9
|
+
|
data/docs/CfdTrade.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# RakutenTrading::CfdTrade
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**id** | **Integer** | トレードID | [optional]
|
7
|
+
**symbol_id** | **Integer** | シンボルID | [optional]
|
8
|
+
**order_behavior** | **String** | 新規注文または決済注文 | [optional]
|
9
|
+
**trade_behavior** | **String** | 新規約定または決済約定 | [optional]
|
10
|
+
**order_side** | **String** | 売買方向 | [optional]
|
11
|
+
**order_pattern** | **String** | 注文方法 | [optional]
|
12
|
+
**order_type** | **String** | 執行条件 | [optional]
|
13
|
+
**trade_action** | **String** | 約定アクション | [optional]
|
14
|
+
**price** | **String** | 約定価格 | [optional]
|
15
|
+
**amount** | **String** | 約定数量 | [optional]
|
16
|
+
**profit** | **String** | 売買損益 | [optional]
|
17
|
+
**fee** | **String** | 約定手数料 | [optional]
|
18
|
+
**position_fee** | **String** | 実現建玉管理料(円) | [optional]
|
19
|
+
**close_trade_profit** | **String** | 決済損益(円) | [optional]
|
20
|
+
**asset_amount** | **String** | 約定代金(円) | [optional]
|
21
|
+
**open_price** | **String** | 建値 | [optional]
|
22
|
+
**jpy_conversion** | **String** | 円換算価格(約定時点) | [optional]
|
23
|
+
**order_id** | **Integer** | 注文ID | [optional]
|
24
|
+
**position_id** | **Integer** | 建玉ID | [optional]
|
25
|
+
**business_date** | **Integer** | 取引日 | [optional]
|
26
|
+
**created_at** | **Integer** | 作成日時 | [optional]
|
27
|
+
**updated_at** | **Integer** | 更新日時 | [optional]
|
28
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# RakutenTrading::InlineResponse200
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**id** | **Integer** | シンボルID | [optional]
|
7
|
+
**authority** | **String** | 口座種別 | [optional]
|
8
|
+
**trade_type** | **String** | 取引タイプ | [optional]
|
9
|
+
**currency_pair** | **String** | 通貨ペア | [optional]
|
10
|
+
**base_currency** | **String** | ベース通貨 | [optional]
|
11
|
+
**quote_currency** | **String** | クォート通貨 | [optional]
|
12
|
+
**base_scale** | **Integer** | 数量の小数点以下桁数(ベース通貨桁数)。例) 1の場合0.1など | [optional]
|
13
|
+
**quote_scale** | **Integer** | 価格の小数点以下桁数(クォート通貨桁数)。例) 0の場合、50000など | [optional]
|
14
|
+
**base_step_amount** | **String** | 取扱単位(注文数量の最小単位) | [optional]
|
15
|
+
**min_order_amount** | **String** | 1回の最小注文数量 | [optional]
|
16
|
+
**max_order_amount** | **String** | 1回の最大注文数量 | [optional]
|
17
|
+
**maker_trade_fee_percent** | **String** | メイカー約定手数料率% | [optional]
|
18
|
+
**taker_trade_fee_percent** | **String** | テイカー約定手数料率% | [optional]
|
19
|
+
**close_only** | **BOOLEAN** | 新規停止(決済・取消のみ可能) | [optional]
|
20
|
+
**view_only** | **BOOLEAN** | レポート閲覧のみ可能 | [optional]
|
21
|
+
**enabled** | **BOOLEAN** | 有効 | [optional]
|
22
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# RakutenTrading::InlineResponse2001
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**symbol_id** | **Integer** | | [optional]
|
7
|
+
**candlesticks** | [**Array<InlineResponse2001Candlesticks>**](InlineResponse2001Candlesticks.md) | | [optional]
|
8
|
+
**timestamp** | **Integer** | | [optional]
|
9
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# RakutenTrading::InlineResponse2001Candlesticks
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**open** | **String** | | [optional]
|
7
|
+
**high** | **String** | | [optional]
|
8
|
+
**low** | **String** | | [optional]
|
9
|
+
**close** | **String** | | [optional]
|
10
|
+
**volume** | **String** | | [optional]
|
11
|
+
**time** | **Integer** | | [optional]
|
12
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# RakutenTrading::InlineResponse2002
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**symbol_id** | **Integer** | | [optional]
|
7
|
+
**asks** | [**Array<Order>**](Order.md) | 売り板 | [optional]
|
8
|
+
**bids** | [**Array<Order>**](Order.md) | 買い板 | [optional]
|
9
|
+
**best_ask** | **String** | | [optional]
|
10
|
+
**best_bid** | **String** | | [optional]
|
11
|
+
**mid_price** | **String** | | [optional]
|
12
|
+
**spread** | **String** | | [optional]
|
13
|
+
**timestamp** | **Integer** | | [optional]
|
14
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# RakutenTrading::InlineResponse2003
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**symbol_id** | **Integer** | | [optional]
|
7
|
+
**best_ask** | **String** | 直近の売り板の最良価格 | [optional]
|
8
|
+
**best_bid** | **String** | 直近の買い板の最良価格 | [optional]
|
9
|
+
**open** | **String** | | [optional]
|
10
|
+
**high** | **String** | | [optional]
|
11
|
+
**low** | **String** | | [optional]
|
12
|
+
**last** | **String** | | [optional]
|
13
|
+
**volume** | **String** | 直近24時間の出来高 | [optional]
|
14
|
+
**timestamp** | **Integer** | | [optional]
|
15
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# RakutenTrading::InlineResponse2004
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**symbol_id** | **Integer** | | [optional]
|
7
|
+
**trades** | [**Array<Trade>**](Trade.md) | | [optional]
|
8
|
+
**timestamp** | **Integer** | | [optional]
|
9
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# RakutenTrading::InlineResponse2006
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**floating_profit** | **String** | 建玉評価損益 | [optional]
|
7
|
+
**floating_position_fee** | **String** | 建玉管理料 | [optional]
|
8
|
+
**remaining_floating_position_fee** | **String** | 建玉管理料(未実現) | [optional]
|
9
|
+
**floating_trade_fee** | **String** | 想定約定手数料 | [optional]
|
10
|
+
**floating_profit_all** | **String** | 総評価損益(建玉評価損益 - 建玉管理料(未実現) - 想定約定手数料) | [optional]
|
11
|
+
**used_margin** | **String** | 必要証拠金 | [optional]
|
12
|
+
**necessary_margin** | **String** | 注文中証拠金 | [optional]
|
13
|
+
**balance** | **String** | 証拠金残高 | [optional]
|
14
|
+
**equity** | **String** | 純資産額 | [optional]
|
15
|
+
**margin_maintenance_percent** | **String** | 証拠金維持率% | [optional]
|
16
|
+
**usable_amount** | **String** | 建玉可能額 | [optional]
|
17
|
+
**withdrawable_amount** | **String** | 出金可能額 | [optional]
|
18
|
+
**withdrawal_amount_reserved** | **String** | 出金依頼中金額 | [optional]
|
19
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# RakutenTrading::InlineResponse2007
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**id** | **Integer** | 建玉ID | [optional]
|
7
|
+
**symbol_id** | **Integer** | シンボルID | [optional]
|
8
|
+
**position_status** | **String** | 建玉ステータス(OPEN, PARTIALLY_CLOSED) | [optional]
|
9
|
+
**order_side** | **String** | 売買方向(SELL, BUY) | [optional]
|
10
|
+
**price** | **String** | 建値 | [optional]
|
11
|
+
**amount** | **String** | 建玉数量 | [optional]
|
12
|
+
**remaining_amount** | **String** | 未決済建玉数量 | [optional]
|
13
|
+
**leverage** | **String** | レバレッジ | [optional]
|
14
|
+
**used_margin** | **String** | 必要証拠金 | [optional]
|
15
|
+
**floating_profit** | **String** | 建玉評価損益 | [optional]
|
16
|
+
**created_at** | **Integer** | 建玉作成日時 | [optional]
|
17
|
+
**updated_at** | **Integer** | 建玉更新日時 | [optional]
|
18
|
+
|