-
Notifications
You must be signed in to change notification settings - Fork 83
/
funding.go
34 lines (31 loc) · 997 Bytes
/
funding.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package events
// NewPremiumSamplesEvent creates a FundingEvent representing a list of new funding premium
// samples generated at the end of each `funding-sample` epoch.
func NewPremiumSamplesEvent(
newSamplesForEvent []FundingUpdateV1,
) *FundingEventV1 {
return newFundingEvent(
newSamplesForEvent,
FundingEventV1_TYPE_PREMIUM_SAMPLE,
)
}
// NewFundingRatesAndIndicesEvent creates a FundingEvent representing a list of new
// funding rates generated at the end of each `funding-tick` epoch and funding indices
// accordingly updated with `funding rate * price`.
func NewFundingRatesAndIndicesEvent(
newFundingRatesAndIndicesForEvent []FundingUpdateV1,
) *FundingEventV1 {
return newFundingEvent(
newFundingRatesAndIndicesForEvent,
FundingEventV1_TYPE_FUNDING_RATE_AND_INDEX,
)
}
func newFundingEvent(
newUpdatesForEvent []FundingUpdateV1,
updateType FundingEventV1_Type,
) *FundingEventV1 {
return &FundingEventV1{
Updates: newUpdatesForEvent,
Type: updateType,
}
}