prun-trade-bot-go/lib/models/commodity.go

36 lines
607 B
Go

package models
import "gorm.io/gorm"
type Commodity struct {
gorm.Model
Ticker string `gorm:"index,unique"`
Name string
Weight float64
Volume float64
Category string
}
type FIOCommodity struct {
MaterialId string `json:"MaterialId"`
Ticker string `json:"Ticker"`
Name string `json:"Name"`
Category string `json:"CategoryName"`
Volume float64 `json:"Volume"`
Weight float64 `json:"Weight"`
}
func (C FIOCommodity) ToCommodity() Commodity {
return Commodity{
Ticker: C.Ticker,
Category: C.Category,
Weight: C.Weight,
Volume: C.Volume,
Name: C.Name,
}
}