Module: Bitfinex::RESTv1Positions

Included in:
RESTv1
Defined in:
lib/rest/v1/positions.rb

Instance Method Summary collapse

Instance Method Details

#claim_position(position_id, amount) ⇒ Hash

A position can be claimed if:

It is a long position: The amount in the last unit of the position pair that you have in your trading wallet AND/OR the realized profit of the position is greater or equal to the purchase amount of the position (base price * position amount) and the funds which need to be returned. For example, for a long BTCUSD position, you can claim the position if the amount of USD you have in the trading wallet is greater than the base price * the position amount and the funds used.

It is a short position: The amount in the first unit of the position pair that you have in your trading wallet is greater or equal to the amount of the position and the margin funding used. @example:

client.claim_position(100,10)

Parameters:

  • position_id (int)

    The position ID given by ‘/positions`

  • amount (decimal)

    The partial amount you wish to claim

Returns:

  • (Hash)


22
23
24
# File 'lib/rest/v1/positions.rb', line 22

def claim_position(position_id, amount)
  authenticated_post("position/claim", params: {position_id: position_id, amount: amount}).body
end

#close_position(position_id) ⇒ Object

Closes the specified position with a market order



27
28
29
# File 'lib/rest/v1/positions.rb', line 27

def close_position(position_id)
  authenticated_post("position/close", params: {position_id: position_id}).body
end

#positionsArray

View your active positions.

@example:

client.positions

Returns:

  • (Array)


8
9
10
# File 'lib/rest/v1/positions.rb', line 8

def positions
  authenticated_post("positions").body
end