Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rakuten_trading

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rakuten_trading

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

rakuten_trading

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:

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.ruby.RubyClientCodegen

Installation

Build a gem

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'

Install from Git

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

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

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

Documentation for API Endpoints

All URIs are relative to https://exchange.rakuten-wallet.co.jp/api/v1

ClassMethodHTTP requestDescription
RakutenTrading::PrivateApiget_assetGET /asset残高一覧取得
RakutenTrading::PrivateApiget_cfd_tradesGET /cfd/trade約定履歴取得
RakutenTrading::PrivateApiget_equitydataGET /cfd/equitydata証拠金関連項目取得
RakutenTrading::PrivateApiget_orderGET /cfd/order注文一覧取得
RakutenTrading::PrivateApiget_positionGET /cfd/position建玉一覧取得
RakutenTrading::PrivateApiorderPOST /cfd/order注文
RakutenTrading::PrivateApiorder_amendPUT /cfd/order注文訂正
RakutenTrading::PrivateApiorder_cancelDELETE /cfd/order注文取消
RakutenTrading::PublicApiget_candlestickGET /candlestickローソク取得
RakutenTrading::PublicApiget_orderbookGET /orderbook板取得
RakutenTrading::PublicApiget_symbolGET /cfd/symbol銘柄一覧取得
RakutenTrading::PublicApiget_tickerGET /tickerティッカー取得
RakutenTrading::PublicApiget_tradesGET /trades歩み値取得

Documentation for Models

Documentation for Authorization

ApiKeyAuth

  • Type: API key
  • API key parameter name: API-KEY
  • Location: HTTP header

SignatureAuth

  • Type: API key
  • API key parameter name: SIGNATURE
  • Location: HTTP header

FAQs

Package last updated on 02 Apr 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc