diff --git a/alpaca/entities.go b/alpaca/entities.go index d6023be..2a3a60a 100644 --- a/alpaca/entities.go +++ b/alpaca/entities.go @@ -16,7 +16,7 @@ import ( ) //go:generate go install github.com/mailru/easyjson/...@v0.7.7 -//go:generate easyjson -all -lower_camel_case $GOFILE +//go:generate easyjson -all -snake_case $GOFILE type Account struct { ID string `json:"id"` diff --git a/marketdata/stream/entities.go b/marketdata/stream/entities.go index 3932fdd..f1ca4e8 100644 --- a/marketdata/stream/entities.go +++ b/marketdata/stream/entities.go @@ -6,6 +6,9 @@ import ( "github.com/alpacahq/alpaca-trade-api-go/v3/marketdata" ) +//go:generate go install github.com/mailru/easyjson/...@v0.7.7 +//go:generate easyjson -all -snake_case $GOFILE + // Trade is a stock trade that happened on the market type Trade struct { ID int64 diff --git a/marketdata/stream/entities_easyjson.go b/marketdata/stream/entities_easyjson.go new file mode 100644 index 0000000..03fe3a1 --- /dev/null +++ b/marketdata/stream/entities_easyjson.go @@ -0,0 +1,1938 @@ +// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. + +package stream + +import ( + json "encoding/json" + easyjson "github.com/mailru/easyjson" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +// suppress unused package warning +var ( + _ *json.RawMessage + _ *jlexer.Lexer + _ *jwriter.Writer + _ easyjson.Marshaler +) + +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream(in *jlexer.Lexer, out *tradeInternal) { + 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 "received_at": + if data := in.Raw(); in.Ok() { + in.AddError((out.ReceivedAt).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream(out *jwriter.Writer, in tradeInternal) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"received_at\":" + out.RawString(prefix[1:]) + out.Raw((in.ReceivedAt).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v tradeInternal) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v tradeInternal) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *tradeInternal) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *tradeInternal) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream1(in *jlexer.Lexer, out *quoteInternal) { + 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 "received_at": + if data := in.Raw(); in.Ok() { + in.AddError((out.ReceivedAt).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream1(out *jwriter.Writer, in quoteInternal) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"received_at\":" + out.RawString(prefix[1:]) + out.Raw((in.ReceivedAt).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v quoteInternal) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream1(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v quoteInternal) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream1(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *quoteInternal) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream1(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *quoteInternal) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream1(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream2(in *jlexer.Lexer, out *errorMessage) { + 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 { + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream2(out *jwriter.Writer, in errorMessage) { + out.RawByte('{') + first := true + _ = first + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v errorMessage) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream2(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v errorMessage) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream2(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *errorMessage) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream2(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *errorMessage) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream2(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream3(in *jlexer.Lexer, out *TradingStatus) { + 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 "symbol": + out.Symbol = string(in.String()) + case "status_code": + out.StatusCode = string(in.String()) + case "status_msg": + out.StatusMsg = string(in.String()) + case "reason_code": + out.ReasonCode = string(in.String()) + case "reason_msg": + out.ReasonMsg = string(in.String()) + case "timestamp": + if data := in.Raw(); in.Ok() { + in.AddError((out.Timestamp).UnmarshalJSON(data)) + } + case "tape": + out.Tape = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream3(out *jwriter.Writer, in TradingStatus) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"symbol\":" + out.RawString(prefix[1:]) + out.String(string(in.Symbol)) + } + { + const prefix string = ",\"status_code\":" + out.RawString(prefix) + out.String(string(in.StatusCode)) + } + { + const prefix string = ",\"status_msg\":" + out.RawString(prefix) + out.String(string(in.StatusMsg)) + } + { + const prefix string = ",\"reason_code\":" + out.RawString(prefix) + out.String(string(in.ReasonCode)) + } + { + const prefix string = ",\"reason_msg\":" + out.RawString(prefix) + out.String(string(in.ReasonMsg)) + } + { + const prefix string = ",\"timestamp\":" + out.RawString(prefix) + out.Raw((in.Timestamp).MarshalJSON()) + } + { + const prefix string = ",\"tape\":" + out.RawString(prefix) + out.String(string(in.Tape)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v TradingStatus) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream3(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v TradingStatus) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream3(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *TradingStatus) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream3(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *TradingStatus) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream3(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream4(in *jlexer.Lexer, out *TradeCorrection) { + 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 "symbol": + out.Symbol = string(in.String()) + case "exchange": + out.Exchange = string(in.String()) + case "original_id": + out.OriginalID = int64(in.Int64()) + case "original_price": + out.OriginalPrice = float64(in.Float64()) + case "original_size": + out.OriginalSize = uint32(in.Uint32()) + case "original_conditions": + if in.IsNull() { + in.Skip() + out.OriginalConditions = nil + } else { + in.Delim('[') + if out.OriginalConditions == nil { + if !in.IsDelim(']') { + out.OriginalConditions = make([]string, 0, 4) + } else { + out.OriginalConditions = []string{} + } + } else { + out.OriginalConditions = (out.OriginalConditions)[:0] + } + for !in.IsDelim(']') { + var v1 string + v1 = string(in.String()) + out.OriginalConditions = append(out.OriginalConditions, v1) + in.WantComma() + } + in.Delim(']') + } + case "corrected_id": + out.CorrectedID = int64(in.Int64()) + case "corrected_price": + out.CorrectedPrice = float64(in.Float64()) + case "corrected_size": + out.CorrectedSize = uint32(in.Uint32()) + case "corrected_conditions": + if in.IsNull() { + in.Skip() + out.CorrectedConditions = nil + } else { + in.Delim('[') + if out.CorrectedConditions == nil { + if !in.IsDelim(']') { + out.CorrectedConditions = make([]string, 0, 4) + } else { + out.CorrectedConditions = []string{} + } + } else { + out.CorrectedConditions = (out.CorrectedConditions)[:0] + } + for !in.IsDelim(']') { + var v2 string + v2 = string(in.String()) + out.CorrectedConditions = append(out.CorrectedConditions, v2) + in.WantComma() + } + in.Delim(']') + } + case "tape": + out.Tape = string(in.String()) + case "timestamp": + if data := in.Raw(); in.Ok() { + in.AddError((out.Timestamp).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream4(out *jwriter.Writer, in TradeCorrection) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"symbol\":" + out.RawString(prefix[1:]) + out.String(string(in.Symbol)) + } + { + const prefix string = ",\"exchange\":" + out.RawString(prefix) + out.String(string(in.Exchange)) + } + { + const prefix string = ",\"original_id\":" + out.RawString(prefix) + out.Int64(int64(in.OriginalID)) + } + { + const prefix string = ",\"original_price\":" + out.RawString(prefix) + out.Float64(float64(in.OriginalPrice)) + } + { + const prefix string = ",\"original_size\":" + out.RawString(prefix) + out.Uint32(uint32(in.OriginalSize)) + } + { + const prefix string = ",\"original_conditions\":" + out.RawString(prefix) + if in.OriginalConditions == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v3, v4 := range in.OriginalConditions { + if v3 > 0 { + out.RawByte(',') + } + out.String(string(v4)) + } + out.RawByte(']') + } + } + { + const prefix string = ",\"corrected_id\":" + out.RawString(prefix) + out.Int64(int64(in.CorrectedID)) + } + { + const prefix string = ",\"corrected_price\":" + out.RawString(prefix) + out.Float64(float64(in.CorrectedPrice)) + } + { + const prefix string = ",\"corrected_size\":" + out.RawString(prefix) + out.Uint32(uint32(in.CorrectedSize)) + } + { + const prefix string = ",\"corrected_conditions\":" + out.RawString(prefix) + if in.CorrectedConditions == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v5, v6 := range in.CorrectedConditions { + if v5 > 0 { + out.RawByte(',') + } + out.String(string(v6)) + } + out.RawByte(']') + } + } + { + const prefix string = ",\"tape\":" + out.RawString(prefix) + out.String(string(in.Tape)) + } + { + const prefix string = ",\"timestamp\":" + out.RawString(prefix) + out.Raw((in.Timestamp).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v TradeCorrection) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream4(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v TradeCorrection) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream4(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *TradeCorrection) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream4(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *TradeCorrection) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream4(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream5(in *jlexer.Lexer, out *TradeCancelError) { + 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 "symbol": + out.Symbol = string(in.String()) + case "id": + out.ID = int64(in.Int64()) + case "exchange": + out.Exchange = string(in.String()) + case "price": + out.Price = float64(in.Float64()) + case "size": + out.Size = uint32(in.Uint32()) + case "cancel_error_action": + out.CancelErrorAction = string(in.String()) + case "tape": + out.Tape = string(in.String()) + case "timestamp": + if data := in.Raw(); in.Ok() { + in.AddError((out.Timestamp).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream5(out *jwriter.Writer, in TradeCancelError) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"symbol\":" + out.RawString(prefix[1:]) + out.String(string(in.Symbol)) + } + { + const prefix string = ",\"id\":" + out.RawString(prefix) + out.Int64(int64(in.ID)) + } + { + const prefix string = ",\"exchange\":" + out.RawString(prefix) + out.String(string(in.Exchange)) + } + { + const prefix string = ",\"price\":" + out.RawString(prefix) + out.Float64(float64(in.Price)) + } + { + const prefix string = ",\"size\":" + out.RawString(prefix) + out.Uint32(uint32(in.Size)) + } + { + const prefix string = ",\"cancel_error_action\":" + out.RawString(prefix) + out.String(string(in.CancelErrorAction)) + } + { + const prefix string = ",\"tape\":" + out.RawString(prefix) + out.String(string(in.Tape)) + } + { + const prefix string = ",\"timestamp\":" + out.RawString(prefix) + out.Raw((in.Timestamp).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v TradeCancelError) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream5(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v TradeCancelError) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream5(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *TradeCancelError) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream5(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *TradeCancelError) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream5(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream6(in *jlexer.Lexer, out *Trade) { + 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 = int64(in.Int64()) + case "symbol": + out.Symbol = string(in.String()) + case "exchange": + out.Exchange = string(in.String()) + case "price": + out.Price = float64(in.Float64()) + case "size": + out.Size = uint32(in.Uint32()) + case "timestamp": + if data := in.Raw(); in.Ok() { + in.AddError((out.Timestamp).UnmarshalJSON(data)) + } + case "conditions": + if in.IsNull() { + in.Skip() + out.Conditions = nil + } else { + in.Delim('[') + if out.Conditions == nil { + if !in.IsDelim(']') { + out.Conditions = make([]string, 0, 4) + } else { + out.Conditions = []string{} + } + } else { + out.Conditions = (out.Conditions)[:0] + } + for !in.IsDelim(']') { + var v7 string + v7 = string(in.String()) + out.Conditions = append(out.Conditions, v7) + in.WantComma() + } + in.Delim(']') + } + case "tape": + out.Tape = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream6(out *jwriter.Writer, in Trade) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.Int64(int64(in.ID)) + } + { + const prefix string = ",\"symbol\":" + out.RawString(prefix) + out.String(string(in.Symbol)) + } + { + const prefix string = ",\"exchange\":" + out.RawString(prefix) + out.String(string(in.Exchange)) + } + { + const prefix string = ",\"price\":" + out.RawString(prefix) + out.Float64(float64(in.Price)) + } + { + const prefix string = ",\"size\":" + out.RawString(prefix) + out.Uint32(uint32(in.Size)) + } + { + const prefix string = ",\"timestamp\":" + out.RawString(prefix) + out.Raw((in.Timestamp).MarshalJSON()) + } + { + const prefix string = ",\"conditions\":" + out.RawString(prefix) + if in.Conditions == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v8, v9 := range in.Conditions { + if v8 > 0 { + out.RawByte(',') + } + out.String(string(v9)) + } + out.RawByte(']') + } + } + { + const prefix string = ",\"tape\":" + out.RawString(prefix) + out.String(string(in.Tape)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Trade) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream6(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Trade) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream6(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Trade) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream6(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Trade) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream6(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream7(in *jlexer.Lexer, out *Quote) { + 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 "symbol": + out.Symbol = string(in.String()) + case "bid_exchange": + out.BidExchange = string(in.String()) + case "bid_price": + out.BidPrice = float64(in.Float64()) + case "bid_size": + out.BidSize = uint32(in.Uint32()) + case "ask_exchange": + out.AskExchange = string(in.String()) + case "ask_price": + out.AskPrice = float64(in.Float64()) + case "ask_size": + out.AskSize = uint32(in.Uint32()) + case "timestamp": + if data := in.Raw(); in.Ok() { + in.AddError((out.Timestamp).UnmarshalJSON(data)) + } + case "conditions": + if in.IsNull() { + in.Skip() + out.Conditions = nil + } else { + in.Delim('[') + if out.Conditions == nil { + if !in.IsDelim(']') { + out.Conditions = make([]string, 0, 4) + } else { + out.Conditions = []string{} + } + } else { + out.Conditions = (out.Conditions)[:0] + } + for !in.IsDelim(']') { + var v10 string + v10 = string(in.String()) + out.Conditions = append(out.Conditions, v10) + in.WantComma() + } + in.Delim(']') + } + case "tape": + out.Tape = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream7(out *jwriter.Writer, in Quote) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"symbol\":" + out.RawString(prefix[1:]) + out.String(string(in.Symbol)) + } + { + const prefix string = ",\"bid_exchange\":" + out.RawString(prefix) + out.String(string(in.BidExchange)) + } + { + const prefix string = ",\"bid_price\":" + out.RawString(prefix) + out.Float64(float64(in.BidPrice)) + } + { + const prefix string = ",\"bid_size\":" + out.RawString(prefix) + out.Uint32(uint32(in.BidSize)) + } + { + const prefix string = ",\"ask_exchange\":" + out.RawString(prefix) + out.String(string(in.AskExchange)) + } + { + const prefix string = ",\"ask_price\":" + out.RawString(prefix) + out.Float64(float64(in.AskPrice)) + } + { + const prefix string = ",\"ask_size\":" + out.RawString(prefix) + out.Uint32(uint32(in.AskSize)) + } + { + const prefix string = ",\"timestamp\":" + out.RawString(prefix) + out.Raw((in.Timestamp).MarshalJSON()) + } + { + const prefix string = ",\"conditions\":" + out.RawString(prefix) + if in.Conditions == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v11, v12 := range in.Conditions { + if v11 > 0 { + out.RawByte(',') + } + out.String(string(v12)) + } + out.RawByte(']') + } + } + { + const prefix string = ",\"tape\":" + out.RawString(prefix) + out.String(string(in.Tape)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Quote) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream7(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Quote) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream7(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Quote) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream7(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Quote) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream7(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream8(in *jlexer.Lexer, out *News) { + 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 = int(in.Int()) + case "author": + out.Author = string(in.String()) + case "created_at": + if data := in.Raw(); in.Ok() { + in.AddError((out.CreatedAt).UnmarshalJSON(data)) + } + case "updated_at": + if data := in.Raw(); in.Ok() { + in.AddError((out.UpdatedAt).UnmarshalJSON(data)) + } + case "headline": + out.Headline = string(in.String()) + case "summary": + out.Summary = string(in.String()) + case "content": + out.Content = string(in.String()) + case "url": + out.URL = 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 v13 string + v13 = string(in.String()) + out.Symbols = append(out.Symbols, v13) + in.WantComma() + } + in.Delim(']') + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream8(out *jwriter.Writer, in News) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.Int(int(in.ID)) + } + { + const prefix string = ",\"author\":" + out.RawString(prefix) + out.String(string(in.Author)) + } + { + const prefix string = ",\"created_at\":" + out.RawString(prefix) + out.Raw((in.CreatedAt).MarshalJSON()) + } + { + const prefix string = ",\"updated_at\":" + out.RawString(prefix) + out.Raw((in.UpdatedAt).MarshalJSON()) + } + { + const prefix string = ",\"headline\":" + out.RawString(prefix) + out.String(string(in.Headline)) + } + { + const prefix string = ",\"summary\":" + out.RawString(prefix) + out.String(string(in.Summary)) + } + { + const prefix string = ",\"content\":" + out.RawString(prefix) + out.String(string(in.Content)) + } + { + const prefix string = ",\"url\":" + out.RawString(prefix) + out.String(string(in.URL)) + } + { + const prefix string = ",\"symbols\":" + out.RawString(prefix) + if in.Symbols == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v14, v15 := range in.Symbols { + if v14 > 0 { + out.RawByte(',') + } + out.String(string(v15)) + } + out.RawByte(']') + } + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v News) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream8(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v News) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream8(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *News) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream8(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *News) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream8(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream9(in *jlexer.Lexer, out *LULD) { + 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 "symbol": + out.Symbol = string(in.String()) + case "limit_up_price": + out.LimitUpPrice = float64(in.Float64()) + case "limit_down_price": + out.LimitDownPrice = float64(in.Float64()) + case "indicator": + out.Indicator = string(in.String()) + case "timestamp": + if data := in.Raw(); in.Ok() { + in.AddError((out.Timestamp).UnmarshalJSON(data)) + } + case "tape": + out.Tape = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream9(out *jwriter.Writer, in LULD) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"symbol\":" + out.RawString(prefix[1:]) + out.String(string(in.Symbol)) + } + { + const prefix string = ",\"limit_up_price\":" + out.RawString(prefix) + out.Float64(float64(in.LimitUpPrice)) + } + { + const prefix string = ",\"limit_down_price\":" + out.RawString(prefix) + out.Float64(float64(in.LimitDownPrice)) + } + { + const prefix string = ",\"indicator\":" + out.RawString(prefix) + out.String(string(in.Indicator)) + } + { + const prefix string = ",\"timestamp\":" + out.RawString(prefix) + out.Raw((in.Timestamp).MarshalJSON()) + } + { + const prefix string = ",\"tape\":" + out.RawString(prefix) + out.String(string(in.Tape)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v LULD) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream9(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v LULD) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream9(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *LULD) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream9(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *LULD) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream9(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream10(in *jlexer.Lexer, out *CryptoTrade) { + 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 = int64(in.Int64()) + case "symbol": + out.Symbol = string(in.String()) + case "exchange": + out.Exchange = string(in.String()) + case "price": + out.Price = float64(in.Float64()) + case "size": + out.Size = float64(in.Float64()) + case "timestamp": + if data := in.Raw(); in.Ok() { + in.AddError((out.Timestamp).UnmarshalJSON(data)) + } + case "taker_side": + out.TakerSide = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream10(out *jwriter.Writer, in CryptoTrade) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.Int64(int64(in.ID)) + } + { + const prefix string = ",\"symbol\":" + out.RawString(prefix) + out.String(string(in.Symbol)) + } + { + const prefix string = ",\"exchange\":" + out.RawString(prefix) + out.String(string(in.Exchange)) + } + { + const prefix string = ",\"price\":" + out.RawString(prefix) + out.Float64(float64(in.Price)) + } + { + const prefix string = ",\"size\":" + out.RawString(prefix) + out.Float64(float64(in.Size)) + } + { + const prefix string = ",\"timestamp\":" + out.RawString(prefix) + out.Raw((in.Timestamp).MarshalJSON()) + } + { + const prefix string = ",\"taker_side\":" + out.RawString(prefix) + out.String(string(in.TakerSide)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v CryptoTrade) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream10(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v CryptoTrade) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream10(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *CryptoTrade) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream10(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *CryptoTrade) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream10(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream11(in *jlexer.Lexer, out *CryptoQuote) { + 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 "symbol": + out.Symbol = string(in.String()) + case "exchange": + out.Exchange = string(in.String()) + case "bid_price": + out.BidPrice = float64(in.Float64()) + case "bid_size": + out.BidSize = float64(in.Float64()) + case "ask_price": + out.AskPrice = float64(in.Float64()) + case "ask_size": + out.AskSize = float64(in.Float64()) + case "timestamp": + if data := in.Raw(); in.Ok() { + in.AddError((out.Timestamp).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream11(out *jwriter.Writer, in CryptoQuote) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"symbol\":" + out.RawString(prefix[1:]) + out.String(string(in.Symbol)) + } + { + const prefix string = ",\"exchange\":" + out.RawString(prefix) + out.String(string(in.Exchange)) + } + { + const prefix string = ",\"bid_price\":" + out.RawString(prefix) + out.Float64(float64(in.BidPrice)) + } + { + const prefix string = ",\"bid_size\":" + out.RawString(prefix) + out.Float64(float64(in.BidSize)) + } + { + const prefix string = ",\"ask_price\":" + out.RawString(prefix) + out.Float64(float64(in.AskPrice)) + } + { + const prefix string = ",\"ask_size\":" + out.RawString(prefix) + out.Float64(float64(in.AskSize)) + } + { + const prefix string = ",\"timestamp\":" + out.RawString(prefix) + out.Raw((in.Timestamp).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v CryptoQuote) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream11(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v CryptoQuote) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream11(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *CryptoQuote) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream11(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *CryptoQuote) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream11(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream12(in *jlexer.Lexer, out *CryptoOrderbookEntry) { + 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 "price": + out.Price = float64(in.Float64()) + case "size": + out.Size = float64(in.Float64()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream12(out *jwriter.Writer, in CryptoOrderbookEntry) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"price\":" + out.RawString(prefix[1:]) + out.Float64(float64(in.Price)) + } + { + const prefix string = ",\"size\":" + out.RawString(prefix) + out.Float64(float64(in.Size)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v CryptoOrderbookEntry) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream12(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v CryptoOrderbookEntry) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream12(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *CryptoOrderbookEntry) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream12(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *CryptoOrderbookEntry) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream12(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream13(in *jlexer.Lexer, out *CryptoOrderbook) { + 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 "symbol": + out.Symbol = string(in.String()) + case "exchange": + out.Exchange = string(in.String()) + case "timestamp": + if data := in.Raw(); in.Ok() { + in.AddError((out.Timestamp).UnmarshalJSON(data)) + } + case "bids": + if in.IsNull() { + in.Skip() + out.Bids = nil + } else { + in.Delim('[') + if out.Bids == nil { + if !in.IsDelim(']') { + out.Bids = make([]CryptoOrderbookEntry, 0, 4) + } else { + out.Bids = []CryptoOrderbookEntry{} + } + } else { + out.Bids = (out.Bids)[:0] + } + for !in.IsDelim(']') { + var v16 CryptoOrderbookEntry + (v16).UnmarshalEasyJSON(in) + out.Bids = append(out.Bids, v16) + in.WantComma() + } + in.Delim(']') + } + case "asks": + if in.IsNull() { + in.Skip() + out.Asks = nil + } else { + in.Delim('[') + if out.Asks == nil { + if !in.IsDelim(']') { + out.Asks = make([]CryptoOrderbookEntry, 0, 4) + } else { + out.Asks = []CryptoOrderbookEntry{} + } + } else { + out.Asks = (out.Asks)[:0] + } + for !in.IsDelim(']') { + var v17 CryptoOrderbookEntry + (v17).UnmarshalEasyJSON(in) + out.Asks = append(out.Asks, v17) + in.WantComma() + } + in.Delim(']') + } + case "reset": + out.Reset = bool(in.Bool()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream13(out *jwriter.Writer, in CryptoOrderbook) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"symbol\":" + out.RawString(prefix[1:]) + out.String(string(in.Symbol)) + } + { + const prefix string = ",\"exchange\":" + out.RawString(prefix) + out.String(string(in.Exchange)) + } + { + const prefix string = ",\"timestamp\":" + out.RawString(prefix) + out.Raw((in.Timestamp).MarshalJSON()) + } + { + const prefix string = ",\"bids\":" + out.RawString(prefix) + if in.Bids == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v18, v19 := range in.Bids { + if v18 > 0 { + out.RawByte(',') + } + (v19).MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + { + const prefix string = ",\"asks\":" + out.RawString(prefix) + if in.Asks == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v20, v21 := range in.Asks { + if v20 > 0 { + out.RawByte(',') + } + (v21).MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + { + const prefix string = ",\"reset\":" + out.RawString(prefix) + out.Bool(bool(in.Reset)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v CryptoOrderbook) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream13(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v CryptoOrderbook) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream13(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *CryptoOrderbook) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream13(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *CryptoOrderbook) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream13(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream14(in *jlexer.Lexer, out *CryptoBar) { + 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 "symbol": + out.Symbol = string(in.String()) + case "exchange": + out.Exchange = string(in.String()) + case "open": + out.Open = float64(in.Float64()) + case "high": + out.High = float64(in.Float64()) + case "low": + out.Low = float64(in.Float64()) + case "close": + out.Close = float64(in.Float64()) + case "volume": + out.Volume = float64(in.Float64()) + case "timestamp": + if data := in.Raw(); in.Ok() { + in.AddError((out.Timestamp).UnmarshalJSON(data)) + } + case "trade_count": + out.TradeCount = uint64(in.Uint64()) + case "vwap": + out.VWAP = float64(in.Float64()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream14(out *jwriter.Writer, in CryptoBar) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"symbol\":" + out.RawString(prefix[1:]) + out.String(string(in.Symbol)) + } + { + const prefix string = ",\"exchange\":" + out.RawString(prefix) + out.String(string(in.Exchange)) + } + { + const prefix string = ",\"open\":" + out.RawString(prefix) + out.Float64(float64(in.Open)) + } + { + const prefix string = ",\"high\":" + out.RawString(prefix) + out.Float64(float64(in.High)) + } + { + const prefix string = ",\"low\":" + out.RawString(prefix) + out.Float64(float64(in.Low)) + } + { + const prefix string = ",\"close\":" + out.RawString(prefix) + out.Float64(float64(in.Close)) + } + { + const prefix string = ",\"volume\":" + out.RawString(prefix) + out.Float64(float64(in.Volume)) + } + { + const prefix string = ",\"timestamp\":" + out.RawString(prefix) + out.Raw((in.Timestamp).MarshalJSON()) + } + { + const prefix string = ",\"trade_count\":" + out.RawString(prefix) + out.Uint64(uint64(in.TradeCount)) + } + { + const prefix string = ",\"vwap\":" + out.RawString(prefix) + out.Float64(float64(in.VWAP)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v CryptoBar) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream14(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v CryptoBar) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream14(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *CryptoBar) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream14(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *CryptoBar) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream14(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream15(in *jlexer.Lexer, out *Bar) { + 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 "symbol": + out.Symbol = string(in.String()) + case "open": + out.Open = float64(in.Float64()) + case "high": + out.High = float64(in.Float64()) + case "low": + out.Low = float64(in.Float64()) + case "close": + out.Close = float64(in.Float64()) + case "volume": + out.Volume = uint64(in.Uint64()) + case "timestamp": + if data := in.Raw(); in.Ok() { + in.AddError((out.Timestamp).UnmarshalJSON(data)) + } + case "trade_count": + out.TradeCount = uint64(in.Uint64()) + case "vwap": + out.VWAP = float64(in.Float64()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream15(out *jwriter.Writer, in Bar) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"symbol\":" + out.RawString(prefix[1:]) + out.String(string(in.Symbol)) + } + { + const prefix string = ",\"open\":" + out.RawString(prefix) + out.Float64(float64(in.Open)) + } + { + const prefix string = ",\"high\":" + out.RawString(prefix) + out.Float64(float64(in.High)) + } + { + const prefix string = ",\"low\":" + out.RawString(prefix) + out.Float64(float64(in.Low)) + } + { + const prefix string = ",\"close\":" + out.RawString(prefix) + out.Float64(float64(in.Close)) + } + { + const prefix string = ",\"volume\":" + out.RawString(prefix) + out.Uint64(uint64(in.Volume)) + } + { + const prefix string = ",\"timestamp\":" + out.RawString(prefix) + out.Raw((in.Timestamp).MarshalJSON()) + } + { + const prefix string = ",\"trade_count\":" + out.RawString(prefix) + out.Uint64(uint64(in.TradeCount)) + } + { + const prefix string = ",\"vwap\":" + out.RawString(prefix) + out.Float64(float64(in.VWAP)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Bar) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream15(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Bar) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream15(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Bar) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream15(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Bar) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3MarketdataStream15(l, v) +}