class Darwinex::InvestorAccount

Attributes

account_id[R]
investor_account_info_api[R]
trading_api[R]

Public Class Methods

new(account_id:, trading_api:, investor_account_info_api:) click to toggle source
# File lib/darwinex/investor_account.rb, line 7
def initialize(account_id:, trading_api:, investor_account_info_api:)
  @account_id = account_id
  @trading_api = trading_api
  @investor_account_info_api = investor_account_info_api
end

Public Instance Methods

conditional_orders(status, product_name: nil, page: nil, per_page: nil) click to toggle source
# File lib/darwinex/investor_account.rb, line 53
def conditional_orders(status, product_name: nil, page: nil, per_page: nil)
  investor_account_info_api.list_conditional_orders(
    account_id,
    status,
    product_name: product_name,
    page: page,
    per_page: per_page
  )
end
create_buy_order(buy_order) click to toggle source
# File lib/darwinex/investor_account.rb, line 33
def create_buy_order(buy_order)
  trading_api.create_buy_order(account_id, buy_order)
end
create_conditional_order(conditional_order_dto) click to toggle source
# File lib/darwinex/investor_account.rb, line 13
def create_conditional_order(conditional_order_dto)
  trading_api.create_conditional_order(account_id, conditional_order_dto)
end
create_sell_order(sell_order) click to toggle source
# File lib/darwinex/investor_account.rb, line 37
def create_sell_order(sell_order)
  trading_api.create_sell_order(account_id, sell_order)
end
create_stopout(product_name = nil) click to toggle source
# File lib/darwinex/investor_account.rb, line 41
def create_stopout(product_name = nil)
  if product_name.nil?
    trading_api.create_stopout(account_id)
  else
    trading_api.create_product_stopout(account_id, product_name)
  end
end
current_positions(product_name: nil) click to toggle source
# File lib/darwinex/investor_account.rb, line 63
def current_positions(product_name: nil)
  investor_account_info_api.get_current_positions(account_id, product_name: product_name)
end
delete_conditional_order(conditional_order_id) click to toggle source
# File lib/darwinex/investor_account.rb, line 21
def delete_conditional_order(conditional_order_id)
  trading_api.delete_conditional_order(account_id, conditional_order_id)
end
executed_orders(product_name: nil, page: nil, per_page: nil) click to toggle source
# File lib/darwinex/investor_account.rb, line 67
def executed_orders(product_name: nil, page: nil, per_page: nil)
  investor_account_info_api.get_executed_orders(
    account_id,
    product_name: product_name,
    page: page,
    per_page: per_page
  )
end
leverage() click to toggle source
# File lib/darwinex/investor_account.rb, line 25
def leverage
  trading_api.get_leverage(account_id)
end
order(order_id) click to toggle source
# File lib/darwinex/investor_account.rb, line 76
def order(order_id)
  investor_account_info_api.get_order(account_id, order_id)
end
performance_fees(page: nil, per_page: nil) click to toggle source
# File lib/darwinex/investor_account.rb, line 80
def performance_fees(page: nil, per_page: nil)
  investor_account_info_api.get_performance_fees(account_id, page: page, per_page: per_page)
end
product_performance_fees(product_name) click to toggle source
# File lib/darwinex/investor_account.rb, line 84
def product_performance_fees(product_name)
  investor_account_info_api.get_performance_fees_for_product(account_id, product_name)
end
summary() click to toggle source
# File lib/darwinex/investor_account.rb, line 49
def summary
  investor_account_info_api.get_investor_account(account_id)
end
trade(trade_id) click to toggle source
# File lib/darwinex/investor_account.rb, line 92
def trade(trade_id)
  investor_account_info_api.get_trade(account_id, trade_id)
end
trades(trade_status, product_name: nil, page: nil, per_page: nil) click to toggle source
# File lib/darwinex/investor_account.rb, line 88
def trades(trade_status, product_name: nil, page: nil, per_page: nil)
  investor_account_info_api.list_trades(account_id, trade_status, product_name: product_name, page: page, per_page: per_page)
end
update_conditional_order(conditional_order_id, conditional_order_dto) click to toggle source
# File lib/darwinex/investor_account.rb, line 17
def update_conditional_order(conditional_order_id, conditional_order_dto)
  trading_api.update_conditional_order(account_id, conditional_order_id, conditional_order_dto)
end
update_leverage(leverage) click to toggle source
# File lib/darwinex/investor_account.rb, line 29
def update_leverage(leverage)
  trading_api.update_leverage(account_id, leverage)
end