github.com/wtfutil/wtf@v0.43.0/modules/cryptocurrency/cryptolive/toplist/toplist.go (about)

     1  package toplist
     2  
     3  type cList struct {
     4  	items []*fCurrency
     5  }
     6  
     7  type fCurrency struct {
     8  	name, displayName string
     9  	limit             int
    10  	to                []*tCurrency
    11  }
    12  
    13  type tCurrency struct {
    14  	name string
    15  	info []tInfo
    16  }
    17  
    18  type tInfo struct {
    19  	exchange               string
    20  	volume24h, volume24hTo float32
    21  }
    22  
    23  type responseInterface struct {
    24  	Response string `json:"Response"`
    25  	Data     []struct {
    26  		Exchange    string  `json:"exchange"`
    27  		FromSymbol  string  `json:"fromSymbol"`
    28  		ToSymbol    string  `json:"toSymbol"`
    29  		Volume24h   float32 `json:"volume24h"`
    30  		Volume24hTo float32 `json:"volume24hTo"`
    31  	} `json:"Data"`
    32  }
    33  
    34  func (list *cList) addItem(name, displayName string, limit int, to []*tCurrency) {
    35  	list.items = append(list.items, &fCurrency{
    36  		name:        name,
    37  		displayName: displayName,
    38  		limit:       limit,
    39  		to:          to,
    40  	})
    41  }