mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 16:55:15 +00:00
types: add FuturesPosition
This commit is contained in:
parent
5474a42f24
commit
b000f572b4
|
@ -121,6 +121,7 @@ func (m AssetMap) SlackAttachment() slack.Attachment {
|
||||||
|
|
||||||
type BalanceMap map[string]Balance
|
type BalanceMap map[string]Balance
|
||||||
type PositionMap map[string]Position
|
type PositionMap map[string]Position
|
||||||
|
type FuturesPositionMap map[string]FuturesPosition
|
||||||
|
|
||||||
func (m BalanceMap) String() string {
|
func (m BalanceMap) String() string {
|
||||||
var ss []string
|
var ss []string
|
||||||
|
@ -229,7 +230,7 @@ type FuturesAccountInfo struct {
|
||||||
Assets map[Asset]FuturesUserAsset `json:"assets"`
|
Assets map[Asset]FuturesUserAsset `json:"assets"`
|
||||||
FeeTier int `json:"feeTier"`
|
FeeTier int `json:"feeTier"`
|
||||||
MaxWithdrawAmount fixedpoint.Value `json:"maxWithdrawAmount"`
|
MaxWithdrawAmount fixedpoint.Value `json:"maxWithdrawAmount"`
|
||||||
Positions PositionMap `json:"positions"`
|
Positions FuturesPositionMap `json:"positions"`
|
||||||
TotalInitialMargin fixedpoint.Value `json:"totalInitialMargin"`
|
TotalInitialMargin fixedpoint.Value `json:"totalInitialMargin"`
|
||||||
TotalMaintMargin fixedpoint.Value `json:"totalMaintMargin"`
|
TotalMaintMargin fixedpoint.Value `json:"totalMaintMargin"`
|
||||||
TotalMarginBalance fixedpoint.Value `json:"totalMarginBalance"`
|
TotalMarginBalance fixedpoint.Value `json:"totalMarginBalance"`
|
||||||
|
|
|
@ -39,6 +39,27 @@ type Position struct {
|
||||||
FeeRate *ExchangeFee `json:"feeRate,omitempty"`
|
FeeRate *ExchangeFee `json:"feeRate,omitempty"`
|
||||||
ExchangeFeeRates map[ExchangeName]ExchangeFee `json:"exchangeFeeRates"`
|
ExchangeFeeRates map[ExchangeName]ExchangeFee `json:"exchangeFeeRates"`
|
||||||
|
|
||||||
|
sync.Mutex
|
||||||
|
}
|
||||||
|
|
||||||
|
type FuturesPosition struct {
|
||||||
|
Symbol string `json:"symbol"`
|
||||||
|
BaseCurrency string `json:"baseCurrency"`
|
||||||
|
QuoteCurrency string `json:"quoteCurrency"`
|
||||||
|
|
||||||
|
Market Market `json:"market"`
|
||||||
|
|
||||||
|
Base fixedpoint.Value `json:"base"`
|
||||||
|
Quote fixedpoint.Value `json:"quote"`
|
||||||
|
AverageCost fixedpoint.Value `json:"averageCost"`
|
||||||
|
|
||||||
|
// ApproximateAverageCost adds the computed fee in quote in the average cost
|
||||||
|
// This is used for calculating net profit
|
||||||
|
ApproximateAverageCost fixedpoint.Value `json:"approximateAverageCost"`
|
||||||
|
|
||||||
|
FeeRate *ExchangeFee `json:"feeRate,omitempty"`
|
||||||
|
ExchangeFeeRates map[ExchangeName]ExchangeFee `json:"exchangeFeeRates"`
|
||||||
|
|
||||||
// Futures data fields
|
// Futures data fields
|
||||||
Isolated bool `json:"isolated"`
|
Isolated bool `json:"isolated"`
|
||||||
UpdateTime int64 `json:"updateTime"`
|
UpdateTime int64 `json:"updateTime"`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user