diff --git a/alpaca/entities.go b/alpaca/entities.go index a7a53a4..464bc76 100644 --- a/alpaca/entities.go +++ b/alpaca/entities.go @@ -388,3 +388,89 @@ type closeAllPositionsResponse struct { Status int `json:"status"` Body json.RawMessage `json:"body,omitempty"` } + +type OptionStatus string + +const ( + OptionStatusActive OptionStatus = "active" + OptionStatusInactive OptionStatus = "inactive" +) + +type OptionType string + +const ( + OptionTypeCall OptionType = "call" + OptionTypePut OptionType = "put" +) + +type OptionStyle string + +const ( + OptionStyleAmerican OptionStyle = "american" + OptionStyleEuropean OptionStyle = "european" +) + +type DeliverableType string + +const ( + DeliverableTypeCash DeliverableType = "cash" + DeliverableTypeEquity DeliverableType = "equity" +) + +type DeliverableSettlementType string + +const ( + DeliverableSettlementTypeT0 DeliverableSettlementType = "T+0" + DeliverableSettlementTypeT1 DeliverableSettlementType = "T+1" + DeliverableSettlementTypeT2 DeliverableSettlementType = "T+2" + DeliverableSettlementTypeT3 DeliverableSettlementType = "T+3" + DeliverableSettlementTypeT4 DeliverableSettlementType = "T+4" + DeliverableSettlementTypeT5 DeliverableSettlementType = "T+5" +) + +type DeliverableSettlementMethod string + +const ( + DeliverableSettlementMethodBTOB DeliverableSettlementMethod = "BTOB" + DeliverableSettlementMethodCADF DeliverableSettlementMethod = "CADF" + DeliverableSettlementMethodCAFX DeliverableSettlementMethod = "CAFX" + DeliverableSettlementMethodCCC DeliverableSettlementMethod = "CCC" +) + +type OptionDeliverable struct { + Type DeliverableType `json:"type"` + Symbol string `json:"symbol"` + AssetID *string `json:"asset_id,omitempty"` + Amount decimal.Decimal `json:"amount"` + AllocationPercentage decimal.Decimal `json:"allocation_percentage"` + SettlementType DeliverableSettlementType `json:"settlement_type"` + SettlementMethod DeliverableSettlementMethod `json:"settlement_method"` + DelayedSettlement bool `json:"delayed_settlement"` +} + +type OptionContract struct { + ID string `json:"id"` + Symbol string `json:"symbol"` + Name string `json:"name"` + Status OptionStatus `json:"status"` + Tradable bool `json:"tradable"` + ExpirationDate civil.Date `json:"expiration_date"` + RootSymbol *string `json:"root_symbol,omitempty"` + UnderlyingSymbol string `json:"underlying_symbol"` + UnderlyingAssetID string `json:"underlying_asset_id"` + Type OptionType `json:"type"` + Style OptionStyle `json:"style"` + StrikePrice decimal.Decimal `json:"strike_price"` + Multiplier decimal.Decimal `json:"multiplier"` + Size decimal.Decimal `json:"size"` + OpenInterest *decimal.Decimal `json:"open_interest"` + OpenInterestDate *civil.Date `json:"open_interest_date,omitempty"` + ClosePrice *decimal.Decimal `json:"close_price,omitempty"` + ClosePriceDate *civil.Date `json:"close_price_date,omitempty"` + Deliverables []OptionDeliverable `json:"deliverables,omitempty"` +} + +type optionContractsResponse struct { + OptionContracts []OptionContract `json:"option_contracts"` + NextPageToken *string `json:"next_page_token,omitempty"` +} diff --git a/alpaca/entities_easyjson.go b/alpaca/entities_easyjson.go index 6123a11..a6a3a7b 100644 --- a/alpaca/entities_easyjson.go +++ b/alpaca/entities_easyjson.go @@ -3,6 +3,7 @@ package alpaca import ( + civil "cloud.google.com/go/civil" json "encoding/json" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" @@ -217,7 +218,120 @@ func (v *orderSlice) UnmarshalJSON(data []byte) error { func (v *orderSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca2(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(in *jlexer.Lexer, out *closeAllPositionsSlice) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(in *jlexer.Lexer, out *optionContractsResponse) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "option_contracts": + if in.IsNull() { + in.Skip() + out.OptionContracts = nil + } else { + in.Delim('[') + if out.OptionContracts == nil { + if !in.IsDelim(']') { + out.OptionContracts = make([]OptionContract, 0, 0) + } else { + out.OptionContracts = []OptionContract{} + } + } else { + out.OptionContracts = (out.OptionContracts)[:0] + } + for !in.IsDelim(']') { + var v10 OptionContract + (v10).UnmarshalEasyJSON(in) + out.OptionContracts = append(out.OptionContracts, v10) + in.WantComma() + } + in.Delim(']') + } + case "next_page_token": + if in.IsNull() { + in.Skip() + out.NextPageToken = nil + } else { + if out.NextPageToken == nil { + out.NextPageToken = new(string) + } + *out.NextPageToken = string(in.String()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(out *jwriter.Writer, in optionContractsResponse) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"option_contracts\":" + out.RawString(prefix[1:]) + if in.OptionContracts == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v11, v12 := range in.OptionContracts { + if v11 > 0 { + out.RawByte(',') + } + (v12).MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + if in.NextPageToken != nil { + const prefix string = ",\"next_page_token\":" + out.RawString(prefix) + out.String(string(*in.NextPageToken)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v optionContractsResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v optionContractsResponse) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *optionContractsResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *optionContractsResponse) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(in *jlexer.Lexer, out *closeAllPositionsSlice) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() @@ -234,9 +348,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(in *jlexer *out = (*out)[:0] } for !in.IsDelim(']') { - var v10 closeAllPositionsResponse - (v10).UnmarshalEasyJSON(in) - *out = append(*out, v10) + var v13 closeAllPositionsResponse + (v13).UnmarshalEasyJSON(in) + *out = append(*out, v13) in.WantComma() } in.Delim(']') @@ -245,16 +359,16 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(out *jwriter.Writer, in closeAllPositionsSlice) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(out *jwriter.Writer, in closeAllPositionsSlice) { if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { out.RawByte('[') - for v11, v12 := range in { - if v11 > 0 { + for v14, v15 := range in { + if v14 > 0 { out.RawByte(',') } - (v12).MarshalEasyJSON(out) + (v15).MarshalEasyJSON(out) } out.RawByte(']') } @@ -263,27 +377,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(out *jwrit // MarshalJSON supports json.Marshaler interface func (v closeAllPositionsSlice) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v closeAllPositionsSlice) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *closeAllPositionsSlice) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *closeAllPositionsSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(in *jlexer.Lexer, out *closeAllPositionsResponse) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(in *jlexer.Lexer, out *closeAllPositionsResponse) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -320,7 +434,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(out *jwriter.Writer, in closeAllPositionsResponse) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(out *jwriter.Writer, in closeAllPositionsResponse) { out.RawByte('{') first := true _ = first @@ -345,27 +459,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(out *jwrit // MarshalJSON supports json.Marshaler interface func (v closeAllPositionsResponse) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v closeAllPositionsResponse) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *closeAllPositionsResponse) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *closeAllPositionsResponse) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(in *jlexer.Lexer, out *calendarDaySlice) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(in *jlexer.Lexer, out *calendarDaySlice) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() @@ -382,9 +496,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(in *jlexer *out = (*out)[:0] } for !in.IsDelim(']') { - var v13 CalendarDay - (v13).UnmarshalEasyJSON(in) - *out = append(*out, v13) + var v16 CalendarDay + (v16).UnmarshalEasyJSON(in) + *out = append(*out, v16) in.WantComma() } in.Delim(']') @@ -393,16 +507,16 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(out *jwriter.Writer, in calendarDaySlice) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(out *jwriter.Writer, in calendarDaySlice) { if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { out.RawByte('[') - for v14, v15 := range in { - if v14 > 0 { + for v17, v18 := range in { + if v17 > 0 { out.RawByte(',') } - (v15).MarshalEasyJSON(out) + (v18).MarshalEasyJSON(out) } out.RawByte(']') } @@ -411,27 +525,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(out *jwrit // MarshalJSON supports json.Marshaler interface func (v calendarDaySlice) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v calendarDaySlice) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *calendarDaySlice) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *calendarDaySlice) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(in *jlexer.Lexer, out *assetSlice) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(in *jlexer.Lexer, out *assetSlice) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() @@ -448,9 +562,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(in *jlexer *out = (*out)[:0] } for !in.IsDelim(']') { - var v16 Asset - (v16).UnmarshalEasyJSON(in) - *out = append(*out, v16) + var v19 Asset + (v19).UnmarshalEasyJSON(in) + *out = append(*out, v19) in.WantComma() } in.Delim(']') @@ -459,16 +573,16 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(out *jwriter.Writer, in assetSlice) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(out *jwriter.Writer, in assetSlice) { if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { out.RawByte('[') - for v17, v18 := range in { - if v17 > 0 { + for v20, v21 := range in { + if v20 > 0 { out.RawByte(',') } - (v18).MarshalEasyJSON(out) + (v21).MarshalEasyJSON(out) } out.RawByte(']') } @@ -477,27 +591,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(out *jwrit // MarshalJSON supports json.Marshaler interface func (v assetSlice) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v assetSlice) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *assetSlice) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *assetSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(in *jlexer.Lexer, out *announcementSlice) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(in *jlexer.Lexer, out *announcementSlice) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() @@ -514,9 +628,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(in *jlexer *out = (*out)[:0] } for !in.IsDelim(']') { - var v19 Announcement - (v19).UnmarshalEasyJSON(in) - *out = append(*out, v19) + var v22 Announcement + (v22).UnmarshalEasyJSON(in) + *out = append(*out, v22) in.WantComma() } in.Delim(']') @@ -525,16 +639,16 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(out *jwriter.Writer, in announcementSlice) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(out *jwriter.Writer, in announcementSlice) { if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { out.RawByte('[') - for v20, v21 := range in { - if v20 > 0 { + for v23, v24 := range in { + if v23 > 0 { out.RawByte(',') } - (v21).MarshalEasyJSON(out) + (v24).MarshalEasyJSON(out) } out.RawByte(']') } @@ -543,27 +657,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(out *jwrit // MarshalJSON supports json.Marshaler interface func (v announcementSlice) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v announcementSlice) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *announcementSlice) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *announcementSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(in *jlexer.Lexer, out *accountSlice) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(in *jlexer.Lexer, out *accountSlice) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() @@ -580,9 +694,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(in *jlexer *out = (*out)[:0] } for !in.IsDelim(']') { - var v22 AccountActivity - (v22).UnmarshalEasyJSON(in) - *out = append(*out, v22) + var v25 AccountActivity + (v25).UnmarshalEasyJSON(in) + *out = append(*out, v25) in.WantComma() } in.Delim(']') @@ -591,16 +705,16 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(out *jwriter.Writer, in accountSlice) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(out *jwriter.Writer, in accountSlice) { if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { out.RawByte('[') - for v23, v24 := range in { - if v23 > 0 { + for v26, v27 := range in { + if v26 > 0 { out.RawByte(',') } - (v24).MarshalEasyJSON(out) + (v27).MarshalEasyJSON(out) } out.RawByte(']') } @@ -609,27 +723,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(out *jwrit // MarshalJSON supports json.Marshaler interface func (v accountSlice) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v accountSlice) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *accountSlice) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *accountSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(in *jlexer.Lexer, out *Watchlist) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(in *jlexer.Lexer, out *Watchlist) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -674,9 +788,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(in *jlexer out.Assets = (out.Assets)[:0] } for !in.IsDelim(']') { - var v25 Asset - (v25).UnmarshalEasyJSON(in) - out.Assets = append(out.Assets, v25) + var v28 Asset + (v28).UnmarshalEasyJSON(in) + out.Assets = append(out.Assets, v28) in.WantComma() } in.Delim(']') @@ -691,7 +805,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(out *jwriter.Writer, in Watchlist) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(out *jwriter.Writer, in Watchlist) { out.RawByte('{') first := true _ = first @@ -727,11 +841,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(out *jwrit out.RawString("null") } else { out.RawByte('[') - for v26, v27 := range in.Assets { - if v26 > 0 { + for v29, v30 := range in.Assets { + if v29 > 0 { out.RawByte(',') } - (v27).MarshalEasyJSON(out) + (v30).MarshalEasyJSON(out) } out.RawByte(']') } @@ -742,27 +856,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(out *jwrit // MarshalJSON supports json.Marshaler interface func (v Watchlist) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Watchlist) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Watchlist) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Watchlist) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(in *jlexer.Lexer, out *UpdateWatchlistRequest) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(in *jlexer.Lexer, out *UpdateWatchlistRequest) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -799,9 +913,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(in *jlexe out.Symbols = (out.Symbols)[:0] } for !in.IsDelim(']') { - var v28 string - v28 = string(in.String()) - out.Symbols = append(out.Symbols, v28) + var v31 string + v31 = string(in.String()) + out.Symbols = append(out.Symbols, v31) in.WantComma() } in.Delim(']') @@ -816,7 +930,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(out *jwriter.Writer, in UpdateWatchlistRequest) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(out *jwriter.Writer, in UpdateWatchlistRequest) { out.RawByte('{') first := true _ = first @@ -832,11 +946,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(out *jwri out.RawString("null") } else { out.RawByte('[') - for v29, v30 := range in.Symbols { - if v29 > 0 { + for v32, v33 := range in.Symbols { + if v32 > 0 { out.RawByte(',') } - out.String(string(v30)) + out.String(string(v33)) } out.RawByte(']') } @@ -847,27 +961,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(out *jwri // MarshalJSON supports json.Marshaler interface func (v UpdateWatchlistRequest) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v UpdateWatchlistRequest) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *UpdateWatchlistRequest) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *UpdateWatchlistRequest) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(in *jlexer.Lexer, out *TradeUpdate) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(in *jlexer.Lexer, out *TradeUpdate) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -956,7 +1070,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(out *jwriter.Writer, in TradeUpdate) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(out *jwriter.Writer, in TradeUpdate) { out.RawByte('{') first := true _ = first @@ -1027,27 +1141,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(out *jwri // MarshalJSON supports json.Marshaler interface func (v TradeUpdate) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v TradeUpdate) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *TradeUpdate) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *TradeUpdate) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(in *jlexer.Lexer, out *RemoveSymbolFromWatchlistRequest) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(in *jlexer.Lexer, out *RemoveSymbolFromWatchlistRequest) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -1078,7 +1192,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(out *jwriter.Writer, in RemoveSymbolFromWatchlistRequest) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(out *jwriter.Writer, in RemoveSymbolFromWatchlistRequest) { out.RawByte('{') first := true _ = first @@ -1093,27 +1207,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(out *jwri // MarshalJSON supports json.Marshaler interface func (v RemoveSymbolFromWatchlistRequest) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v RemoveSymbolFromWatchlistRequest) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *RemoveSymbolFromWatchlistRequest) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *RemoveSymbolFromWatchlistRequest) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(in *jlexer.Lexer, out *Position) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(in *jlexer.Lexer, out *Position) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -1266,7 +1380,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(out *jwriter.Writer, in Position) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(out *jwriter.Writer, in Position) { out.RawByte('{') first := true _ = first @@ -1398,27 +1512,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(out *jwri // MarshalJSON supports json.Marshaler interface func (v Position) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Position) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Position) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Position) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(in *jlexer.Lexer, out *PortfolioHistory) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(in *jlexer.Lexer, out *PortfolioHistory) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -1457,11 +1571,11 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(in *jlexe out.Equity = (out.Equity)[:0] } for !in.IsDelim(']') { - var v31 decimal.Decimal + var v34 decimal.Decimal if data := in.Raw(); in.Ok() { - in.AddError((v31).UnmarshalJSON(data)) + in.AddError((v34).UnmarshalJSON(data)) } - out.Equity = append(out.Equity, v31) + out.Equity = append(out.Equity, v34) in.WantComma() } in.Delim(']') @@ -1482,11 +1596,11 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(in *jlexe out.ProfitLoss = (out.ProfitLoss)[:0] } for !in.IsDelim(']') { - var v32 decimal.Decimal + var v35 decimal.Decimal if data := in.Raw(); in.Ok() { - in.AddError((v32).UnmarshalJSON(data)) + in.AddError((v35).UnmarshalJSON(data)) } - out.ProfitLoss = append(out.ProfitLoss, v32) + out.ProfitLoss = append(out.ProfitLoss, v35) in.WantComma() } in.Delim(']') @@ -1507,11 +1621,11 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(in *jlexe out.ProfitLossPct = (out.ProfitLossPct)[:0] } for !in.IsDelim(']') { - var v33 decimal.Decimal + var v36 decimal.Decimal if data := in.Raw(); in.Ok() { - in.AddError((v33).UnmarshalJSON(data)) + in.AddError((v36).UnmarshalJSON(data)) } - out.ProfitLossPct = append(out.ProfitLossPct, v33) + out.ProfitLossPct = append(out.ProfitLossPct, v36) in.WantComma() } in.Delim(']') @@ -1534,9 +1648,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(in *jlexe out.Timestamp = (out.Timestamp)[:0] } for !in.IsDelim(']') { - var v34 int64 - v34 = int64(in.Int64()) - out.Timestamp = append(out.Timestamp, v34) + var v37 int64 + v37 = int64(in.Int64()) + out.Timestamp = append(out.Timestamp, v37) in.WantComma() } in.Delim(']') @@ -1551,7 +1665,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(out *jwriter.Writer, in PortfolioHistory) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(out *jwriter.Writer, in PortfolioHistory) { out.RawByte('{') first := true _ = first @@ -1567,11 +1681,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(out *jwri out.RawString("null") } else { out.RawByte('[') - for v35, v36 := range in.Equity { - if v35 > 0 { + for v38, v39 := range in.Equity { + if v38 > 0 { out.RawByte(',') } - out.Raw((v36).MarshalJSON()) + out.Raw((v39).MarshalJSON()) } out.RawByte(']') } @@ -1583,11 +1697,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(out *jwri out.RawString("null") } else { out.RawByte('[') - for v37, v38 := range in.ProfitLoss { - if v37 > 0 { + for v40, v41 := range in.ProfitLoss { + if v40 > 0 { out.RawByte(',') } - out.Raw((v38).MarshalJSON()) + out.Raw((v41).MarshalJSON()) } out.RawByte(']') } @@ -1599,11 +1713,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(out *jwri out.RawString("null") } else { out.RawByte('[') - for v39, v40 := range in.ProfitLossPct { - if v39 > 0 { + for v42, v43 := range in.ProfitLossPct { + if v42 > 0 { out.RawByte(',') } - out.Raw((v40).MarshalJSON()) + out.Raw((v43).MarshalJSON()) } out.RawByte(']') } @@ -1620,11 +1734,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(out *jwri out.RawString("null") } else { out.RawByte('[') - for v41, v42 := range in.Timestamp { - if v41 > 0 { + for v44, v45 := range in.Timestamp { + if v44 > 0 { out.RawByte(',') } - out.Int64(int64(v42)) + out.Int64(int64(v45)) } out.RawByte(']') } @@ -1635,27 +1749,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(out *jwri // MarshalJSON supports json.Marshaler interface func (v PortfolioHistory) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v PortfolioHistory) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *PortfolioHistory) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *PortfolioHistory) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(in *jlexer.Lexer, out *Order) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(in *jlexer.Lexer, out *Order) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -1904,9 +2018,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(in *jlexe out.Legs = (out.Legs)[:0] } for !in.IsDelim(']') { - var v43 Order - (v43).UnmarshalEasyJSON(in) - out.Legs = append(out.Legs, v43) + var v46 Order + (v46).UnmarshalEasyJSON(in) + out.Legs = append(out.Legs, v46) in.WantComma() } in.Delim(']') @@ -1921,7 +2035,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(out *jwriter.Writer, in Order) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(out *jwriter.Writer, in Order) { out.RawByte('{') first := true _ = first @@ -2142,11 +2256,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(out *jwri out.RawString("null") } else { out.RawByte('[') - for v44, v45 := range in.Legs { - if v44 > 0 { + for v47, v48 := range in.Legs { + if v47 > 0 { out.RawByte(',') } - (v45).MarshalEasyJSON(out) + (v48).MarshalEasyJSON(out) } out.RawByte(']') } @@ -2157,27 +2271,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(out *jwri // MarshalJSON supports json.Marshaler interface func (v Order) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Order) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Order) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Order) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(in *jlexer.Lexer, out *CreateWatchlistRequest) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(in *jlexer.Lexer, out *OptionDeliverable) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2196,32 +2310,35 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(in *jlexe continue } switch key { - case "name": - out.Name = string(in.String()) - case "symbols": + case "type": + out.Type = DeliverableType(in.String()) + case "symbol": + out.Symbol = string(in.String()) + case "asset_id": if in.IsNull() { in.Skip() - out.Symbols = nil + out.AssetID = nil } else { - in.Delim('[') - if out.Symbols == nil { - if !in.IsDelim(']') { - out.Symbols = make([]string, 0, 4) - } else { - out.Symbols = []string{} - } - } else { - out.Symbols = (out.Symbols)[:0] - } - for !in.IsDelim(']') { - var v46 string - v46 = string(in.String()) - out.Symbols = append(out.Symbols, v46) - in.WantComma() + if out.AssetID == nil { + out.AssetID = new(string) } - in.Delim(']') + *out.AssetID = string(in.String()) } - default: + case "amount": + if data := in.Raw(); in.Ok() { + in.AddError((out.Amount).UnmarshalJSON(data)) + } + case "allocation_percentage": + if data := in.Raw(); in.Ok() { + in.AddError((out.AllocationPercentage).UnmarshalJSON(data)) + } + case "settlement_type": + out.SettlementType = DeliverableSettlementType(in.String()) + case "settlement_method": + out.SettlementMethod = DeliverableSettlementMethod(in.String()) + case "delayed_settlement": + out.DelayedSettlement = bool(in.Bool()) + default: in.SkipRecursive() } in.WantComma() @@ -2231,7 +2348,413 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(out *jwriter.Writer, in CreateWatchlistRequest) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(out *jwriter.Writer, in OptionDeliverable) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"type\":" + out.RawString(prefix[1:]) + out.String(string(in.Type)) + } + { + const prefix string = ",\"symbol\":" + out.RawString(prefix) + out.String(string(in.Symbol)) + } + if in.AssetID != nil { + const prefix string = ",\"asset_id\":" + out.RawString(prefix) + out.String(string(*in.AssetID)) + } + { + const prefix string = ",\"amount\":" + out.RawString(prefix) + out.Raw((in.Amount).MarshalJSON()) + } + { + const prefix string = ",\"allocation_percentage\":" + out.RawString(prefix) + out.Raw((in.AllocationPercentage).MarshalJSON()) + } + { + const prefix string = ",\"settlement_type\":" + out.RawString(prefix) + out.String(string(in.SettlementType)) + } + { + const prefix string = ",\"settlement_method\":" + out.RawString(prefix) + out.String(string(in.SettlementMethod)) + } + { + const prefix string = ",\"delayed_settlement\":" + out.RawString(prefix) + out.Bool(bool(in.DelayedSettlement)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v OptionDeliverable) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v OptionDeliverable) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *OptionDeliverable) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *OptionDeliverable) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(in *jlexer.Lexer, out *OptionContract) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "id": + out.ID = string(in.String()) + case "symbol": + out.Symbol = string(in.String()) + case "name": + out.Name = string(in.String()) + case "status": + out.Status = OptionStatus(in.String()) + case "tradable": + out.Tradable = bool(in.Bool()) + case "expiration_date": + if data := in.UnsafeBytes(); in.Ok() { + in.AddError((out.ExpirationDate).UnmarshalText(data)) + } + case "root_symbol": + if in.IsNull() { + in.Skip() + out.RootSymbol = nil + } else { + if out.RootSymbol == nil { + out.RootSymbol = new(string) + } + *out.RootSymbol = string(in.String()) + } + case "underlying_symbol": + out.UnderlyingSymbol = string(in.String()) + case "underlying_asset_id": + out.UnderlyingAssetID = string(in.String()) + case "type": + out.Type = OptionType(in.String()) + case "style": + out.Style = OptionStyle(in.String()) + case "strike_price": + if data := in.Raw(); in.Ok() { + in.AddError((out.StrikePrice).UnmarshalJSON(data)) + } + case "multiplier": + if data := in.Raw(); in.Ok() { + in.AddError((out.Multiplier).UnmarshalJSON(data)) + } + case "size": + if data := in.Raw(); in.Ok() { + in.AddError((out.Size).UnmarshalJSON(data)) + } + case "open_interest": + if in.IsNull() { + in.Skip() + out.OpenInterest = nil + } else { + if out.OpenInterest == nil { + out.OpenInterest = new(decimal.Decimal) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.OpenInterest).UnmarshalJSON(data)) + } + } + case "open_interest_date": + if in.IsNull() { + in.Skip() + out.OpenInterestDate = nil + } else { + if out.OpenInterestDate == nil { + out.OpenInterestDate = new(civil.Date) + } + if data := in.UnsafeBytes(); in.Ok() { + in.AddError((*out.OpenInterestDate).UnmarshalText(data)) + } + } + case "close_price": + if in.IsNull() { + in.Skip() + out.ClosePrice = nil + } else { + if out.ClosePrice == nil { + out.ClosePrice = new(decimal.Decimal) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.ClosePrice).UnmarshalJSON(data)) + } + } + case "close_price_date": + if in.IsNull() { + in.Skip() + out.ClosePriceDate = nil + } else { + if out.ClosePriceDate == nil { + out.ClosePriceDate = new(civil.Date) + } + if data := in.UnsafeBytes(); in.Ok() { + in.AddError((*out.ClosePriceDate).UnmarshalText(data)) + } + } + case "deliverables": + if in.IsNull() { + in.Skip() + out.Deliverables = nil + } else { + in.Delim('[') + if out.Deliverables == nil { + if !in.IsDelim(']') { + out.Deliverables = make([]OptionDeliverable, 0, 0) + } else { + out.Deliverables = []OptionDeliverable{} + } + } else { + out.Deliverables = (out.Deliverables)[:0] + } + for !in.IsDelim(']') { + var v49 OptionDeliverable + (v49).UnmarshalEasyJSON(in) + out.Deliverables = append(out.Deliverables, v49) + in.WantComma() + } + in.Delim(']') + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(out *jwriter.Writer, in OptionContract) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + { + const prefix string = ",\"symbol\":" + out.RawString(prefix) + out.String(string(in.Symbol)) + } + { + const prefix string = ",\"name\":" + out.RawString(prefix) + out.String(string(in.Name)) + } + { + const prefix string = ",\"status\":" + out.RawString(prefix) + out.String(string(in.Status)) + } + { + const prefix string = ",\"tradable\":" + out.RawString(prefix) + out.Bool(bool(in.Tradable)) + } + { + const prefix string = ",\"expiration_date\":" + out.RawString(prefix) + out.RawText((in.ExpirationDate).MarshalText()) + } + if in.RootSymbol != nil { + const prefix string = ",\"root_symbol\":" + out.RawString(prefix) + out.String(string(*in.RootSymbol)) + } + { + const prefix string = ",\"underlying_symbol\":" + out.RawString(prefix) + out.String(string(in.UnderlyingSymbol)) + } + { + const prefix string = ",\"underlying_asset_id\":" + out.RawString(prefix) + out.String(string(in.UnderlyingAssetID)) + } + { + const prefix string = ",\"type\":" + out.RawString(prefix) + out.String(string(in.Type)) + } + { + const prefix string = ",\"style\":" + out.RawString(prefix) + out.String(string(in.Style)) + } + { + const prefix string = ",\"strike_price\":" + out.RawString(prefix) + out.Raw((in.StrikePrice).MarshalJSON()) + } + { + const prefix string = ",\"multiplier\":" + out.RawString(prefix) + out.Raw((in.Multiplier).MarshalJSON()) + } + { + const prefix string = ",\"size\":" + out.RawString(prefix) + out.Raw((in.Size).MarshalJSON()) + } + { + const prefix string = ",\"open_interest\":" + out.RawString(prefix) + if in.OpenInterest == nil { + out.RawString("null") + } else { + out.Raw((*in.OpenInterest).MarshalJSON()) + } + } + if in.OpenInterestDate != nil { + const prefix string = ",\"open_interest_date\":" + out.RawString(prefix) + out.RawText((*in.OpenInterestDate).MarshalText()) + } + if in.ClosePrice != nil { + const prefix string = ",\"close_price\":" + out.RawString(prefix) + out.Raw((*in.ClosePrice).MarshalJSON()) + } + if in.ClosePriceDate != nil { + const prefix string = ",\"close_price_date\":" + out.RawString(prefix) + out.RawText((*in.ClosePriceDate).MarshalText()) + } + if len(in.Deliverables) != 0 { + const prefix string = ",\"deliverables\":" + out.RawString(prefix) + { + out.RawByte('[') + for v50, v51 := range in.Deliverables { + if v50 > 0 { + out.RawByte(',') + } + (v51).MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v OptionContract) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v OptionContract) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *OptionContract) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *OptionContract) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(in *jlexer.Lexer, out *CreateWatchlistRequest) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "name": + out.Name = string(in.String()) + case "symbols": + if in.IsNull() { + in.Skip() + out.Symbols = nil + } else { + in.Delim('[') + if out.Symbols == nil { + if !in.IsDelim(']') { + out.Symbols = make([]string, 0, 4) + } else { + out.Symbols = []string{} + } + } else { + out.Symbols = (out.Symbols)[:0] + } + for !in.IsDelim(']') { + var v52 string + v52 = string(in.String()) + out.Symbols = append(out.Symbols, v52) + in.WantComma() + } + in.Delim(']') + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(out *jwriter.Writer, in CreateWatchlistRequest) { out.RawByte('{') first := true _ = first @@ -2247,11 +2770,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(out *jwri out.RawString("null") } else { out.RawByte('[') - for v47, v48 := range in.Symbols { - if v47 > 0 { + for v53, v54 := range in.Symbols { + if v53 > 0 { out.RawByte(',') } - out.String(string(v48)) + out.String(string(v54)) } out.RawByte(']') } @@ -2262,27 +2785,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(out *jwri // MarshalJSON supports json.Marshaler interface func (v CreateWatchlistRequest) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v CreateWatchlistRequest) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *CreateWatchlistRequest) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *CreateWatchlistRequest) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(in *jlexer.Lexer, out *Clock) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(in *jlexer.Lexer, out *Clock) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2325,7 +2848,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(out *jwriter.Writer, in Clock) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(out *jwriter.Writer, in Clock) { out.RawByte('{') first := true _ = first @@ -2355,27 +2878,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(out *jwri // MarshalJSON supports json.Marshaler interface func (v Clock) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Clock) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Clock) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Clock) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(in *jlexer.Lexer, out *CalendarDay) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(in *jlexer.Lexer, out *CalendarDay) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2410,7 +2933,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(out *jwriter.Writer, in CalendarDay) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(out *jwriter.Writer, in CalendarDay) { out.RawByte('{') first := true _ = first @@ -2435,27 +2958,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(out *jwri // MarshalJSON supports json.Marshaler interface func (v CalendarDay) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v CalendarDay) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *CalendarDay) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *CalendarDay) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(in *jlexer.Lexer, out *Asset) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(in *jlexer.Lexer, out *Asset) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2514,9 +3037,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(in *jlexe out.Attributes = (out.Attributes)[:0] } for !in.IsDelim(']') { - var v49 string - v49 = string(in.String()) - out.Attributes = append(out.Attributes, v49) + var v55 string + v55 = string(in.String()) + out.Attributes = append(out.Attributes, v55) in.WantComma() } in.Delim(']') @@ -2531,7 +3054,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(out *jwriter.Writer, in Asset) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(out *jwriter.Writer, in Asset) { out.RawByte('{') first := true _ = first @@ -2602,11 +3125,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(out *jwri out.RawString("null") } else { out.RawByte('[') - for v50, v51 := range in.Attributes { - if v50 > 0 { + for v56, v57 := range in.Attributes { + if v56 > 0 { out.RawByte(',') } - out.String(string(v51)) + out.String(string(v57)) } out.RawByte(']') } @@ -2617,27 +3140,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(out *jwri // MarshalJSON supports json.Marshaler interface func (v Asset) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Asset) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Asset) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Asset) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(in *jlexer.Lexer, out *Announcement) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(in *jlexer.Lexer, out *Announcement) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2696,7 +3219,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(out *jwriter.Writer, in Announcement) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(out *jwriter.Writer, in Announcement) { out.RawByte('{') first := true _ = first @@ -2781,27 +3304,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(out *jwri // MarshalJSON supports json.Marshaler interface func (v Announcement) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Announcement) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Announcement) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Announcement) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(in *jlexer.Lexer, out *AddSymbolToWatchlistRequest) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(in *jlexer.Lexer, out *AddSymbolToWatchlistRequest) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2832,7 +3355,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(out *jwriter.Writer, in AddSymbolToWatchlistRequest) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(out *jwriter.Writer, in AddSymbolToWatchlistRequest) { out.RawByte('{') first := true _ = first @@ -2847,27 +3370,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(out *jwri // MarshalJSON supports json.Marshaler interface func (v AddSymbolToWatchlistRequest) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v AddSymbolToWatchlistRequest) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *AddSymbolToWatchlistRequest) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *AddSymbolToWatchlistRequest) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(in *jlexer.Lexer, out *AccountConfigurations) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(in *jlexer.Lexer, out *AccountConfigurations) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2904,7 +3427,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(out *jwriter.Writer, in AccountConfigurations) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(out *jwriter.Writer, in AccountConfigurations) { out.RawByte('{') first := true _ = first @@ -2934,27 +3457,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(out *jwri // MarshalJSON supports json.Marshaler interface func (v AccountConfigurations) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v AccountConfigurations) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *AccountConfigurations) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *AccountConfigurations) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(in *jlexer.Lexer, out *AccountActivity) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca26(in *jlexer.Lexer, out *AccountActivity) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -3033,7 +3556,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(out *jwriter.Writer, in AccountActivity) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca26(out *jwriter.Writer, in AccountActivity) { out.RawByte('{') first := true _ = first @@ -3128,27 +3651,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(out *jwri // MarshalJSON supports json.Marshaler interface func (v AccountActivity) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca26(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v AccountActivity) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca26(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *AccountActivity) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca26(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *AccountActivity) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca26(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(in *jlexer.Lexer, out *Account) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca27(in *jlexer.Lexer, out *Account) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -3283,7 +3806,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(out *jwriter.Writer, in Account) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca27(out *jwriter.Writer, in Account) { out.RawByte('{') first := true _ = first @@ -3458,27 +3981,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(out *jwri // MarshalJSON supports json.Marshaler interface func (v Account) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca27(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Account) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca27(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Account) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca27(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Account) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca27(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(in *jlexer.Lexer, out *APIError) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca28(in *jlexer.Lexer, out *APIError) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -3511,7 +4034,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(out *jwriter.Writer, in APIError) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca28(out *jwriter.Writer, in APIError) { out.RawByte('{') first := true _ = first @@ -3536,23 +4059,23 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(out *jwri // MarshalJSON supports json.Marshaler interface func (v APIError) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca28(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v APIError) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca28(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *APIError) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca28(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *APIError) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca28(l, v) } diff --git a/alpaca/rest.go b/alpaca/rest.go index 4846e5e..24b782d 100644 --- a/alpaca/rest.go +++ b/alpaca/rest.go @@ -13,6 +13,7 @@ import ( "strings" "time" + "cloud.google.com/go/civil" "github.com/mailru/easyjson" "github.com/shopspring/decimal" ) @@ -742,6 +743,155 @@ func (c *Client) GetAsset(symbol string) (*Asset, error) { return &asset, nil } +const ( + optionContractsRequestsMaxLimit = 10000 +) + +func setQueryLimit(q url.Values, totalLimit, pageLimit, received, maxLimit int) { + limit := 0 // use server side default if unset + if pageLimit != 0 { + limit = pageLimit + } + if totalLimit != 0 { + remaining := totalLimit - received + if remaining <= 0 { // this should never happen + return + } + if (limit == 0 || limit > remaining) && remaining <= maxLimit { + limit = remaining + } + } + + if limit != 0 { + q.Set("limit", strconv.Itoa(limit)) + } +} + +type GetOptionContractsRequest struct { + UnderlyingSymbols string + ShowDeliverable bool + Status OptionStatus + ExpirationDate civil.Date + ExpirationDateGTE civil.Date + ExpirationDateLTE civil.Date + RootSymbol string + Type OptionType + Style OptionStyle + StrikePriceGTE decimal.Decimal + StrikePriceLTE decimal.Decimal + PennyProgramIndicator bool + PageLimit int + TotalLimit int +} + +// GetOptionContracts returns the list of Option Contracts. +func (c *Client) GetOptionContracts(req GetOptionContractsRequest) ([]OptionContract, error) { + u, err := url.Parse(fmt.Sprintf("%s/%s/options/contracts", c.opts.BaseURL, apiVersion)) + if err != nil { + return nil, err + } + + q := u.Query() + + if req.UnderlyingSymbols != "" { + q.Set("underlying_symbols", req.UnderlyingSymbols) + } + + q.Set("show_deliverables", strconv.FormatBool(req.ShowDeliverable)) + + if req.Status != "" { + q.Set("status", string(req.Status)) + } + + if !req.ExpirationDate.IsZero() { + q.Set("expiration_date", req.ExpirationDate.String()) + } + + if !req.ExpirationDateGTE.IsZero() { + q.Set("expiration_date_gte", req.ExpirationDateGTE.String()) + } + + if !req.ExpirationDateLTE.IsZero() { + q.Set("expiration_date_lte", req.ExpirationDateLTE.String()) + } + + if req.RootSymbol != "" { + q.Set("root_symbol", req.RootSymbol) + } + + if req.Type != "" { + q.Set("type", string(req.Type)) + } + + if req.Style != "" { + q.Set("style", string(req.Style)) + } + + if !req.StrikePriceLTE.IsZero() { + q.Set("strike_price_lte", req.StrikePriceLTE.String()) + } + + if !req.StrikePriceGTE.IsZero() { + q.Set("strike_price_gte", req.StrikePriceGTE.String()) + } + + if req.PennyProgramIndicator { + q.Set("ppind", "true") + } + + optionContracts := make([]OptionContract, 0) + for req.TotalLimit == 0 || len(optionContracts) < req.TotalLimit { + setQueryLimit(q, + req.TotalLimit, + req.PageLimit, + len(optionContracts), + optionContractsRequestsMaxLimit) + + u.RawQuery = q.Encode() + + resp, err := c.get(u) + if err != nil { + return nil, err + } + + var response optionContractsResponse + if err = unmarshal(resp, &response); err != nil { + return nil, err + } + + optionContracts = append(optionContracts, response.OptionContracts...) + + if response.NextPageToken == nil { + break + } + + q.Set("page_token", *response.NextPageToken) + closeResp(resp) + } + + return optionContracts, nil +} + +// GetOptionContract returns an option contract by symbol or contract ID. +func (c *Client) GetOptionContract(symbolOrID string) (*OptionContract, error) { + u, err := url.Parse(fmt.Sprintf("%s/%s/options/contracts/%v", c.opts.BaseURL, apiVersion, symbolOrID)) + if err != nil { + return nil, err + } + + resp, err := c.get(u) + if err != nil { + return nil, err + } + defer closeResp(resp) + + var optionContract OptionContract + if err = unmarshal(resp, &optionContract); err != nil { + return nil, err + } + return &optionContract, nil +} + type GetAnnouncementsRequest struct { CATypes []string `json:"ca_types"` Since time.Time `json:"since"` @@ -1047,6 +1197,16 @@ func GetAsset(symbol string) (*Asset, error) { return DefaultClient.GetAsset(symbol) } +// GetOptionContracts returns the list of Option Contracts. +func GetOptionContracts(req GetOptionContractsRequest) ([]OptionContract, error) { + return DefaultClient.GetOptionContracts(req) +} + +// GetOptionContract returns an option contract by symbol or contract ID. +func GetOptionContract(symbolOrID string) (*OptionContract, error) { + return DefaultClient.GetOptionContract(symbolOrID) +} + // GetAnnouncements returns a list of announcements // with the default Alpaca client. func GetAnnouncements(req GetAnnouncementsRequest) ([]Announcement, error) { diff --git a/alpaca/rest_test.go b/alpaca/rest_test.go index 2a8afc6..d9261fd 100644 --- a/alpaca/rest_test.go +++ b/alpaca/rest_test.go @@ -9,6 +9,7 @@ import ( "io" "net/http" "net/http/httptest" + "strconv" "strings" "testing" "time" @@ -908,6 +909,115 @@ func TestGetAssetFromJSON(t *testing.T) { assert.Nil(t, asset) } +func TestGetOptionContracts(t *testing.T) { + c := DefaultClient + // successful case with simple query + request := GetOptionContractsRequest{ + UnderlyingSymbols: "some_symbol1,some_symbol2", + } + expectedID := "some_id" + c.do = func(_ *Client, req *http.Request) (*http.Response, error) { + assert.Equal(t, request.UnderlyingSymbols, req.URL.Query().Get("underlying_symbols")) + response := optionContractsResponse{ + OptionContracts: []OptionContract{ + { + ID: expectedID, + ExpirationDate: civil.Date{Year: 1, Month: 1, Day: 1}, + }, + }, + } + return &http.Response{ + Body: genBody(response), + }, nil + } + + contracts, err := c.GetOptionContracts(request) + require.NoError(t, err) + require.Len(t, contracts, 1) + assert.Equal(t, expectedID, contracts[0].ID) + + // successful case with more paramters + request = GetOptionContractsRequest{ + UnderlyingSymbols: "some_symbol", + ShowDeliverable: true, + Status: OptionStatusActive, + ExpirationDate: civil.Date{Year: 2000, Month: 01, Day: 01}, + RootSymbol: "some_symbol", + Type: OptionTypeCall, + Style: OptionStyleEuropean, + StrikePriceGTE: decimal.NewFromInt(10), + TotalLimit: 1, + PennyProgramIndicator: true, + } + c.do = func(_ *Client, req *http.Request) (*http.Response, error) { + assert.Equal(t, request.UnderlyingSymbols, req.URL.Query().Get("underlying_symbols")) + assert.Equal(t, strconv.FormatBool(request.ShowDeliverable), req.URL.Query().Get("show_deliverables")) + assert.Equal(t, string(request.Status), req.URL.Query().Get("status")) + assert.Equal(t, request.ExpirationDate.String(), req.URL.Query().Get("expiration_date")) + assert.Equal(t, request.RootSymbol, req.URL.Query().Get("root_symbol")) + assert.Equal(t, string(request.Type), req.URL.Query().Get("type")) + assert.Equal(t, string(request.Style), req.URL.Query().Get("style")) + assert.Equal(t, request.StrikePriceGTE.String(), req.URL.Query().Get("strike_price_gte")) + assert.Equal(t, strconv.Itoa(request.TotalLimit), req.URL.Query().Get("limit")) + assert.Equal(t, strconv.FormatBool(request.PennyProgramIndicator), req.URL.Query().Get("ppind")) + + assets := optionContractsResponse{ + OptionContracts: []OptionContract{ + { + ID: expectedID, + ExpirationDate: civil.Date{Year: 1, Month: 1, Day: 1}, + }, + }, + } + return &http.Response{ + Body: genBody(assets), + }, nil + } + + contracts, err = c.GetOptionContracts(request) + require.NoError(t, err) + require.Len(t, contracts, 1) + assert.Equal(t, expectedID, contracts[0].ID) + + // api failure + c.do = func(_ *Client, _ *http.Request) (*http.Response, error) { + return &http.Response{}, errors.New("fail") + } + + _, err = c.GetOptionContracts(GetOptionContractsRequest{}) + require.Error(t, err) +} + +func TestGetOptionContract(t *testing.T) { + c := DefaultClient + // successful case + expectedSymbol := "some_symbol" + expectedID := "some_id" + c.do = func(_ *Client, req *http.Request) (*http.Response, error) { + assert.True(t, strings.HasSuffix(req.URL.Path, expectedSymbol)) + + return &http.Response{ + Body: genBody(OptionContract{ + ID: expectedID, + ExpirationDate: civil.Date{Year: 1, Month: 1, Day: 1}, + }), + }, nil + } + + contract, err := c.GetOptionContract(expectedSymbol) + require.NoError(t, err) + require.NotNil(t, contract) + assert.Equal(t, expectedID, contract.ID) + + // api failure + c.do = func(_ *Client, _ *http.Request) (*http.Response, error) { + return &http.Response{}, errors.New("fail") + } + + _, err = c.GetOptionContract(expectedSymbol) + require.Error(t, err) +} + func TestTestVerify(t *testing.T) { // 200 resp := &http.Response{