github.com/diadata-org/diadata@v1.4.593/pkg/model/foreignTypes.go (about) 1 package models 2 3 import ( 4 "encoding/json" 5 "time" 6 ) 7 8 type ForeignQuotation struct { 9 Symbol string `json:"Symbol"` 10 Name string `json:"Name"` 11 Price float64 `json:"Price"` 12 PriceYesterday float64 `json:"PriceYesterday"` 13 VolumeYesterdayUSD float64 `json:"VolumeYesterdayUSD"` 14 Source string `json:"Source"` 15 Time time.Time `json:"Time"` 16 } 17 18 type DefiScore struct { 19 Protocol string 20 Symbol string 21 Score float64 22 LiquidityIndex float64 23 CollateralIndex float64 24 } 25 26 // MarshalBinary - 27 func (fq *ForeignQuotation) MarshalBinary() ([]byte, error) { 28 return json.Marshal(fq) 29 } 30 31 // UnmarshalBinary - 32 func (fq *ForeignQuotation) UnmarshalBinary(data []byte) error { 33 if err := json.Unmarshal(data, &fq); err != nil { 34 return err 35 } 36 return nil 37 }