Class: Xtb::Http::TradeTransaction

Inherits:
Command
  • Object
show all
Defined in:
lib/xtb/http/trade_transaction.rb

Overview

Constant Summary collapse

TradeTransactionResponse =
Data.define(:order)

Instance Method Summary collapse

Methods inherited from Command

call

Constructor Details

#initialize(cmd:, custom_comment:, expiration:, offset:, order:, price:, stop_loss:, symbol:, take_profit:, type:, volume:) ⇒ TradeTransaction

Returns a new instance of TradeTransaction.

Parameters:

  • cmd (Symbol)

    One of :buy, :sell, :buy_limit, :sell_limit, :buy_stop, :sell_stop, :balance, or :credit

  • custom_comment (String)
  • expiration (Integer)
  • offset (Integer)
  • order (Integer)
  • price (Float)
  • stop_loss (Float)
  • symbol (String)
  • take_profit (Float)
  • type (Symbol)

    One of :open, :pending, :close, :modify, or :delete

  • volume (Float)


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/xtb/http/trade_transaction.rb', line 20

def initialize(cmd:, custom_comment:, expiration:, offset:, order:, price:, stop_loss:, symbol:, take_profit:,
               type:, volume:)
  @cmd = cmd
  @custom_comment = custom_comment
  @expiration = expiration
  @offset = offset
  @order = order
  @price = price
  @stop_loss = stop_loss
  @symbol = symbol
  @take_profit = take_profit
  @type = type
  @volume = volume

  super()
end

Instance Method Details

#callObject



37
38
39
# File 'lib/xtb/http/trade_transaction.rb', line 37

def call
  TradeTransactionResponse.new(**super.return_data)
end