mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
bbgo: add two new position constructor
This commit is contained in:
parent
5621effd6b
commit
65629a77f4
|
@ -34,6 +34,22 @@ type Position struct {
|
|||
sync.Mutex
|
||||
}
|
||||
|
||||
func NewPositionFromMarket(market types.Market) *Position {
|
||||
return &Position{
|
||||
Symbol: market.Symbol,
|
||||
BaseCurrency: market.BaseCurrency,
|
||||
QuoteCurrency: market.QuoteCurrency,
|
||||
}
|
||||
}
|
||||
|
||||
func NewPosition(symbol, base, quote string) *Position {
|
||||
return &Position{
|
||||
Symbol: symbol,
|
||||
BaseCurrency: base,
|
||||
QuoteCurrency: quote,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Position) Reset() {
|
||||
p.Base = 0
|
||||
p.Quote = 0
|
||||
|
|
Loading…
Reference in New Issue
Block a user