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
data/docs/PublicApi.md
ADDED
@@ -0,0 +1,304 @@
|
|
1
|
+
# RakutenTrading::PublicApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://exchange.rakuten-wallet.co.jp/api/v1*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**get_candlestick**](PublicApi.md#get_candlestick) | **GET** /candlestick | ローソク取得
|
8
|
+
[**get_orderbook**](PublicApi.md#get_orderbook) | **GET** /orderbook | 板取得
|
9
|
+
[**get_symbol**](PublicApi.md#get_symbol) | **GET** /cfd/symbol | 銘柄一覧取得
|
10
|
+
[**get_ticker**](PublicApi.md#get_ticker) | **GET** /ticker | ティッカー取得
|
11
|
+
[**get_trades**](PublicApi.md#get_trades) | **GET** /trades | 歩み値取得
|
12
|
+
|
13
|
+
# **get_candlestick**
|
14
|
+
> InlineResponse2001 get_candlestick(symbol_id, candlestick_type, opts)
|
15
|
+
|
16
|
+
ローソク取得
|
17
|
+
|
18
|
+
指定された銘柄のローソク足データを取得します。データは指定された範囲で検索され、最新のデータから最大500件まで取得することが可能です。
|
19
|
+
|
20
|
+
### Example
|
21
|
+
```ruby
|
22
|
+
# load the gem
|
23
|
+
require 'rakuten_trading'
|
24
|
+
# setup authorization
|
25
|
+
RakutenTrading.configure do |config|
|
26
|
+
# Configure API key authorization: ApiKeyAuth
|
27
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
28
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
29
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
30
|
+
|
31
|
+
# Configure API key authorization: SignatureAuth
|
32
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
33
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
34
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
35
|
+
end
|
36
|
+
|
37
|
+
api_instance = RakutenTrading::PublicApi.new
|
38
|
+
symbol_id = 789 # Integer | シンボルID
|
39
|
+
candlestick_type = 'candlestick_type_example' # String | ローソク足の種類。ISO8601フォーマットに準拠。
|
40
|
+
opts = {
|
41
|
+
date_from: 789, # Integer | 取得開始日時。UNIXタイムスタンプ(ミリ秒)で指定。
|
42
|
+
date_to: 789 # Integer | 取得終了日時。UNIXタイムスタンプ(ミリ秒)で指定。
|
43
|
+
}
|
44
|
+
|
45
|
+
begin
|
46
|
+
#ローソク取得
|
47
|
+
result = api_instance.get_candlestick(symbol_id, candlestick_type, opts)
|
48
|
+
p result
|
49
|
+
rescue RakutenTrading::ApiError => e
|
50
|
+
puts "Exception when calling PublicApi->get_candlestick: #{e}"
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
54
|
+
### Parameters
|
55
|
+
|
56
|
+
Name | Type | Description | Notes
|
57
|
+
------------- | ------------- | ------------- | -------------
|
58
|
+
**symbol_id** | **Integer**| シンボルID |
|
59
|
+
**candlestick_type** | **String**| ローソク足の種類。ISO8601フォーマットに準拠。 |
|
60
|
+
**date_from** | **Integer**| 取得開始日時。UNIXタイムスタンプ(ミリ秒)で指定。 | [optional]
|
61
|
+
**date_to** | **Integer**| 取得終了日時。UNIXタイムスタンプ(ミリ秒)で指定。 | [optional]
|
62
|
+
|
63
|
+
### Return type
|
64
|
+
|
65
|
+
[**InlineResponse2001**](InlineResponse2001.md)
|
66
|
+
|
67
|
+
### Authorization
|
68
|
+
|
69
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth), [SignatureAuth](../README.md#SignatureAuth)
|
70
|
+
|
71
|
+
### HTTP request headers
|
72
|
+
|
73
|
+
- **Content-Type**: Not defined
|
74
|
+
- **Accept**: application/json
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
# **get_orderbook**
|
79
|
+
> InlineResponse2002 get_orderbook(symbol_id)
|
80
|
+
|
81
|
+
板取得
|
82
|
+
|
83
|
+
### Example
|
84
|
+
```ruby
|
85
|
+
# load the gem
|
86
|
+
require 'rakuten_trading'
|
87
|
+
# setup authorization
|
88
|
+
RakutenTrading.configure do |config|
|
89
|
+
# Configure API key authorization: ApiKeyAuth
|
90
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
91
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
92
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
93
|
+
|
94
|
+
# Configure API key authorization: SignatureAuth
|
95
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
96
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
97
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
98
|
+
end
|
99
|
+
|
100
|
+
api_instance = RakutenTrading::PublicApi.new
|
101
|
+
symbol_id = 789 # Integer | シンボルID
|
102
|
+
|
103
|
+
|
104
|
+
begin
|
105
|
+
#板取得
|
106
|
+
result = api_instance.get_orderbook(symbol_id)
|
107
|
+
p result
|
108
|
+
rescue RakutenTrading::ApiError => e
|
109
|
+
puts "Exception when calling PublicApi->get_orderbook: #{e}"
|
110
|
+
end
|
111
|
+
```
|
112
|
+
|
113
|
+
### Parameters
|
114
|
+
|
115
|
+
Name | Type | Description | Notes
|
116
|
+
------------- | ------------- | ------------- | -------------
|
117
|
+
**symbol_id** | **Integer**| シンボルID |
|
118
|
+
|
119
|
+
### Return type
|
120
|
+
|
121
|
+
[**InlineResponse2002**](InlineResponse2002.md)
|
122
|
+
|
123
|
+
### Authorization
|
124
|
+
|
125
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth), [SignatureAuth](../README.md#SignatureAuth)
|
126
|
+
|
127
|
+
### HTTP request headers
|
128
|
+
|
129
|
+
- **Content-Type**: Not defined
|
130
|
+
- **Accept**: application/json
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
# **get_symbol**
|
135
|
+
> Array<InlineResponse200> get_symbol(opts)
|
136
|
+
|
137
|
+
銘柄一覧取得
|
138
|
+
|
139
|
+
利用可能な全銘柄の一覧を取得します。
|
140
|
+
|
141
|
+
### Example
|
142
|
+
```ruby
|
143
|
+
# load the gem
|
144
|
+
require 'rakuten_trading'
|
145
|
+
# setup authorization
|
146
|
+
RakutenTrading.configure do |config|
|
147
|
+
# Configure API key authorization: ApiKeyAuth
|
148
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
149
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
150
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
151
|
+
|
152
|
+
# Configure API key authorization: SignatureAuth
|
153
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
154
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
155
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
156
|
+
end
|
157
|
+
|
158
|
+
api_instance = RakutenTrading::PublicApi.new
|
159
|
+
opts = {
|
160
|
+
authority: 'authority_example' # String | PERSONAL, CORPORATE。
|
161
|
+
}
|
162
|
+
|
163
|
+
begin
|
164
|
+
#銘柄一覧取得
|
165
|
+
result = api_instance.get_symbol(opts)
|
166
|
+
p result
|
167
|
+
rescue RakutenTrading::ApiError => e
|
168
|
+
puts "Exception when calling PublicApi->get_symbol: #{e}"
|
169
|
+
end
|
170
|
+
```
|
171
|
+
|
172
|
+
### Parameters
|
173
|
+
|
174
|
+
Name | Type | Description | Notes
|
175
|
+
------------- | ------------- | ------------- | -------------
|
176
|
+
**authority** | **String**| PERSONAL, CORPORATE。 | [optional]
|
177
|
+
|
178
|
+
### Return type
|
179
|
+
|
180
|
+
[**Array<InlineResponse200>**](InlineResponse200.md)
|
181
|
+
|
182
|
+
### Authorization
|
183
|
+
|
184
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth), [SignatureAuth](../README.md#SignatureAuth)
|
185
|
+
|
186
|
+
### HTTP request headers
|
187
|
+
|
188
|
+
- **Content-Type**: Not defined
|
189
|
+
- **Accept**: application/json
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
# **get_ticker**
|
194
|
+
> InlineResponse2003 get_ticker(symbol_id)
|
195
|
+
|
196
|
+
ティッカー取得
|
197
|
+
|
198
|
+
### Example
|
199
|
+
```ruby
|
200
|
+
# load the gem
|
201
|
+
require 'rakuten_trading'
|
202
|
+
# setup authorization
|
203
|
+
RakutenTrading.configure do |config|
|
204
|
+
# Configure API key authorization: ApiKeyAuth
|
205
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
206
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
207
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
208
|
+
|
209
|
+
# Configure API key authorization: SignatureAuth
|
210
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
211
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
212
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
213
|
+
end
|
214
|
+
|
215
|
+
api_instance = RakutenTrading::PublicApi.new
|
216
|
+
symbol_id = 789 # Integer | シンボルID
|
217
|
+
|
218
|
+
|
219
|
+
begin
|
220
|
+
#ティッカー取得
|
221
|
+
result = api_instance.get_ticker(symbol_id)
|
222
|
+
p result
|
223
|
+
rescue RakutenTrading::ApiError => e
|
224
|
+
puts "Exception when calling PublicApi->get_ticker: #{e}"
|
225
|
+
end
|
226
|
+
```
|
227
|
+
|
228
|
+
### Parameters
|
229
|
+
|
230
|
+
Name | Type | Description | Notes
|
231
|
+
------------- | ------------- | ------------- | -------------
|
232
|
+
**symbol_id** | **Integer**| シンボルID |
|
233
|
+
|
234
|
+
### Return type
|
235
|
+
|
236
|
+
[**InlineResponse2003**](InlineResponse2003.md)
|
237
|
+
|
238
|
+
### Authorization
|
239
|
+
|
240
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth), [SignatureAuth](../README.md#SignatureAuth)
|
241
|
+
|
242
|
+
### HTTP request headers
|
243
|
+
|
244
|
+
- **Content-Type**: Not defined
|
245
|
+
- **Accept**: application/json
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
# **get_trades**
|
250
|
+
> InlineResponse2004 get_trades(symbol_id)
|
251
|
+
|
252
|
+
歩み値取得
|
253
|
+
|
254
|
+
### Example
|
255
|
+
```ruby
|
256
|
+
# load the gem
|
257
|
+
require 'rakuten_trading'
|
258
|
+
# setup authorization
|
259
|
+
RakutenTrading.configure do |config|
|
260
|
+
# Configure API key authorization: ApiKeyAuth
|
261
|
+
config.api_key['API-KEY'] = 'YOUR API KEY'
|
262
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
263
|
+
#config.api_key_prefix['API-KEY'] = 'Bearer'
|
264
|
+
|
265
|
+
# Configure API key authorization: SignatureAuth
|
266
|
+
config.api_key['SIGNATURE'] = 'YOUR API KEY'
|
267
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
268
|
+
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
|
269
|
+
end
|
270
|
+
|
271
|
+
api_instance = RakutenTrading::PublicApi.new
|
272
|
+
symbol_id = 789 # Integer | シンボルID
|
273
|
+
|
274
|
+
|
275
|
+
begin
|
276
|
+
#歩み値取得
|
277
|
+
result = api_instance.get_trades(symbol_id)
|
278
|
+
p result
|
279
|
+
rescue RakutenTrading::ApiError => e
|
280
|
+
puts "Exception when calling PublicApi->get_trades: #{e}"
|
281
|
+
end
|
282
|
+
```
|
283
|
+
|
284
|
+
### Parameters
|
285
|
+
|
286
|
+
Name | Type | Description | Notes
|
287
|
+
------------- | ------------- | ------------- | -------------
|
288
|
+
**symbol_id** | **Integer**| シンボルID |
|
289
|
+
|
290
|
+
### Return type
|
291
|
+
|
292
|
+
[**InlineResponse2004**](InlineResponse2004.md)
|
293
|
+
|
294
|
+
### Authorization
|
295
|
+
|
296
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth), [SignatureAuth](../README.md#SignatureAuth)
|
297
|
+
|
298
|
+
### HTTP request headers
|
299
|
+
|
300
|
+
- **Content-Type**: Not defined
|
301
|
+
- **Accept**: application/json
|
302
|
+
|
303
|
+
|
304
|
+
|
data/docs/Trade.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# RakutenTrading::Trade
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**id** | **Integer** | 約定履歴ID | [optional]
|
7
|
+
**order_side** | **String** | | [optional]
|
8
|
+
**price** | **String** | | [optional]
|
9
|
+
**amount** | **String** | | [optional]
|
10
|
+
**asset_amount** | **String** | 総額。価格 * 数量 * 円換算価格(買いの場合は買い板ベストBid, 売りの場合は売り板ベストAsk)。円換算価格取得不可時はnull | [optional]
|
11
|
+
**traded_at** | **Integer** | | [optional]
|
12
|
+
|
data/git_push.sh
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
4
|
+
#
|
5
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
6
|
+
#
|
7
|
+
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
8
|
+
|
9
|
+
git_user_id=$1
|
10
|
+
git_repo_id=$2
|
11
|
+
release_note=$3
|
12
|
+
|
13
|
+
if [ "$git_user_id" = "" ]; then
|
14
|
+
git_user_id="GIT_USER_ID"
|
15
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
16
|
+
fi
|
17
|
+
|
18
|
+
if [ "$git_repo_id" = "" ]; then
|
19
|
+
git_repo_id="GIT_REPO_ID"
|
20
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
21
|
+
fi
|
22
|
+
|
23
|
+
if [ "$release_note" = "" ]; then
|
24
|
+
release_note="Minor update"
|
25
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
26
|
+
fi
|
27
|
+
|
28
|
+
# Initialize the local directory as a Git repository
|
29
|
+
git init
|
30
|
+
|
31
|
+
# Adds the files in the local repository and stages them for commit.
|
32
|
+
git add .
|
33
|
+
|
34
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
35
|
+
git commit -m "$release_note"
|
36
|
+
|
37
|
+
# Sets the new remote
|
38
|
+
git_remote=`git remote`
|
39
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
40
|
+
|
41
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
42
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
43
|
+
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
44
|
+
else
|
45
|
+
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
46
|
+
fi
|
47
|
+
|
48
|
+
fi
|
49
|
+
|
50
|
+
git pull origin master
|
51
|
+
|
52
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
53
|
+
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
54
|
+
git push origin master 2>&1 | grep -v 'To https'
|
55
|
+
|