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
@@ -0,0 +1,151 @@
|
|
1
|
+
=begin
|
2
|
+
#API(証拠金取引所)
|
3
|
+
|
4
|
+
#本APIを利用することにより、取り扱っている銘柄一覧の取得、ローソク足データの取得、板の取得、歩値の取得、注文、残高照会といった操作を行う事ができます。 ## 留意事項 - APIキーはお客様のアカウント情報と紐付いております。もし第三者がお客様のAPIキーを知った場合、遠隔で売買注文の操作が可能となります。APIキーを第三者へ渡す事はセキュリティリスクを鑑みお控えください。 - 他社が提供するAPI機能を使用した自動売買取引ツールは、ご自身の判断と責任でご利用ください。 - リクエストパラメーターやレスポンスの日時についてはミリ秒のtimestamp(Unix Time)を用います。 - 日時の範囲検索は「以上・未満」で検索します。
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.54
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
require 'json'
|
14
|
+
|
15
|
+
# Unit tests for RakutenTrading::PrivateApi
|
16
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
17
|
+
# Please update as you see appropriate
|
18
|
+
describe 'PrivateApi' do
|
19
|
+
before do
|
20
|
+
# run before each test
|
21
|
+
@instance = RakutenTrading::PrivateApi.new
|
22
|
+
end
|
23
|
+
|
24
|
+
after do
|
25
|
+
# run after each test
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'test an instance of PrivateApi' do
|
29
|
+
it 'should create an instance of PrivateApi' do
|
30
|
+
expect(@instance).to be_instance_of(RakutenTrading::PrivateApi)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# unit tests for get_asset
|
35
|
+
# 残高一覧取得
|
36
|
+
# アカウントの資産情報(各通貨の保有量)を取得します。
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @return [Array<InlineResponse2005>]
|
39
|
+
describe 'get_asset test' do
|
40
|
+
it 'should work' do
|
41
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# unit tests for get_cfd_trades
|
46
|
+
# 約定履歴取得
|
47
|
+
# 指定された条件に基づくCFD取引の約定履歴(トレード)を取得します。これにより、ユーザーは過去の取引データを分析することができます。
|
48
|
+
# @param symbol_id シンボルID
|
49
|
+
# @param [Hash] opts the optional parameters
|
50
|
+
# @option opts [Array<Integer>] :id 約定IDの配列
|
51
|
+
# @option opts [Integer] :date_from 取得開始日時(作成日時)。UNIXタイムスタンプ(ミリ秒)で指定。直近48時間。
|
52
|
+
# @option opts [Integer] :date_to 取得終了日時(作成日時)。UNIXタイムスタンプ(ミリ秒)で指定。直近48時間。
|
53
|
+
# @option opts [String] :order_behavior 注文の挙動(OPEN, CLOSE)
|
54
|
+
# @option opts [String] :trade_behavior トレードの挙動(OPEN, CLOSE)
|
55
|
+
# @option opts [String] :order_side 売買方向(SELL, BUY)
|
56
|
+
# @option opts [Array<String>] :order_pattern 注文パターン(NORMAL, OCO, IFD, IFD_OCO, LOSS_CUT, CLOSE_ALL)
|
57
|
+
# @option opts [Array<String>] :order_type 執行条件(MARKET, LIMIT, STOP)
|
58
|
+
# @option opts [String] :trade_action 約定アクション(MAKER, TAKER)
|
59
|
+
# @option opts [Array<Integer>] :order_id 注文IDの配列
|
60
|
+
# @option opts [Array<Integer>] :position_id 建玉IDの配列
|
61
|
+
# @option opts [Integer] :size 取得件数。デフォルトは30、最大は500。
|
62
|
+
# @return [Array<CfdTrade>]
|
63
|
+
describe 'get_cfd_trades test' do
|
64
|
+
it 'should work' do
|
65
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# unit tests for get_equitydata
|
70
|
+
# 証拠金関連項目取得
|
71
|
+
# 口座の証拠金関連情報を取得します。これには建玉評価損益、必要証拠金、証拠金維持率などが含まれます。
|
72
|
+
# @param [Hash] opts the optional parameters
|
73
|
+
# @return [InlineResponse2006]
|
74
|
+
describe 'get_equitydata test' do
|
75
|
+
it 'should work' do
|
76
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# unit tests for get_order
|
81
|
+
# 注文一覧取得
|
82
|
+
# 指定された条件にマッチする注文一覧を取得します。このエンドポイントを通じて、特定のシンボル、注文タイプ、または期間に関する注文の詳細情報を照会することができます。
|
83
|
+
# @param symbol_id シンボルID
|
84
|
+
# @param [Hash] opts the optional parameters
|
85
|
+
# @option opts [Array<Integer>] :id 注文IDの配列
|
86
|
+
# @option opts [Integer] :date_from 取得開始日時(注文成立日時)。UNIXタイムスタンプ(ミリ秒)で指定。
|
87
|
+
# @option opts [Integer] :date_to 取得終了日時(注文成立日時)。UNIXタイムスタンプ(ミリ秒)で指定。
|
88
|
+
# @option opts [String] :order_behavior 注文の挙動(OPEN, CLOSE)
|
89
|
+
# @option opts [String] :order_side 売買方向(SELL, BUY)
|
90
|
+
# @option opts [Array<String>] :order_pattern 注文パターン(NORMAL, OCO, IFD, IFD_OCO)
|
91
|
+
# @option opts [Array<String>] :order_type 執行条件(MARKET, LIMIT, STOP)
|
92
|
+
# @option opts [Array<String>] :close_behavior 決済挙動(CROSS, FIFO)
|
93
|
+
# @option opts [Array<String>] :order_status 注文ステータス(WORKING_ORDER, PARTIAL_FILL)
|
94
|
+
# @option opts [BOOLEAN] :post_only メイカー注文のみ許可
|
95
|
+
# @option opts [Integer] :size 取得件数。デフォルトは30、最大は500。
|
96
|
+
# @return [Array<OrderDetail>]
|
97
|
+
describe 'get_order test' do
|
98
|
+
it 'should work' do
|
99
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# unit tests for get_position
|
104
|
+
# 建玉一覧取得
|
105
|
+
# @param [Hash] opts the optional parameters
|
106
|
+
# @option opts [Integer] :symbol_id シンボルID。特定の銘柄に対する建玉のみを取得したい場合に指定します。
|
107
|
+
# @option opts [Array<Integer>] :id 建玉ID。特定の建玉情報のみを取得したい場合に指定します。
|
108
|
+
# @option opts [Integer] :date_from 取得開始日時。指定日時以上の建玉を検索します。
|
109
|
+
# @option opts [Integer] :date_to 取得終了日時。指定日時未満の建玉を検索します。
|
110
|
+
# @return [Array<InlineResponse2007>]
|
111
|
+
describe 'get_position test' do
|
112
|
+
it 'should work' do
|
113
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# unit tests for order
|
118
|
+
# 注文
|
119
|
+
# @param body
|
120
|
+
# @param [Hash] opts the optional parameters
|
121
|
+
# @return [Array<OrderResponse>]
|
122
|
+
describe 'order test' do
|
123
|
+
it 'should work' do
|
124
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# unit tests for order_amend
|
129
|
+
# 注文訂正
|
130
|
+
# @param body
|
131
|
+
# @param [Hash] opts the optional parameters
|
132
|
+
# @return [Array<OrderResponse>]
|
133
|
+
describe 'order_amend test' do
|
134
|
+
it 'should work' do
|
135
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# unit tests for order_cancel
|
140
|
+
# 注文取消
|
141
|
+
# @param symbol_id シンボルID
|
142
|
+
# @param id 注文ID
|
143
|
+
# @param [Hash] opts the optional parameters
|
144
|
+
# @return [Array<OrderResponse>]
|
145
|
+
describe 'order_cancel test' do
|
146
|
+
it 'should work' do
|
147
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
=begin
|
2
|
+
#API(証拠金取引所)
|
3
|
+
|
4
|
+
#本APIを利用することにより、取り扱っている銘柄一覧の取得、ローソク足データの取得、板の取得、歩値の取得、注文、残高照会といった操作を行う事ができます。 ## 留意事項 - APIキーはお客様のアカウント情報と紐付いております。もし第三者がお客様のAPIキーを知った場合、遠隔で売買注文の操作が可能となります。APIキーを第三者へ渡す事はセキュリティリスクを鑑みお控えください。 - 他社が提供するAPI機能を使用した自動売買取引ツールは、ご自身の判断と責任でご利用ください。 - リクエストパラメーターやレスポンスの日時についてはミリ秒のtimestamp(Unix Time)を用います。 - 日時の範囲検索は「以上・未満」で検索します。
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.54
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
require 'json'
|
14
|
+
|
15
|
+
# Unit tests for RakutenTrading::PublicApi
|
16
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
17
|
+
# Please update as you see appropriate
|
18
|
+
describe 'PublicApi' do
|
19
|
+
before do
|
20
|
+
# run before each test
|
21
|
+
@instance = RakutenTrading::PublicApi.new
|
22
|
+
end
|
23
|
+
|
24
|
+
after do
|
25
|
+
# run after each test
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'test an instance of PublicApi' do
|
29
|
+
it 'should create an instance of PublicApi' do
|
30
|
+
expect(@instance).to be_instance_of(RakutenTrading::PublicApi)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# unit tests for get_candlestick
|
35
|
+
# ローソク取得
|
36
|
+
# 指定された銘柄のローソク足データを取得します。データは指定された範囲で検索され、最新のデータから最大500件まで取得することが可能です。
|
37
|
+
# @param symbol_id シンボルID
|
38
|
+
# @param candlestick_type ローソク足の種類。ISO8601フォーマットに準拠。
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @option opts [Integer] :date_from 取得開始日時。UNIXタイムスタンプ(ミリ秒)で指定。
|
41
|
+
# @option opts [Integer] :date_to 取得終了日時。UNIXタイムスタンプ(ミリ秒)で指定。
|
42
|
+
# @return [InlineResponse2001]
|
43
|
+
describe 'get_candlestick test' do
|
44
|
+
it 'should work' do
|
45
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# unit tests for get_orderbook
|
50
|
+
# 板取得
|
51
|
+
# @param symbol_id シンボルID
|
52
|
+
# @param [Hash] opts the optional parameters
|
53
|
+
# @return [InlineResponse2002]
|
54
|
+
describe 'get_orderbook test' do
|
55
|
+
it 'should work' do
|
56
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# unit tests for get_symbol
|
61
|
+
# 銘柄一覧取得
|
62
|
+
# 利用可能な全銘柄の一覧を取得します。
|
63
|
+
# @param [Hash] opts the optional parameters
|
64
|
+
# @option opts [String] :authority PERSONAL, CORPORATE。
|
65
|
+
# @return [Array<InlineResponse200>]
|
66
|
+
describe 'get_symbol test' do
|
67
|
+
it 'should work' do
|
68
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# unit tests for get_ticker
|
73
|
+
# ティッカー取得
|
74
|
+
# @param symbol_id シンボルID
|
75
|
+
# @param [Hash] opts the optional parameters
|
76
|
+
# @return [InlineResponse2003]
|
77
|
+
describe 'get_ticker test' do
|
78
|
+
it 'should work' do
|
79
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# unit tests for get_trades
|
84
|
+
# 歩み値取得
|
85
|
+
# @param symbol_id シンボルID
|
86
|
+
# @param [Hash] opts the optional parameters
|
87
|
+
# @return [InlineResponse2004]
|
88
|
+
describe 'get_trades test' do
|
89
|
+
it 'should work' do
|
90
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
@@ -0,0 +1,225 @@
|
|
1
|
+
=begin
|
2
|
+
#API(証拠金取引所)
|
3
|
+
|
4
|
+
#本APIを利用することにより、取り扱っている銘柄一覧の取得、ローソク足データの取得、板の取得、歩値の取得、注文、残高照会といった操作を行う事ができます。 ## 留意事項 - APIキーはお客様のアカウント情報と紐付いております。もし第三者がお客様のAPIキーを知った場合、遠隔で売買注文の操作が可能となります。APIキーを第三者へ渡す事はセキュリティリスクを鑑みお控えください。 - 他社が提供するAPI機能を使用した自動売買取引ツールは、ご自身の判断と責任でご利用ください。 - リクエストパラメーターやレスポンスの日時についてはミリ秒のtimestamp(Unix Time)を用います。 - 日時の範囲検索は「以上・未満」で検索します。
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.54
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
|
14
|
+
describe RakutenTrading::ApiClient do
|
15
|
+
context 'initialization' do
|
16
|
+
context 'URL stuff' do
|
17
|
+
context 'host' do
|
18
|
+
it 'removes http from host' do
|
19
|
+
RakutenTrading.configure { |c| c.host = 'http://example.com' }
|
20
|
+
expect(RakutenTrading::Configuration.default.host).to eq('example.com')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'removes https from host' do
|
24
|
+
RakutenTrading.configure { |c| c.host = 'https://wookiee.com' }
|
25
|
+
expect(RakutenTrading::ApiClient.default.config.host).to eq('wookiee.com')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'removes trailing path from host' do
|
29
|
+
RakutenTrading.configure { |c| c.host = 'hobo.com/v4' }
|
30
|
+
expect(RakutenTrading::Configuration.default.host).to eq('hobo.com')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'base_path' do
|
35
|
+
it "prepends a slash to base_path" do
|
36
|
+
RakutenTrading.configure { |c| c.base_path = 'v4/dog' }
|
37
|
+
expect(RakutenTrading::Configuration.default.base_path).to eq('/v4/dog')
|
38
|
+
end
|
39
|
+
|
40
|
+
it "doesn't prepend a slash if one is already there" do
|
41
|
+
RakutenTrading.configure { |c| c.base_path = '/v4/dog' }
|
42
|
+
expect(RakutenTrading::Configuration.default.base_path).to eq('/v4/dog')
|
43
|
+
end
|
44
|
+
|
45
|
+
it "ends up as a blank string if nil" do
|
46
|
+
RakutenTrading.configure { |c| c.base_path = nil }
|
47
|
+
expect(RakutenTrading::Configuration.default.base_path).to eq('')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'params_encoding in #build_request' do
|
54
|
+
let(:config) { RakutenTrading::Configuration.new }
|
55
|
+
let(:api_client) { RakutenTrading::ApiClient.new(config) }
|
56
|
+
|
57
|
+
it 'defaults to nil' do
|
58
|
+
expect(RakutenTrading::Configuration.default.params_encoding).to eq(nil)
|
59
|
+
expect(config.params_encoding).to eq(nil)
|
60
|
+
|
61
|
+
request = api_client.build_request(:get, '/test')
|
62
|
+
expect(request.options[:params_encoding]).to eq(nil)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'can be customized' do
|
66
|
+
config.params_encoding = :multi
|
67
|
+
request = api_client.build_request(:get, '/test')
|
68
|
+
expect(request.options[:params_encoding]).to eq(:multi)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe 'timeout in #build_request' do
|
73
|
+
let(:config) { RakutenTrading::Configuration.new }
|
74
|
+
let(:api_client) { RakutenTrading::ApiClient.new(config) }
|
75
|
+
|
76
|
+
it 'defaults to 0' do
|
77
|
+
expect(RakutenTrading::Configuration.default.timeout).to eq(0)
|
78
|
+
expect(config.timeout).to eq(0)
|
79
|
+
|
80
|
+
request = api_client.build_request(:get, '/test')
|
81
|
+
expect(request.options[:timeout]).to eq(0)
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'can be customized' do
|
85
|
+
config.timeout = 100
|
86
|
+
request = api_client.build_request(:get, '/test')
|
87
|
+
expect(request.options[:timeout]).to eq(100)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe '#deserialize' do
|
92
|
+
it "handles Array<Integer>" do
|
93
|
+
api_client = RakutenTrading::ApiClient.new
|
94
|
+
headers = { 'Content-Type' => 'application/json' }
|
95
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
96
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
97
|
+
expect(data).to be_instance_of(Array)
|
98
|
+
expect(data).to eq([12, 34])
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'handles Array<Array<Integer>>' do
|
102
|
+
api_client = RakutenTrading::ApiClient.new
|
103
|
+
headers = { 'Content-Type' => 'application/json' }
|
104
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
105
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
106
|
+
expect(data).to be_instance_of(Array)
|
107
|
+
expect(data).to eq([[12, 34], [56]])
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'handles Hash<String, String>' do
|
111
|
+
api_client = RakutenTrading::ApiClient.new
|
112
|
+
headers = { 'Content-Type' => 'application/json' }
|
113
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
114
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
115
|
+
expect(data).to be_instance_of(Hash)
|
116
|
+
expect(data).to eq(:message => 'Hello')
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe "#object_to_hash" do
|
121
|
+
it 'ignores nils and includes empty arrays' do
|
122
|
+
# uncomment below to test object_to_hash for model
|
123
|
+
# api_client = RakutenTrading::ApiClient.new
|
124
|
+
# _model = RakutenTrading::ModelName.new
|
125
|
+
# update the model attribute below
|
126
|
+
# _model.id = 1
|
127
|
+
# update the expected value (hash) below
|
128
|
+
# expected = {id: 1, name: '', tags: []}
|
129
|
+
# expect(api_client.object_to_hash(_model)).to eq(expected)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
describe '#build_collection_param' do
|
134
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
135
|
+
let(:api_client) { RakutenTrading::ApiClient.new }
|
136
|
+
|
137
|
+
it 'works for csv' do
|
138
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'works for ssv' do
|
142
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'works for tsv' do
|
146
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'works for pipes' do
|
150
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'works for multi' do
|
154
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'fails for invalid collection format' do
|
158
|
+
expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
describe '#json_mime?' do
|
163
|
+
let(:api_client) { RakutenTrading::ApiClient.new }
|
164
|
+
|
165
|
+
it 'works' do
|
166
|
+
expect(api_client.json_mime?(nil)).to eq false
|
167
|
+
expect(api_client.json_mime?('')).to eq false
|
168
|
+
|
169
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
170
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
171
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
172
|
+
|
173
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
174
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
175
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
describe '#select_header_accept' do
|
180
|
+
let(:api_client) { RakutenTrading::ApiClient.new }
|
181
|
+
|
182
|
+
it 'works' do
|
183
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
184
|
+
expect(api_client.select_header_accept([])).to be_nil
|
185
|
+
|
186
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
187
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
188
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
189
|
+
|
190
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
191
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
describe '#select_header_content_type' do
|
196
|
+
let(:api_client) { RakutenTrading::ApiClient.new }
|
197
|
+
|
198
|
+
it 'works' do
|
199
|
+
expect(api_client.select_header_content_type(nil)).to eq('application/json')
|
200
|
+
expect(api_client.select_header_content_type([])).to eq('application/json')
|
201
|
+
|
202
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
203
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
204
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
205
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
206
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
describe '#sanitize_filename' do
|
211
|
+
let(:api_client) { RakutenTrading::ApiClient.new }
|
212
|
+
|
213
|
+
it 'works' do
|
214
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
215
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
216
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
217
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
218
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
219
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
220
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
221
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
222
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class ArrayMapObject < Petstore::Category
|
4
|
+
attr_accessor :int_arr, :pet_arr, :int_map, :pet_map, :int_arr_map, :pet_arr_map, :boolean_true_arr, :boolean_false_arr
|
5
|
+
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
:int_arr => :int_arr,
|
9
|
+
:pet_arr => :pet_arr,
|
10
|
+
:int_map => :int_map,
|
11
|
+
:pet_map => :pet_map,
|
12
|
+
:int_arr_map => :int_arr_map,
|
13
|
+
:pet_arr_map => :pet_arr_map,
|
14
|
+
:boolean_true_arr => :boolean_true_arr,
|
15
|
+
:boolean_false_arr => :boolean_false_arr,
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.swagger_types
|
20
|
+
{
|
21
|
+
:int_arr => :'Array<Integer>',
|
22
|
+
:pet_arr => :'Array<Pet>',
|
23
|
+
:int_map => :'Hash<String, Integer>',
|
24
|
+
:pet_map => :'Hash<String, Pet>',
|
25
|
+
:int_arr_map => :'Hash<String, Array<Integer>>',
|
26
|
+
:pet_arr_map => :'Hash<String, Array<Pet>>',
|
27
|
+
:boolean_true_arr => :'Array<BOOLEAN>',
|
28
|
+
:boolean_false_arr => :'Array<BOOLEAN>',
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'BaseObject' do
|
34
|
+
describe 'boolean values' do
|
35
|
+
let(:obj) { Petstore::Cat.new({declawed: false}) }
|
36
|
+
|
37
|
+
it 'should have values set' do
|
38
|
+
expect(obj.declawed).not_to be_nil
|
39
|
+
expect(obj.declawed).to eq(false)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'array and map properties' do
|
44
|
+
let(:obj) { ArrayMapObject.new }
|
45
|
+
|
46
|
+
let(:data) do
|
47
|
+
{int_arr: [123, 456],
|
48
|
+
pet_arr: [{name: 'Kitty'}],
|
49
|
+
int_map: {'int' => 123},
|
50
|
+
pet_map: {'pet' => {name: 'Kitty'}},
|
51
|
+
int_arr_map: {'int_arr' => [123, 456]},
|
52
|
+
pet_arr_map: {'pet_arr' => [{name: 'Kitty'}]},
|
53
|
+
boolean_true_arr: [true, "true", "TruE", 1, "y", "yes", "1", "t", "T"],
|
54
|
+
boolean_false_arr: [false, "", 0, "0", "f", nil, "null"],
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'works for #build_from_hash' do
|
59
|
+
obj.build_from_hash(data)
|
60
|
+
|
61
|
+
expect(obj.int_arr).to match_array([123, 456])
|
62
|
+
|
63
|
+
expect(obj.pet_arr).to be_instance_of(Array)
|
64
|
+
expect(obj.pet_arr).to be_instance_of(1)
|
65
|
+
|
66
|
+
pet = obj.pet_arr.first
|
67
|
+
expect(pet).to be_instance_of(Petstore::Pet)
|
68
|
+
expect(pet.name).to eq('Kitty')
|
69
|
+
|
70
|
+
expect(obj.int_map).to be_instance_of(Hash)
|
71
|
+
expect(obj.int_map).to eq({'int' => 123})
|
72
|
+
|
73
|
+
expect(obj.pet_map).to be_instance_of(Hash)
|
74
|
+
pet = obj.pet_map['pet']
|
75
|
+
expect(pet).to be_instance_of(Petstore::Pet)
|
76
|
+
expect(pet.name).to eq('Kitty')
|
77
|
+
|
78
|
+
expect(obj.int_arr_map).to be_instance_of(Hash)
|
79
|
+
arr = obj.int_arr_map['int_arr']
|
80
|
+
expect(arr).to match_array([123, 456])
|
81
|
+
|
82
|
+
expect(obj.pet_arr_map).to be_instance_of(Hash)
|
83
|
+
arr = obj.pet_arr_map['pet_arr']
|
84
|
+
expect(arr).to be_instance_of(Array)
|
85
|
+
expect(arr.size).to eq(1)
|
86
|
+
pet = arr.first
|
87
|
+
expect(pet).to be_instance_of(Petstore::Pet)
|
88
|
+
expect(pet.name).to eq('Kitty')
|
89
|
+
|
90
|
+
expect(obj.boolean_true_arr).to be_instance_of(Array)
|
91
|
+
obj.boolean_true_arr.each do |b|
|
92
|
+
expect(b).to eq(true)
|
93
|
+
end
|
94
|
+
|
95
|
+
expect(obj.boolean_false_arr).to be_instance_of(Array)
|
96
|
+
obj.boolean_false_arr.each do |b|
|
97
|
+
expect(b).to eq(false)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'works for #to_hash' do
|
102
|
+
obj.build_from_hash(data)
|
103
|
+
expect_data = data.dup
|
104
|
+
expect_data[:boolean_true_arr].map! {true}
|
105
|
+
expect_data[:boolean_false_arr].map! {false}
|
106
|
+
expect(obj.to_hash).to eq(expect_data)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
=begin
|
2
|
+
#API(証拠金取引所)
|
3
|
+
|
4
|
+
#本APIを利用することにより、取り扱っている銘柄一覧の取得、ローソク足データの取得、板の取得、歩値の取得、注文、残高照会といった操作を行う事ができます。 ## 留意事項 - APIキーはお客様のアカウント情報と紐付いております。もし第三者がお客様のAPIキーを知った場合、遠隔で売買注文の操作が可能となります。APIキーを第三者へ渡す事はセキュリティリスクを鑑みお控えください。 - 他社が提供するAPI機能を使用した自動売買取引ツールは、ご自身の判断と責任でご利用ください。 - リクエストパラメーターやレスポンスの日時についてはミリ秒のtimestamp(Unix Time)を用います。 - 日時の範囲検索は「以上・未満」で検索します。
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.54
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
|
14
|
+
describe RakutenTrading::Configuration do
|
15
|
+
let(:config) { RakutenTrading::Configuration.default }
|
16
|
+
|
17
|
+
before(:each) do
|
18
|
+
# uncomment below to setup host and base_path
|
19
|
+
# require 'URI'
|
20
|
+
# uri = URI.parse("https://exchange.rakuten-wallet.co.jp/api/v1")
|
21
|
+
# RakutenTrading.configure do |c|
|
22
|
+
# c.host = uri.host
|
23
|
+
# c.base_path = uri.path
|
24
|
+
# end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#base_url' do
|
28
|
+
it 'should have the default value' do
|
29
|
+
# uncomment below to test default value of the base path
|
30
|
+
# expect(config.base_url).to eq("https://exchange.rakuten-wallet.co.jp/api/v1")
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should remove trailing slashes' do
|
34
|
+
[nil, '', '/', '//'].each do |base_path|
|
35
|
+
config.base_path = base_path
|
36
|
+
# uncomment below to test trailing slashes
|
37
|
+
# expect(config.base_url).to eq("https://exchange.rakuten-wallet.co.jp/api/v1")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
=begin
|
2
|
+
#API(証拠金取引所)
|
3
|
+
|
4
|
+
#本APIを利用することにより、取り扱っている銘柄一覧の取得、ローソク足データの取得、板の取得、歩値の取得、注文、残高照会といった操作を行う事ができます。 ## 留意事項 - APIキーはお客様のアカウント情報と紐付いております。もし第三者がお客様のAPIキーを知った場合、遠隔で売買注文の操作が可能となります。APIキーを第三者へ渡す事はセキュリティリスクを鑑みお控えください。 - 他社が提供するAPI機能を使用した自動売買取引ツールは、ご自身の判断と責任でご利用ください。 - リクエストパラメーターやレスポンスの日時についてはミリ秒のtimestamp(Unix Time)を用います。 - 日時の範囲検索は「以上・未満」で検索します。
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.54
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
require 'json'
|
14
|
+
require 'date'
|
15
|
+
|
16
|
+
# Unit tests for RakutenTrading::CfdOrderBody1
|
17
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'CfdOrderBody1' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@instance = RakutenTrading::CfdOrderBody1.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of CfdOrderBody1' do
|
30
|
+
it 'should create an instance of CfdOrderBody1' do
|
31
|
+
expect(@instance).to be_instance_of(RakutenTrading::CfdOrderBody1)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
describe 'test attribute "symbol_id"' do
|
35
|
+
it 'should work' do
|
36
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'test attribute "order_pattern"' do
|
41
|
+
it 'should work' do
|
42
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'test attribute "order_data"' do
|
47
|
+
it 'should work' do
|
48
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|