Class: Darwinex::InvestorAccount
- Inherits:
-
Object
- Object
- Darwinex::InvestorAccount
- Defined in:
- lib/darwinex/investor_account.rb
Instance Attribute Summary collapse
-
#account_id ⇒ Object
readonly
Returns the value of attribute account_id.
Instance Method Summary collapse
- #conditional_orders(status, product_name: nil, page: nil, per_page: nil) ⇒ Object
- #create_buy_order(buy_order) ⇒ Object
- #create_conditional_order(conditional_order_dto) ⇒ Object
- #create_sell_order(sell_order) ⇒ Object
- #create_stopout(product_name = nil) ⇒ Object
- #current_positions(product_name: nil) ⇒ Object
- #delete_conditional_order(conditional_order_id) ⇒ Object
- #executed_orders(product_name: nil, page: nil, per_page: nil) ⇒ Object
-
#initialize(account_id:, trading_api:, investor_account_info_api:) ⇒ InvestorAccount
constructor
A new instance of InvestorAccount.
- #leverage ⇒ Object
- #order(order_id) ⇒ Object
- #performance_fees(page: nil, per_page: nil) ⇒ Object
- #product_performance_fees(product_name) ⇒ Object
- #summary ⇒ Object
- #trade(trade_id) ⇒ Object
- #trades(trade_status, product_name: nil, page: nil, per_page: nil) ⇒ Object
- #update_conditional_order(conditional_order_id, conditional_order_dto) ⇒ Object
- #update_leverage(leverage) ⇒ Object
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 = account_id @trading_api = trading_api @investor_account_info_api = investor_account_info_api end |
Instance Attribute Details
#account_id ⇒ Object (readonly)
Returns the value of attribute account_id.
5 6 7 |
# File 'lib/darwinex/investor_account.rb', line 5 def account_id @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) 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) ⇒ Object
33 34 35 |
# 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) ⇒ Object
13 14 15 |
# 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) ⇒ Object
37 38 39 |
# 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) ⇒ 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(account_id) else trading_api.create_product_stopout(account_id, 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) investor_account_info_api.get_current_positions(account_id, 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(account_id, 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) investor_account_info_api.get_executed_orders( account_id, product_name: product_name, page: page, per_page: per_page ) end |
#leverage ⇒ Object
25 26 27 |
# File 'lib/darwinex/investor_account.rb', line 25 def leverage trading_api.get_leverage(account_id) end |
#order(order_id) ⇒ Object
76 77 78 |
# 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) ⇒ Object
80 81 82 |
# 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) ⇒ Object
84 85 86 |
# 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 ⇒ Object
49 50 51 |
# File 'lib/darwinex/investor_account.rb', line 49 def summary investor_account_info_api.get_investor_account(account_id) end |
#trade(trade_id) ⇒ Object
92 93 94 |
# 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) ⇒ Object
88 89 90 |
# 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) ⇒ 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(account_id, 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(account_id, leverage) end |