code.vegaprotocol.io/vega@v0.79.0/core/execution/liquidation/position.go (about)

     1  // Copyright (C) 2023 Gobalsky Labs Limited
     2  //
     3  // This program is free software: you can redistribute it and/or modify
     4  // it under the terms of the GNU Affero General Public License as
     5  // published by the Free Software Foundation, either version 3 of the
     6  // License, or (at your option) any later version.
     7  //
     8  // This program is distributed in the hope that it will be useful,
     9  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    10  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11  // GNU Affero General Public License for more details.
    12  //
    13  // You should have received a copy of the GNU Affero General Public License
    14  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    15  
    16  package liquidation
    17  
    18  import (
    19  	"code.vegaprotocol.io/vega/core/types"
    20  	"code.vegaprotocol.io/vega/libs/num"
    21  )
    22  
    23  type Pos struct {
    24  	open  int64
    25  	price *num.Uint
    26  }
    27  
    28  func (p *Pos) Party() string {
    29  	return types.NetworkParty
    30  }
    31  
    32  func (p *Pos) Size() int64 {
    33  	return p.open
    34  }
    35  
    36  func (p *Pos) Buy() int64 {
    37  	return 0
    38  }
    39  
    40  func (p *Pos) Sell() int64 {
    41  	return 0
    42  }
    43  
    44  func (p *Pos) Price() *num.Uint {
    45  	if p.price == nil {
    46  		return num.UintZero()
    47  	}
    48  	return p.price.Clone()
    49  }
    50  
    51  func (p *Pos) BuySumProduct() *num.Uint {
    52  	return num.UintZero() // shouldn't be used
    53  }
    54  
    55  func (p *Pos) SellSumProduct() *num.Uint {
    56  	return num.UintZero() // shouldn't be used
    57  }
    58  
    59  func (p *Pos) VWBuy() *num.Uint {
    60  	return num.UintZero() // shouldn't be used
    61  }
    62  
    63  func (p *Pos) VWSell() *num.Uint {
    64  	return num.UintZero() // shouldn't be used
    65  }
    66  
    67  func (p *Pos) AverageEntryPrice() *num.Uint {
    68  	if p.price != nil {
    69  		return p.price.Clone() // not sure
    70  	}
    71  	return num.UintZero() // shouldn't be used
    72  }