Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
RakutenTrading - the Ruby gem for the API(証拠金取引所)
本APIを利用することにより、取り扱っている銘柄一覧の取得、ローソク足データの取得、板の取得、歩値の取得、注文、残高照会といった操作を行う事ができます。 ## 留意事項 - APIキーはお客様のアカウント情報と紐付いております。もし第三者がお客様のAPIキーを知った場合、遠隔で売買注文の操作が可能となります。APIキーを第三者へ渡す事はセキュリティリスクを鑑みお控えください。 - 他社が提供するAPI機能を使用した自動売買取引ツールは、ご自身の判断と責任でご利用ください。 - リクエストパラメーターやレスポンスの日時についてはミリ秒のtimestamp(Unix Time)を用います。 - 日時の範囲検索は「以上・未満」で検索します。
This SDK is automatically generated by the Swagger Codegen project:
To build the Ruby code into a gem:
gem build rakuten_trading.gemspec
Then either install the gem locally:
gem install ./rakuten_trading-1.0.0.gem
(for development, run gem install --dev ./rakuten_trading-1.0.0.gem
to install the development dependencies)
or publish the gem to a gem hosting service, e.g. RubyGems.
Finally add this to the Gemfile:
gem 'rakuten_trading', '~> 1.0.0'
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:
gem 'rakuten_trading', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
Include the Ruby code directly using -I
as follows:
ruby -Ilib script.rb
Please follow the installation procedure and then run the following code:
# Load the gem
require 'rakuten_trading'
# Setup authorization
RakutenTrading.configure do |config|
# Configure API key authorization: ApiKeyAuth
config.api_key['API-KEY'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['API-KEY'] = 'Bearer'
# Configure API key authorization: SignatureAuth
config.api_key['SIGNATURE'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
end
api_instance = RakutenTrading::PrivateApi.new
begin
#残高一覧取得
result = api_instance.get_asset
p result
rescue RakutenTrading::ApiError => e
puts "Exception when calling PrivateApi->get_asset: #{e}"
end
# Setup authorization
RakutenTrading.configure do |config|
# Configure API key authorization: ApiKeyAuth
config.api_key['API-KEY'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['API-KEY'] = 'Bearer'
# Configure API key authorization: SignatureAuth
config.api_key['SIGNATURE'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
end
api_instance = RakutenTrading::PrivateApi.new
symbol_id = 789 # Integer | シンボルID
opts = {
id: [56], # Array<Integer> | 約定IDの配列
date_from: 789, # Integer | 取得開始日時(作成日時)。UNIXタイムスタンプ(ミリ秒)で指定。直近48時間。
date_to: 789, # Integer | 取得終了日時(作成日時)。UNIXタイムスタンプ(ミリ秒)で指定。直近48時間。
order_behavior: 'order_behavior_example', # String | 注文の挙動(OPEN, CLOSE)
trade_behavior: 'trade_behavior_example', # String | トレードの挙動(OPEN, CLOSE)
order_side: 'order_side_example', # String | 売買方向(SELL, BUY)
order_pattern: ['order_pattern_example'], # Array<String> | 注文パターン(NORMAL, OCO, IFD, IFD_OCO, LOSS_CUT, CLOSE_ALL)
order_type: ['order_type_example'], # Array<String> | 執行条件(MARKET, LIMIT, STOP)
trade_action: 'trade_action_example', # String | 約定アクション(MAKER, TAKER)
order_id: [56], # Array<Integer> | 注文IDの配列
position_id: [56], # Array<Integer> | 建玉IDの配列
size: 30 # Integer | 取得件数。デフォルトは30、最大は500。
}
begin
#約定履歴取得
result = api_instance.get_cfd_trades(symbol_id, opts)
p result
rescue RakutenTrading::ApiError => e
puts "Exception when calling PrivateApi->get_cfd_trades: #{e}"
end
# Setup authorization
RakutenTrading.configure do |config|
# Configure API key authorization: ApiKeyAuth
config.api_key['API-KEY'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['API-KEY'] = 'Bearer'
# Configure API key authorization: SignatureAuth
config.api_key['SIGNATURE'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
end
api_instance = RakutenTrading::PrivateApi.new
begin
#証拠金関連項目取得
result = api_instance.get_equitydata
p result
rescue RakutenTrading::ApiError => e
puts "Exception when calling PrivateApi->get_equitydata: #{e}"
end
# Setup authorization
RakutenTrading.configure do |config|
# Configure API key authorization: ApiKeyAuth
config.api_key['API-KEY'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['API-KEY'] = 'Bearer'
# Configure API key authorization: SignatureAuth
config.api_key['SIGNATURE'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
end
api_instance = RakutenTrading::PrivateApi.new
symbol_id = 789 # Integer | シンボルID
opts = {
id: [56], # Array<Integer> | 注文IDの配列
date_from: 789, # Integer | 取得開始日時(注文成立日時)。UNIXタイムスタンプ(ミリ秒)で指定。
date_to: 789, # Integer | 取得終了日時(注文成立日時)。UNIXタイムスタンプ(ミリ秒)で指定。
order_behavior: 'order_behavior_example', # String | 注文の挙動(OPEN, CLOSE)
order_side: 'order_side_example', # String | 売買方向(SELL, BUY)
order_pattern: ['order_pattern_example'], # Array<String> | 注文パターン(NORMAL, OCO, IFD, IFD_OCO)
order_type: ['order_type_example'], # Array<String> | 執行条件(MARKET, LIMIT, STOP)
close_behavior: ['close_behavior_example'], # Array<String> | 決済挙動(CROSS, FIFO)
order_status: ['order_status_example'], # Array<String> | 注文ステータス(WORKING_ORDER, PARTIAL_FILL)
post_only: true, # BOOLEAN | メイカー注文のみ許可
size: 30 # Integer | 取得件数。デフォルトは30、最大は500。
}
begin
#注文一覧取得
result = api_instance.get_order(symbol_id, opts)
p result
rescue RakutenTrading::ApiError => e
puts "Exception when calling PrivateApi->get_order: #{e}"
end
# Setup authorization
RakutenTrading.configure do |config|
# Configure API key authorization: ApiKeyAuth
config.api_key['API-KEY'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['API-KEY'] = 'Bearer'
# Configure API key authorization: SignatureAuth
config.api_key['SIGNATURE'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
end
api_instance = RakutenTrading::PrivateApi.new
opts = {
symbol_id: 789, # Integer | シンボルID。特定の銘柄に対する建玉のみを取得したい場合に指定します。
id: [56], # Array<Integer> | 建玉ID。特定の建玉情報のみを取得したい場合に指定します。
date_from: 789, # Integer | 取得開始日時。指定日時以上の建玉を検索します。
date_to: 789 # Integer | 取得終了日時。指定日時未満の建玉を検索します。
}
begin
#建玉一覧取得
result = api_instance.get_position(opts)
p result
rescue RakutenTrading::ApiError => e
puts "Exception when calling PrivateApi->get_position: #{e}"
end
# Setup authorization
RakutenTrading.configure do |config|
# Configure API key authorization: ApiKeyAuth
config.api_key['API-KEY'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['API-KEY'] = 'Bearer'
# Configure API key authorization: SignatureAuth
config.api_key['SIGNATURE'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
end
api_instance = RakutenTrading::PrivateApi.new
body = RakutenTrading::CfdOrderBody1.new # CfdOrderBody1 |
begin
#注文
result = api_instance.order(body)
p result
rescue RakutenTrading::ApiError => e
puts "Exception when calling PrivateApi->order: #{e}"
end
# Setup authorization
RakutenTrading.configure do |config|
# Configure API key authorization: ApiKeyAuth
config.api_key['API-KEY'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['API-KEY'] = 'Bearer'
# Configure API key authorization: SignatureAuth
config.api_key['SIGNATURE'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
end
api_instance = RakutenTrading::PrivateApi.new
body = RakutenTrading::CfdOrderBody.new # CfdOrderBody |
begin
#注文訂正
result = api_instance.order_amend(body)
p result
rescue RakutenTrading::ApiError => e
puts "Exception when calling PrivateApi->order_amend: #{e}"
end
# Setup authorization
RakutenTrading.configure do |config|
# Configure API key authorization: ApiKeyAuth
config.api_key['API-KEY'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['API-KEY'] = 'Bearer'
# Configure API key authorization: SignatureAuth
config.api_key['SIGNATURE'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
end
api_instance = RakutenTrading::PrivateApi.new
symbol_id = 789 # Integer | シンボルID
id = 789 # Integer | 注文ID
begin
#注文取消
result = api_instance.order_cancel(symbol_id, id)
p result
rescue RakutenTrading::ApiError => e
puts "Exception when calling PrivateApi->order_cancel: #{e}"
end
# Setup authorization
RakutenTrading.configure do |config|
# Configure API key authorization: ApiKeyAuth
config.api_key['API-KEY'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['API-KEY'] = 'Bearer'
# Configure API key authorization: SignatureAuth
config.api_key['SIGNATURE'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
end
api_instance = RakutenTrading::PublicApi.new
symbol_id = 789 # Integer | シンボルID
candlestick_type = 'candlestick_type_example' # String | ローソク足の種類。ISO8601フォーマットに準拠。
opts = {
date_from: 789, # Integer | 取得開始日時。UNIXタイムスタンプ(ミリ秒)で指定。
date_to: 789 # Integer | 取得終了日時。UNIXタイムスタンプ(ミリ秒)で指定。
}
begin
#ローソク取得
result = api_instance.get_candlestick(symbol_id, candlestick_type, opts)
p result
rescue RakutenTrading::ApiError => e
puts "Exception when calling PublicApi->get_candlestick: #{e}"
end
# Setup authorization
RakutenTrading.configure do |config|
# Configure API key authorization: ApiKeyAuth
config.api_key['API-KEY'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['API-KEY'] = 'Bearer'
# Configure API key authorization: SignatureAuth
config.api_key['SIGNATURE'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
end
api_instance = RakutenTrading::PublicApi.new
symbol_id = 789 # Integer | シンボルID
begin
#板取得
result = api_instance.get_orderbook(symbol_id)
p result
rescue RakutenTrading::ApiError => e
puts "Exception when calling PublicApi->get_orderbook: #{e}"
end
# Setup authorization
RakutenTrading.configure do |config|
# Configure API key authorization: ApiKeyAuth
config.api_key['API-KEY'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['API-KEY'] = 'Bearer'
# Configure API key authorization: SignatureAuth
config.api_key['SIGNATURE'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
end
api_instance = RakutenTrading::PublicApi.new
opts = {
authority: 'authority_example' # String | PERSONAL, CORPORATE。
}
begin
#銘柄一覧取得
result = api_instance.get_symbol(opts)
p result
rescue RakutenTrading::ApiError => e
puts "Exception when calling PublicApi->get_symbol: #{e}"
end
# Setup authorization
RakutenTrading.configure do |config|
# Configure API key authorization: ApiKeyAuth
config.api_key['API-KEY'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['API-KEY'] = 'Bearer'
# Configure API key authorization: SignatureAuth
config.api_key['SIGNATURE'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
end
api_instance = RakutenTrading::PublicApi.new
symbol_id = 789 # Integer | シンボルID
begin
#ティッカー取得
result = api_instance.get_ticker(symbol_id)
p result
rescue RakutenTrading::ApiError => e
puts "Exception when calling PublicApi->get_ticker: #{e}"
end
# Setup authorization
RakutenTrading.configure do |config|
# Configure API key authorization: ApiKeyAuth
config.api_key['API-KEY'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['API-KEY'] = 'Bearer'
# Configure API key authorization: SignatureAuth
config.api_key['SIGNATURE'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['SIGNATURE'] = 'Bearer'
end
api_instance = RakutenTrading::PublicApi.new
symbol_id = 789 # Integer | シンボルID
begin
#歩み値取得
result = api_instance.get_trades(symbol_id)
p result
rescue RakutenTrading::ApiError => e
puts "Exception when calling PublicApi->get_trades: #{e}"
end
All URIs are relative to https://exchange.rakuten-wallet.co.jp/api/v1
Class | Method | HTTP request | Description |
---|---|---|---|
RakutenTrading::PrivateApi | get_asset | GET /asset | 残高一覧取得 |
RakutenTrading::PrivateApi | get_cfd_trades | GET /cfd/trade | 約定履歴取得 |
RakutenTrading::PrivateApi | get_equitydata | GET /cfd/equitydata | 証拠金関連項目取得 |
RakutenTrading::PrivateApi | get_order | GET /cfd/order | 注文一覧取得 |
RakutenTrading::PrivateApi | get_position | GET /cfd/position | 建玉一覧取得 |
RakutenTrading::PrivateApi | order | POST /cfd/order | 注文 |
RakutenTrading::PrivateApi | order_amend | PUT /cfd/order | 注文訂正 |
RakutenTrading::PrivateApi | order_cancel | DELETE /cfd/order | 注文取消 |
RakutenTrading::PublicApi | get_candlestick | GET /candlestick | ローソク取得 |
RakutenTrading::PublicApi | get_orderbook | GET /orderbook | 板取得 |
RakutenTrading::PublicApi | get_symbol | GET /cfd/symbol | 銘柄一覧取得 |
RakutenTrading::PublicApi | get_ticker | GET /ticker | ティッカー取得 |
RakutenTrading::PublicApi | get_trades | GET /trades | 歩み値取得 |
FAQs
Unknown package
We found that rakuten_trading demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.