diff --git a/alpaca/entities.go b/alpaca/entities.go index b92e033..d6023be 100644 --- a/alpaca/entities.go +++ b/alpaca/entities.go @@ -116,17 +116,19 @@ type Position struct { type positionSlice []Position type Asset struct { - ID string `json:"id"` - Class AssetClass `json:"class"` - Exchange string `json:"exchange"` - Symbol string `json:"symbol"` - Name string `json:"name"` - Status AssetStatus `json:"status"` - Tradable bool `json:"tradable"` - Marginable bool `json:"marginable"` - Shortable bool `json:"shortable"` - EasyToBorrow bool `json:"easy_to_borrow"` - Fractionable bool `json:"fractionable"` + ID string `json:"id"` + Class AssetClass `json:"class"` + Exchange string `json:"exchange"` + Symbol string `json:"symbol"` + Name string `json:"name"` + Status AssetStatus `json:"status"` + Tradable bool `json:"tradable"` + Marginable bool `json:"marginable"` + MaintenanceMarginRequirement uint `json:"maintenance_margin_requirement"` + Shortable bool `json:"shortable"` + EasyToBorrow bool `json:"easy_to_borrow"` + Fractionable bool `json:"fractionable"` + Attributes []string `json:"attributes"` } //easyjson:json diff --git a/alpaca/entities_easyjson.go b/alpaca/entities_easyjson.go index 4ba3887..b03ded3 100644 --- a/alpaca/entities_easyjson.go +++ b/alpaca/entities_easyjson.go @@ -2566,12 +2566,37 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(in *jlexe out.Tradable = bool(in.Bool()) case "marginable": out.Marginable = bool(in.Bool()) + case "maintenance_margin_requirement": + out.MaintenanceMarginRequirement = uint(in.Uint()) case "shortable": out.Shortable = bool(in.Bool()) case "easy_to_borrow": out.EasyToBorrow = bool(in.Bool()) case "fractionable": out.Fractionable = bool(in.Bool()) + case "attributes": + if in.IsNull() { + in.Skip() + out.Attributes = nil + } else { + in.Delim('[') + if out.Attributes == nil { + if !in.IsDelim(']') { + out.Attributes = make([]string, 0, 4) + } else { + out.Attributes = []string{} + } + } else { + out.Attributes = (out.Attributes)[:0] + } + for !in.IsDelim(']') { + var v46 string + v46 = string(in.String()) + out.Attributes = append(out.Attributes, v46) + in.WantComma() + } + in.Delim(']') + } default: in.SkipRecursive() } @@ -2626,6 +2651,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(out *jwri out.RawString(prefix) out.Bool(bool(in.Marginable)) } + { + const prefix string = ",\"maintenance_margin_requirement\":" + out.RawString(prefix) + out.Uint(uint(in.MaintenanceMarginRequirement)) + } { const prefix string = ",\"shortable\":" out.RawString(prefix) @@ -2641,6 +2671,22 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(out *jwri out.RawString(prefix) out.Bool(bool(in.Fractionable)) } + { + const prefix string = ",\"attributes\":" + out.RawString(prefix) + if in.Attributes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v47, v48 := range in.Attributes { + if v47 > 0 { + out.RawByte(',') + } + out.String(string(v48)) + } + out.RawByte(']') + } + } out.RawByte('}') }