Class: Darwinex::InvestorAccount

Inherits:
Object
  • Object
show all
Defined in:
lib/darwinex/investor_account.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_id:, trading_api:, investor_account_info_api:) ⇒ InvestorAccount

Returns a new instance of InvestorAccount.



7
8
9
10
11
# File 'lib/darwinex/investor_account.rb', line 7

def initialize(account_id:, trading_api:, investor_account_info_api:)
  @account_id = 
  @trading_api = trading_api
  @investor_account_info_api = 
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



5
6
7
# File 'lib/darwinex/investor_account.rb', line 5

def 
  @account_id
end

Instance Method Details

#conditional_orders(status, product_name: nil, page: nil, per_page: nil) ⇒ Object



53
54
55
56
57
58
59
60
61
# File 'lib/darwinex/investor_account.rb', line 53

def conditional_orders(status, product_name: nil, page: nil, per_page: nil)
  .list_conditional_orders(
    ,
    status,
    product_name: product_name,
    page: page,
    per_page: per_page
  )
end

#create_buy_order(buy_order) ⇒ Object



33
34
35
# File 'lib/darwinex/investor_account.rb', line 33

def create_buy_order(buy_order)
  trading_api.create_buy_order(, buy_order)
end

#create_conditional_order(conditional_order_dto) ⇒ Object



13
14
15
# File 'lib/darwinex/investor_account.rb', line 13

def create_conditional_order(conditional_order_dto)
  trading_api.create_conditional_order(, conditional_order_dto)
end

#create_sell_order(sell_order) ⇒ Object



37
38
39
# File 'lib/darwinex/investor_account.rb', line 37

def create_sell_order(sell_order)
  trading_api.create_sell_order(, sell_order)
end

#create_stopout(product_name = nil) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/darwinex/investor_account.rb', line 41

def create_stopout(product_name = nil)
  if product_name.nil?
    trading_api.create_stopout()
  else
    trading_api.create_product_stopout(, product_name)
  end
end

#current_positions(product_name: nil) ⇒ Object



63
64
65
# File 'lib/darwinex/investor_account.rb', line 63

def current_positions(product_name: nil)
  .get_current_positions(, product_name: product_name)
end

#delete_conditional_order(conditional_order_id) ⇒ Object



21
22
23
# File 'lib/darwinex/investor_account.rb', line 21

def delete_conditional_order(conditional_order_id)
  trading_api.delete_conditional_order(, conditional_order_id)
end

#executed_orders(product_name: nil, page: nil, per_page: nil) ⇒ Object



67
68
69
70
71
72
73
74
# File 'lib/darwinex/investor_account.rb', line 67

def executed_orders(product_name: nil, page: nil, per_page: nil)
  .get_executed_orders(
    ,
    product_name: product_name,
    page: page,
    per_page: per_page
  )
end

#leverageObject



25
26
27
# File 'lib/darwinex/investor_account.rb', line 25

def leverage
  trading_api.get_leverage()
end

#order(order_id) ⇒ Object



76
77
78
# File 'lib/darwinex/investor_account.rb', line 76

def order(order_id)
  .get_order(, order_id)
end

#performance_fees(page: nil, per_page: nil) ⇒ Object



80
81
82
# File 'lib/darwinex/investor_account.rb', line 80

def performance_fees(page: nil, per_page: nil)
  .get_performance_fees(, page: page, per_page: per_page)
end

#product_performance_fees(product_name) ⇒ Object



84
85
86
# File 'lib/darwinex/investor_account.rb', line 84

def product_performance_fees(product_name)
  .get_performance_fees_for_product(, product_name)
end

#summaryObject



49
50
51
# File 'lib/darwinex/investor_account.rb', line 49

def summary
  .()
end

#trade(trade_id) ⇒ Object



92
93
94
# File 'lib/darwinex/investor_account.rb', line 92

def trade(trade_id)
  .get_trade(, trade_id)
end

#trades(trade_status, product_name: nil, page: nil, per_page: nil) ⇒ Object



88
89
90
# File 'lib/darwinex/investor_account.rb', line 88

def trades(trade_status, product_name: nil, page: nil, per_page: nil)
  .list_trades(, trade_status, product_name: product_name, page: page, per_page: per_page)
end

#update_conditional_order(conditional_order_id, conditional_order_dto) ⇒ Object



17
18
19
# File 'lib/darwinex/investor_account.rb', line 17

def update_conditional_order(conditional_order_id, conditional_order_dto)
  trading_api.update_conditional_order(, conditional_order_id, conditional_order_dto)
end

#update_leverage(leverage) ⇒ Object



29
30
31
# File 'lib/darwinex/investor_account.rb', line 29

def update_leverage(leverage)
  trading_api.update_leverage(, leverage)
end