Class: Darwinex::Api::InvestorAccountInfoApi
- Defined in:
- lib/darwinex/api/investor_account_info_api.rb
Constant Summary collapse
- BASE_URI =
'https://api.darwinex.com/investoraccountinfo/2.0'
Instance Method Summary collapse
- #get_conditional_order(account_id, conditional_order_id) ⇒ Object
- #get_current_positions(account_id, product_name: nil) ⇒ Object
- #get_executed_orders(account_id, product_name: nil, page: nil, per_page: nil) ⇒ Object
- #get_investor_account(account_id) ⇒ Object
- #get_order(account_id, order_id) ⇒ Object
- #get_performance_fees(account_id, page: nil, per_page: nil) ⇒ Object
- #get_performance_fees_for_product(account_id, product_name) ⇒ Object
- #get_trade(account_id, trade_id) ⇒ Object
-
#initialize(config:, logger:) ⇒ InvestorAccountInfoApi
constructor
A new instance of InvestorAccountInfoApi.
- #list_conditional_orders(account_id, status, product_name: nil, page: nil, per_page: nil) ⇒ Object
- #list_investor_accounts ⇒ Object
- #list_trades(account_id, trade_status, product_name: nil, page: nil, per_page: nil) ⇒ Object
Methods inherited from Api
Constructor Details
#initialize(config:, logger:) ⇒ InvestorAccountInfoApi
Returns a new instance of InvestorAccountInfoApi.
14 15 16 17 |
# File 'lib/darwinex/api/investor_account_info_api.rb', line 14 def initialize(config:, logger:) super(logger) @config = config end |
Instance Method Details
#get_conditional_order(account_id, conditional_order_id) ⇒ Object
40 41 42 |
# File 'lib/darwinex/api/investor_account_info_api.rb', line 40 def get_conditional_order(account_id, conditional_order_id) send('get', "/investoraccounts/#{account_id}/conditionalorders/conditional_order_id", , max_retries: config.max_retries) end |
#get_current_positions(account_id, product_name: nil) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/darwinex/api/investor_account_info_api.rb', line 44 def get_current_positions(account_id, product_name: nil) query = { query: { productName: product_name } } send('get', "/investoraccounts/#{account_id}/currentpositions", .merge(query), max_retries: config.max_retries) end |
#get_executed_orders(account_id, product_name: nil, page: nil, per_page: nil) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/darwinex/api/investor_account_info_api.rb', line 54 def get_executed_orders(account_id, product_name: nil, page: nil, per_page: nil) query = { query: { productName: product_name, page: page, per_page: per_page } } send('get', "/investoraccounts/#{account_id}/orders/executed", .merge(query), max_retries: config.max_retries) end |
#get_investor_account(account_id) ⇒ Object
23 24 25 |
# File 'lib/darwinex/api/investor_account_info_api.rb', line 23 def get_investor_account(account_id) send('get', "/investoraccounts/#{account_id}", , max_retries: config.max_retries) end |
#get_order(account_id, order_id) ⇒ Object
66 67 68 |
# File 'lib/darwinex/api/investor_account_info_api.rb', line 66 def get_order(account_id, order_id) send('get', "/investoraccounts/#{account_id}/orders/#{order_id}", , max_retries: config.max_retries) end |
#get_performance_fees(account_id, page: nil, per_page: nil) ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/darwinex/api/investor_account_info_api.rb', line 70 def get_performance_fees(account_id, page: nil, per_page: nil) query = { query: { page: page, per_page: per_page } } send('get', "/investoraccounts/#{account_id}/performancefees", .merge(query), max_retries: config.max_retries) end |
#get_performance_fees_for_product(account_id, product_name) ⇒ Object
81 82 83 |
# File 'lib/darwinex/api/investor_account_info_api.rb', line 81 def get_performance_fees_for_product(account_id, product_name) send('get', "/investoraccounts/#{account_id}/performancefees/#{product_name}", , max_retries: config.max_retries) end |
#get_trade(account_id, trade_id) ⇒ Object
98 99 100 |
# File 'lib/darwinex/api/investor_account_info_api.rb', line 98 def get_trade(account_id, trade_id) send('get', "/investoraccounts/#{account_id}/trades/#{trade_id}", , max_retries: config.max_retries) end |
#list_conditional_orders(account_id, status, product_name: nil, page: nil, per_page: nil) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/darwinex/api/investor_account_info_api.rb', line 27 def list_conditional_orders(account_id, status, product_name: nil, page: nil, per_page: nil) # TODO: status validation query = { query: { productName: product_name, page: page, per_page: per_page } } send('get', "/investoraccounts/#{account_id}/conditionalorders/#{status}", .merge(query), max_retries: config.max_retries) end |
#list_investor_accounts ⇒ Object
19 20 21 |
# File 'lib/darwinex/api/investor_account_info_api.rb', line 19 def list_investor_accounts send('get', '/investoraccounts', , max_retries: config.max_retries) end |
#list_trades(account_id, trade_status, product_name: nil, page: nil, per_page: nil) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/darwinex/api/investor_account_info_api.rb', line 85 def list_trades(account_id, trade_status, product_name: nil, page: nil, per_page: nil) # todo: verify status query = { query: { product_name: product_name, page: page, per_page: per_page } } send('get', "/investoraccounts/#{account_id}/trades/#{trade_status}", .merge(query), max_retries: config.max_retries) end |