From 9d0d1e528d3a834ea3301499f172a4bba5618df8 Mon Sep 17 00:00:00 2001 From: Sai G Date: Wed, 22 May 2024 10:54:05 -0400 Subject: [PATCH 1/5] Liquidate all positions response format --- alpaca/entities.go | 9 + alpaca/entities_easyjson.go | 542 +++++++++++++++++++++++------------- alpaca/rest.go | 10 +- 3 files changed, 364 insertions(+), 197 deletions(-) diff --git a/alpaca/entities.go b/alpaca/entities.go index f8ceecc..6803755 100644 --- a/alpaca/entities.go +++ b/alpaca/entities.go @@ -368,3 +368,12 @@ func (e *APIError) Error() string { } return fmt.Sprintf("%s (HTTP %d)", e.Message, e.StatusCode) } + +//easyjson:json +type closeAllPositionsSlice []CloseAllPositionsResponse + +type CloseAllPositionsResponse struct { + Symbol string `json:"symbol"` + Status int `json:"status"` + Body interface{} `json:"body,omitempty"` +} diff --git a/alpaca/entities_easyjson.go b/alpaca/entities_easyjson.go index 34a2aa8..fc880bc 100644 --- a/alpaca/entities_easyjson.go +++ b/alpaca/entities_easyjson.go @@ -217,7 +217,7 @@ func (v *orderSlice) UnmarshalJSON(data []byte) error { func (v *orderSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca2(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(in *jlexer.Lexer, out *calendarDaySlice) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(in *jlexer.Lexer, out *closeAllPositionsSlice) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() @@ -226,15 +226,15 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(in *jlexer in.Delim('[') if *out == nil { if !in.IsDelim(']') { - *out = make(calendarDaySlice, 0, 1) + *out = make(closeAllPositionsSlice, 0, 1) } else { - *out = calendarDaySlice{} + *out = closeAllPositionsSlice{} } } else { *out = (*out)[:0] } for !in.IsDelim(']') { - var v10 CalendarDay + var v10 CloseAllPositionsResponse (v10).UnmarshalEasyJSON(in) *out = append(*out, v10) in.WantComma() @@ -245,7 +245,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(out *jwriter.Writer, in calendarDaySlice) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(out *jwriter.Writer, in closeAllPositionsSlice) { if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { @@ -261,29 +261,29 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(out *jwrit } // MarshalJSON supports json.Marshaler interface -func (v calendarDaySlice) MarshalJSON() ([]byte, error) { +func (v closeAllPositionsSlice) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface -func (v calendarDaySlice) MarshalEasyJSON(w *jwriter.Writer) { +func (v closeAllPositionsSlice) MarshalEasyJSON(w *jwriter.Writer) { easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(w, v) } // UnmarshalJSON supports json.Unmarshaler interface -func (v *calendarDaySlice) UnmarshalJSON(data []byte) error { +func (v *closeAllPositionsSlice) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *calendarDaySlice) UnmarshalEasyJSON(l *jlexer.Lexer) { +func (v *closeAllPositionsSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(in *jlexer.Lexer, out *assetSlice) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(in *jlexer.Lexer, out *calendarDaySlice) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() @@ -292,15 +292,15 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(in *jlexer in.Delim('[') if *out == nil { if !in.IsDelim(']') { - *out = make(assetSlice, 0, 0) + *out = make(calendarDaySlice, 0, 1) } else { - *out = assetSlice{} + *out = calendarDaySlice{} } } else { *out = (*out)[:0] } for !in.IsDelim(']') { - var v13 Asset + var v13 CalendarDay (v13).UnmarshalEasyJSON(in) *out = append(*out, v13) in.WantComma() @@ -311,7 +311,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(out *jwriter.Writer, in assetSlice) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(out *jwriter.Writer, in calendarDaySlice) { if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { @@ -327,29 +327,29 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(out *jwrit } // MarshalJSON supports json.Marshaler interface -func (v assetSlice) MarshalJSON() ([]byte, error) { +func (v calendarDaySlice) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface -func (v assetSlice) MarshalEasyJSON(w *jwriter.Writer) { +func (v calendarDaySlice) MarshalEasyJSON(w *jwriter.Writer) { easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(w, v) } // UnmarshalJSON supports json.Unmarshaler interface -func (v *assetSlice) UnmarshalJSON(data []byte) error { +func (v *calendarDaySlice) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *assetSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { +func (v *calendarDaySlice) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(in *jlexer.Lexer, out *announcementSlice) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(in *jlexer.Lexer, out *assetSlice) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() @@ -358,15 +358,15 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(in *jlexer in.Delim('[') if *out == nil { if !in.IsDelim(']') { - *out = make(announcementSlice, 0, 0) + *out = make(assetSlice, 0, 0) } else { - *out = announcementSlice{} + *out = assetSlice{} } } else { *out = (*out)[:0] } for !in.IsDelim(']') { - var v16 Announcement + var v16 Asset (v16).UnmarshalEasyJSON(in) *out = append(*out, v16) in.WantComma() @@ -377,7 +377,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(out *jwriter.Writer, in announcementSlice) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(out *jwriter.Writer, in assetSlice) { if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { @@ -393,29 +393,29 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(out *jwrit } // MarshalJSON supports json.Marshaler interface -func (v announcementSlice) MarshalJSON() ([]byte, error) { +func (v assetSlice) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface -func (v announcementSlice) MarshalEasyJSON(w *jwriter.Writer) { +func (v assetSlice) MarshalEasyJSON(w *jwriter.Writer) { easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(w, v) } // UnmarshalJSON supports json.Unmarshaler interface -func (v *announcementSlice) UnmarshalJSON(data []byte) error { +func (v *assetSlice) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *announcementSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { +func (v *assetSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(in *jlexer.Lexer, out *accountSlice) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(in *jlexer.Lexer, out *announcementSlice) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() @@ -424,15 +424,15 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(in *jlexer in.Delim('[') if *out == nil { if !in.IsDelim(']') { - *out = make(accountSlice, 0, 0) + *out = make(announcementSlice, 0, 0) } else { - *out = accountSlice{} + *out = announcementSlice{} } } else { *out = (*out)[:0] } for !in.IsDelim(']') { - var v19 AccountActivity + var v19 Announcement (v19).UnmarshalEasyJSON(in) *out = append(*out, v19) in.WantComma() @@ -443,7 +443,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(out *jwriter.Writer, in accountSlice) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(out *jwriter.Writer, in announcementSlice) { if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { @@ -459,29 +459,95 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(out *jwrit } // MarshalJSON supports json.Marshaler interface -func (v accountSlice) MarshalJSON() ([]byte, error) { +func (v announcementSlice) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface -func (v accountSlice) MarshalEasyJSON(w *jwriter.Writer) { +func (v announcementSlice) MarshalEasyJSON(w *jwriter.Writer) { easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(w, v) } // UnmarshalJSON supports json.Unmarshaler interface -func (v *accountSlice) UnmarshalJSON(data []byte) error { +func (v *announcementSlice) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *accountSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { +func (v *announcementSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(in *jlexer.Lexer, out *Watchlist) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(in *jlexer.Lexer, out *accountSlice) { + isTopLevel := in.IsStart() + if in.IsNull() { + in.Skip() + *out = nil + } else { + in.Delim('[') + if *out == nil { + if !in.IsDelim(']') { + *out = make(accountSlice, 0, 0) + } else { + *out = accountSlice{} + } + } else { + *out = (*out)[:0] + } + for !in.IsDelim(']') { + var v22 AccountActivity + (v22).UnmarshalEasyJSON(in) + *out = append(*out, v22) + in.WantComma() + } + in.Delim(']') + } + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(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 { + out.RawByte(',') + } + (v24).MarshalEasyJSON(out) + } + out.RawByte(']') + } +} + +// MarshalJSON supports json.Marshaler interface +func (v accountSlice) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v accountSlice) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *accountSlice) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *accountSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(in *jlexer.Lexer, out *Watchlist) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -526,9 +592,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(in *jlexer out.Assets = (out.Assets)[:0] } for !in.IsDelim(']') { - var v22 Asset - (v22).UnmarshalEasyJSON(in) - out.Assets = append(out.Assets, v22) + var v25 Asset + (v25).UnmarshalEasyJSON(in) + out.Assets = append(out.Assets, v25) in.WantComma() } in.Delim(']') @@ -543,7 +609,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(out *jwriter.Writer, in Watchlist) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(out *jwriter.Writer, in Watchlist) { out.RawByte('{') first := true _ = first @@ -579,11 +645,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(out *jwrit out.RawString("null") } else { out.RawByte('[') - for v23, v24 := range in.Assets { - if v23 > 0 { + for v26, v27 := range in.Assets { + if v26 > 0 { out.RawByte(',') } - (v24).MarshalEasyJSON(out) + (v27).MarshalEasyJSON(out) } out.RawByte(']') } @@ -594,27 +660,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(out *jwrit // MarshalJSON supports json.Marshaler interface func (v Watchlist) 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 Watchlist) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Watchlist) 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 *Watchlist) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(in *jlexer.Lexer, out *UpdateWatchlistRequest) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(in *jlexer.Lexer, out *UpdateWatchlistRequest) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -651,9 +717,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(in *jlexer out.Symbols = (out.Symbols)[:0] } for !in.IsDelim(']') { - var v25 string - v25 = string(in.String()) - out.Symbols = append(out.Symbols, v25) + var v28 string + v28 = string(in.String()) + out.Symbols = append(out.Symbols, v28) in.WantComma() } in.Delim(']') @@ -668,7 +734,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(out *jwriter.Writer, in UpdateWatchlistRequest) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(out *jwriter.Writer, in UpdateWatchlistRequest) { out.RawByte('{') first := true _ = first @@ -684,11 +750,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(out *jwrit out.RawString("null") } else { out.RawByte('[') - for v26, v27 := range in.Symbols { - if v26 > 0 { + for v29, v30 := range in.Symbols { + if v29 > 0 { out.RawByte(',') } - out.String(string(v27)) + out.String(string(v30)) } out.RawByte(']') } @@ -699,27 +765,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(out *jwrit // MarshalJSON supports json.Marshaler interface func (v UpdateWatchlistRequest) 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 UpdateWatchlistRequest) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *UpdateWatchlistRequest) 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 *UpdateWatchlistRequest) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(in *jlexer.Lexer, out *TradeUpdate) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(in *jlexer.Lexer, out *TradeUpdate) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -808,7 +874,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(out *jwriter.Writer, in TradeUpdate) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(out *jwriter.Writer, in TradeUpdate) { out.RawByte('{') first := true _ = first @@ -879,27 +945,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(out *jwrit // MarshalJSON supports json.Marshaler interface func (v TradeUpdate) 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 TradeUpdate) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *TradeUpdate) 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 *TradeUpdate) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(in *jlexer.Lexer, out *RemoveSymbolFromWatchlistRequest) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(in *jlexer.Lexer, out *RemoveSymbolFromWatchlistRequest) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -930,7 +996,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(out *jwriter.Writer, in RemoveSymbolFromWatchlistRequest) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(out *jwriter.Writer, in RemoveSymbolFromWatchlistRequest) { out.RawByte('{') first := true _ = first @@ -945,27 +1011,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(out *jwri // MarshalJSON supports json.Marshaler interface func (v RemoveSymbolFromWatchlistRequest) 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 RemoveSymbolFromWatchlistRequest) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *RemoveSymbolFromWatchlistRequest) 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 *RemoveSymbolFromWatchlistRequest) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(in *jlexer.Lexer, out *Position) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(in *jlexer.Lexer, out *Position) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -1118,7 +1184,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(out *jwriter.Writer, in Position) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(out *jwriter.Writer, in Position) { out.RawByte('{') first := true _ = first @@ -1250,27 +1316,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(out *jwri // MarshalJSON supports json.Marshaler interface func (v Position) 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 Position) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Position) 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 *Position) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(in *jlexer.Lexer, out *PortfolioHistory) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(in *jlexer.Lexer, out *PortfolioHistory) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -1309,11 +1375,11 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(in *jlexe out.Equity = (out.Equity)[:0] } for !in.IsDelim(']') { - var v28 decimal.Decimal + var v31 decimal.Decimal if data := in.Raw(); in.Ok() { - in.AddError((v28).UnmarshalJSON(data)) + in.AddError((v31).UnmarshalJSON(data)) } - out.Equity = append(out.Equity, v28) + out.Equity = append(out.Equity, v31) in.WantComma() } in.Delim(']') @@ -1334,11 +1400,11 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(in *jlexe out.ProfitLoss = (out.ProfitLoss)[:0] } for !in.IsDelim(']') { - var v29 decimal.Decimal + var v32 decimal.Decimal if data := in.Raw(); in.Ok() { - in.AddError((v29).UnmarshalJSON(data)) + in.AddError((v32).UnmarshalJSON(data)) } - out.ProfitLoss = append(out.ProfitLoss, v29) + out.ProfitLoss = append(out.ProfitLoss, v32) in.WantComma() } in.Delim(']') @@ -1359,11 +1425,11 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(in *jlexe out.ProfitLossPct = (out.ProfitLossPct)[:0] } for !in.IsDelim(']') { - var v30 decimal.Decimal + var v33 decimal.Decimal if data := in.Raw(); in.Ok() { - in.AddError((v30).UnmarshalJSON(data)) + in.AddError((v33).UnmarshalJSON(data)) } - out.ProfitLossPct = append(out.ProfitLossPct, v30) + out.ProfitLossPct = append(out.ProfitLossPct, v33) in.WantComma() } in.Delim(']') @@ -1386,9 +1452,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(in *jlexe out.Timestamp = (out.Timestamp)[:0] } for !in.IsDelim(']') { - var v31 int64 - v31 = int64(in.Int64()) - out.Timestamp = append(out.Timestamp, v31) + var v34 int64 + v34 = int64(in.Int64()) + out.Timestamp = append(out.Timestamp, v34) in.WantComma() } in.Delim(']') @@ -1403,7 +1469,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(out *jwriter.Writer, in PortfolioHistory) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(out *jwriter.Writer, in PortfolioHistory) { out.RawByte('{') first := true _ = first @@ -1419,11 +1485,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(out *jwri out.RawString("null") } else { out.RawByte('[') - for v32, v33 := range in.Equity { - if v32 > 0 { + for v35, v36 := range in.Equity { + if v35 > 0 { out.RawByte(',') } - out.Raw((v33).MarshalJSON()) + out.Raw((v36).MarshalJSON()) } out.RawByte(']') } @@ -1435,11 +1501,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(out *jwri out.RawString("null") } else { out.RawByte('[') - for v34, v35 := range in.ProfitLoss { - if v34 > 0 { + for v37, v38 := range in.ProfitLoss { + if v37 > 0 { out.RawByte(',') } - out.Raw((v35).MarshalJSON()) + out.Raw((v38).MarshalJSON()) } out.RawByte(']') } @@ -1451,11 +1517,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(out *jwri out.RawString("null") } else { out.RawByte('[') - for v36, v37 := range in.ProfitLossPct { - if v36 > 0 { + for v39, v40 := range in.ProfitLossPct { + if v39 > 0 { out.RawByte(',') } - out.Raw((v37).MarshalJSON()) + out.Raw((v40).MarshalJSON()) } out.RawByte(']') } @@ -1472,11 +1538,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(out *jwri out.RawString("null") } else { out.RawByte('[') - for v38, v39 := range in.Timestamp { - if v38 > 0 { + for v41, v42 := range in.Timestamp { + if v41 > 0 { out.RawByte(',') } - out.Int64(int64(v39)) + out.Int64(int64(v42)) } out.RawByte(']') } @@ -1487,27 +1553,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(out *jwri // MarshalJSON supports json.Marshaler interface func (v PortfolioHistory) 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 PortfolioHistory) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *PortfolioHistory) 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 *PortfolioHistory) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(in *jlexer.Lexer, out *Order) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(in *jlexer.Lexer, out *Order) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -1756,9 +1822,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(in *jlexe out.Legs = (out.Legs)[:0] } for !in.IsDelim(']') { - var v40 Order - (v40).UnmarshalEasyJSON(in) - out.Legs = append(out.Legs, v40) + var v43 Order + (v43).UnmarshalEasyJSON(in) + out.Legs = append(out.Legs, v43) in.WantComma() } in.Delim(']') @@ -1773,7 +1839,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(out *jwriter.Writer, in Order) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(out *jwriter.Writer, in Order) { out.RawByte('{') first := true _ = first @@ -1994,11 +2060,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(out *jwri out.RawString("null") } else { out.RawByte('[') - for v41, v42 := range in.Legs { - if v41 > 0 { + for v44, v45 := range in.Legs { + if v44 > 0 { out.RawByte(',') } - (v42).MarshalEasyJSON(out) + (v45).MarshalEasyJSON(out) } out.RawByte(']') } @@ -2009,27 +2075,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(out *jwri // MarshalJSON supports json.Marshaler interface func (v Order) 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 Order) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Order) 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 *Order) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(in *jlexer.Lexer, out *CreateWatchlistRequest) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(in *jlexer.Lexer, out *CreateWatchlistRequest) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2066,9 +2132,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(in *jlexe out.Symbols = (out.Symbols)[:0] } for !in.IsDelim(']') { - var v43 string - v43 = string(in.String()) - out.Symbols = append(out.Symbols, v43) + var v46 string + v46 = string(in.String()) + out.Symbols = append(out.Symbols, v46) in.WantComma() } in.Delim(']') @@ -2083,7 +2149,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(out *jwriter.Writer, in CreateWatchlistRequest) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(out *jwriter.Writer, in CreateWatchlistRequest) { out.RawByte('{') first := true _ = first @@ -2099,11 +2165,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(out *jwri out.RawString("null") } else { out.RawByte('[') - for v44, v45 := range in.Symbols { - if v44 > 0 { + for v47, v48 := range in.Symbols { + if v47 > 0 { out.RawByte(',') } - out.String(string(v45)) + out.String(string(v48)) } out.RawByte(']') } @@ -2114,27 +2180,119 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(out *jwri // MarshalJSON supports json.Marshaler interface func (v CreateWatchlistRequest) 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 CreateWatchlistRequest) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *CreateWatchlistRequest) 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 *CreateWatchlistRequest) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(in *jlexer.Lexer, out *CloseAllPositionsResponse) { + 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": + out.Status = int(in.Int()) + case "body": + if m, ok := out.Body.(easyjson.Unmarshaler); ok { + m.UnmarshalEasyJSON(in) + } else if m, ok := out.Body.(json.Unmarshaler); ok { + _ = m.UnmarshalJSON(in.Raw()) + } else { + out.Body = in.Interface() + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(out *jwriter.Writer, in CloseAllPositionsResponse) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"symbol\":" + out.RawString(prefix[1:]) + out.String(string(in.Symbol)) + } + { + const prefix string = ",\"status\":" + out.RawString(prefix) + out.Int(int(in.Status)) + } + if in.Body != nil { + const prefix string = ",\"body\":" + out.RawString(prefix) + if m, ok := in.Body.(easyjson.Marshaler); ok { + m.MarshalEasyJSON(out) + } else if m, ok := in.Body.(json.Marshaler); ok { + out.Raw(m.MarshalJSON()) + } else { + out.Raw(json.Marshal(in.Body)) + } + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v CloseAllPositionsResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v CloseAllPositionsResponse) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(w, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(in *jlexer.Lexer, out *Clock) { + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *CloseAllPositionsResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *CloseAllPositionsResponse) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(in *jlexer.Lexer, out *Clock) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2177,7 +2335,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(out *jwriter.Writer, in Clock) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(out *jwriter.Writer, in Clock) { out.RawByte('{') first := true _ = first @@ -2207,27 +2365,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(out *jwri // MarshalJSON supports json.Marshaler interface func (v Clock) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Clock) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Clock) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Clock) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(in *jlexer.Lexer, out *CalendarDay) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(in *jlexer.Lexer, out *CalendarDay) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2262,7 +2420,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(out *jwriter.Writer, in CalendarDay) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(out *jwriter.Writer, in CalendarDay) { out.RawByte('{') first := true _ = first @@ -2287,27 +2445,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(out *jwri // MarshalJSON supports json.Marshaler interface func (v CalendarDay) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v CalendarDay) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *CalendarDay) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *CalendarDay) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(in *jlexer.Lexer, out *Asset) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(in *jlexer.Lexer, out *Asset) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2366,9 +2524,9 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(in *jlexe out.Attributes = (out.Attributes)[:0] } for !in.IsDelim(']') { - var v46 string - v46 = string(in.String()) - out.Attributes = append(out.Attributes, v46) + var v49 string + v49 = string(in.String()) + out.Attributes = append(out.Attributes, v49) in.WantComma() } in.Delim(']') @@ -2383,7 +2541,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(out *jwriter.Writer, in Asset) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(out *jwriter.Writer, in Asset) { out.RawByte('{') first := true _ = first @@ -2454,11 +2612,11 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(out *jwri out.RawString("null") } else { out.RawByte('[') - for v47, v48 := range in.Attributes { - if v47 > 0 { + for v50, v51 := range in.Attributes { + if v50 > 0 { out.RawByte(',') } - out.String(string(v48)) + out.String(string(v51)) } out.RawByte(']') } @@ -2469,27 +2627,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(out *jwri // MarshalJSON supports json.Marshaler interface func (v Asset) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Asset) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Asset) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Asset) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(in *jlexer.Lexer, out *Announcement) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(in *jlexer.Lexer, out *Announcement) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2548,7 +2706,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(out *jwriter.Writer, in Announcement) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(out *jwriter.Writer, in Announcement) { out.RawByte('{') first := true _ = first @@ -2633,27 +2791,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(out *jwri // MarshalJSON supports json.Marshaler interface func (v Announcement) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Announcement) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Announcement) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Announcement) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca18(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(in *jlexer.Lexer, out *AddSymbolToWatchlistRequest) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(in *jlexer.Lexer, out *AddSymbolToWatchlistRequest) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2684,7 +2842,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(out *jwriter.Writer, in AddSymbolToWatchlistRequest) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(out *jwriter.Writer, in AddSymbolToWatchlistRequest) { out.RawByte('{') first := true _ = first @@ -2699,27 +2857,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(out *jwri // MarshalJSON supports json.Marshaler interface func (v AddSymbolToWatchlistRequest) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v AddSymbolToWatchlistRequest) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *AddSymbolToWatchlistRequest) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *AddSymbolToWatchlistRequest) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca19(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(in *jlexer.Lexer, out *AccountConfigurations) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(in *jlexer.Lexer, out *AccountConfigurations) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2756,7 +2914,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(out *jwriter.Writer, in AccountConfigurations) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(out *jwriter.Writer, in AccountConfigurations) { out.RawByte('{') first := true _ = first @@ -2786,27 +2944,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(out *jwri // MarshalJSON supports json.Marshaler interface func (v AccountConfigurations) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v AccountConfigurations) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *AccountConfigurations) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *AccountConfigurations) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca20(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(in *jlexer.Lexer, out *AccountActivity) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(in *jlexer.Lexer, out *AccountActivity) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2879,7 +3037,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(out *jwriter.Writer, in AccountActivity) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(out *jwriter.Writer, in AccountActivity) { out.RawByte('{') first := true _ = first @@ -2959,27 +3117,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(out *jwri // MarshalJSON supports json.Marshaler interface func (v AccountActivity) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v AccountActivity) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *AccountActivity) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *AccountActivity) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca21(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(in *jlexer.Lexer, out *Account) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(in *jlexer.Lexer, out *Account) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -3114,7 +3272,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(out *jwriter.Writer, in Account) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(out *jwriter.Writer, in Account) { out.RawByte('{') first := true _ = first @@ -3289,27 +3447,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(out *jwri // MarshalJSON supports json.Marshaler interface func (v Account) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Account) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Account) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Account) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca22(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca24(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(in *jlexer.Lexer, out *APIError) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(in *jlexer.Lexer, out *APIError) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -3342,7 +3500,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(out *jwriter.Writer, in APIError) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(out *jwriter.Writer, in APIError) { out.RawByte('{') first := true _ = first @@ -3367,23 +3525,23 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(out *jwri // MarshalJSON supports json.Marshaler interface func (v APIError) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(&w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v APIError) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *APIError) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(&r, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *APIError) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca23(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca25(l, v) } diff --git a/alpaca/rest.go b/alpaca/rest.go index 65fd063..a27c31e 100644 --- a/alpaca/rest.go +++ b/alpaca/rest.go @@ -314,7 +314,7 @@ type CloseAllPositionsRequest struct { } // CloseAllPositions liquidates all open positions at market price. -func (c *Client) CloseAllPositions(req CloseAllPositionsRequest) ([]Order, error) { +func (c *Client) CloseAllPositions(req CloseAllPositionsRequest) (closeAllPositionsSlice, error) { u, err := url.Parse(fmt.Sprintf("%s/%s/positions", c.opts.BaseURL, apiVersion)) if err != nil { return nil, err @@ -329,11 +329,11 @@ func (c *Client) CloseAllPositions(req CloseAllPositionsRequest) ([]Order, error return nil, err } - var orders orderSlice - if err = unmarshal(resp, &orders); err != nil { + var closeAllPositions closeAllPositionsSlice + if err = unmarshal(resp, &closeAllPositions); err != nil { return nil, err } - return orders, nil + return closeAllPositions, nil } type ClosePositionRequest struct { @@ -911,7 +911,7 @@ func GetPosition(symbol string) (*Position, error) { } // CloseAllPositions liquidates all open positions at market price. -func CloseAllPositions(req CloseAllPositionsRequest) ([]Order, error) { +func CloseAllPositions(req CloseAllPositionsRequest) ([]CloseAllPositionsResponse, error) { return DefaultClient.CloseAllPositions(req) } From 03d7e05d3b9491651d58de59d40a12ddf9c94951 Mon Sep 17 00:00:00 2001 From: Sai G Date: Wed, 22 May 2024 11:02:22 -0400 Subject: [PATCH 2/5] Update unit test --- alpaca/rest_test.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/alpaca/rest_test.go b/alpaca/rest_test.go index c38facb..18f1aab 100644 --- a/alpaca/rest_test.go +++ b/alpaca/rest_test.go @@ -181,16 +181,16 @@ func TestCancelPosition(t *testing.T) { func TestCancelAllPositions(t *testing.T) { c := DefaultClient - orders := []Order{ - {ID: "1"}, - {ID: "2"}, + closeAllPositionsResponse := []CloseAllPositionsResponse{ + {Symbol: "AAPL", Status: 200}, + {Symbol: "TSLA", Status: 422}, } c.do = func(c *Client, req *http.Request) (*http.Response, error) { assert.Equal(t, "/v2/positions", req.URL.Path) assert.Equal(t, http.MethodDelete, req.Method) assert.Equal(t, "true", req.URL.Query().Get("cancel_orders")) return &http.Response{ - Body: genBody(orders), + Body: genBody(closeAllPositionsResponse), }, nil } got, err := c.CloseAllPositions(CloseAllPositionsRequest{ @@ -198,8 +198,10 @@ func TestCancelAllPositions(t *testing.T) { }) require.NoError(t, err) require.Len(t, got, 2) - assert.Equal(t, "1", got[0].ID) - assert.Equal(t, "2", got[1].ID) + assert.Equal(t, "AAPL", got[0].Symbol) + assert.Equal(t, 200, got[0].Status) + assert.Equal(t, "TSLA", got[1].Symbol) + assert.Equal(t, 422, got[1].Status) } func TestGetClock(t *testing.T) { From 6c112431faaefb5f941f14084230bb6b3a8799bc Mon Sep 17 00:00:00 2001 From: sai-g Date: Wed, 5 Jun 2024 14:33:33 -0400 Subject: [PATCH 3/5] Update method signature --- alpaca/entities.go | 6 +++--- alpaca/entities_easyjson.go | 18 ++++-------------- alpaca/rest.go | 35 ++++++++++++++++++++++++++++------- alpaca/rest_test.go | 25 +++++++++++++++++-------- 4 files changed, 52 insertions(+), 32 deletions(-) diff --git a/alpaca/entities.go b/alpaca/entities.go index 6803755..a4081ba 100644 --- a/alpaca/entities.go +++ b/alpaca/entities.go @@ -373,7 +373,7 @@ func (e *APIError) Error() string { type closeAllPositionsSlice []CloseAllPositionsResponse type CloseAllPositionsResponse struct { - Symbol string `json:"symbol"` - Status int `json:"status"` - Body interface{} `json:"body,omitempty"` + Symbol string `json:"symbol"` + Status int `json:"status"` + Body json.RawMessage `json:"body,omitempty"` } diff --git a/alpaca/entities_easyjson.go b/alpaca/entities_easyjson.go index fc880bc..de325b1 100644 --- a/alpaca/entities_easyjson.go +++ b/alpaca/entities_easyjson.go @@ -2224,12 +2224,8 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(in *jlexe case "status": out.Status = int(in.Int()) case "body": - if m, ok := out.Body.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Body.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Body = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Body).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -2255,16 +2251,10 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(out *jwri out.RawString(prefix) out.Int(int(in.Status)) } - if in.Body != nil { + if len(in.Body) != 0 { const prefix string = ",\"body\":" out.RawString(prefix) - if m, ok := in.Body.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Body.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Body)) - } + out.Raw((in.Body).MarshalJSON()) } out.RawByte('}') } diff --git a/alpaca/rest.go b/alpaca/rest.go index a27c31e..7c086f8 100644 --- a/alpaca/rest.go +++ b/alpaca/rest.go @@ -314,10 +314,10 @@ type CloseAllPositionsRequest struct { } // CloseAllPositions liquidates all open positions at market price. -func (c *Client) CloseAllPositions(req CloseAllPositionsRequest) (closeAllPositionsSlice, error) { +func (c *Client) CloseAllPositions(req CloseAllPositionsRequest) (map[string]*Order, map[string]*APIError, error) { u, err := url.Parse(fmt.Sprintf("%s/%s/positions", c.opts.BaseURL, apiVersion)) if err != nil { - return nil, err + return nil, nil, err } q := u.Query() @@ -326,14 +326,35 @@ func (c *Client) CloseAllPositions(req CloseAllPositionsRequest) (closeAllPositi resp, err := c.delete(u) if err != nil { - return nil, err + return nil, nil, err } var closeAllPositions closeAllPositionsSlice if err = unmarshal(resp, &closeAllPositions); err != nil { - return nil, err + return nil, nil, err + } + + var ( + orderEntityMap = make(map[string]*Order, len(closeAllPositions)) + apiErrorMap = make(map[string]*APIError, len(closeAllPositions)) + ) + for _, capr := range closeAllPositions { + if capr.Status == http.StatusOK { + var orderEntity Order + if err := easyjson.Unmarshal(capr.Body, &orderEntity); err != nil { + return nil, nil, err + } + orderEntityMap[capr.Symbol] = &orderEntity + continue + } + var apiErr APIError + if err := easyjson.Unmarshal(capr.Body, &apiErr); err != nil { + return nil, nil, err + } + apiErrorMap[capr.Symbol] = &apiErr } - return closeAllPositions, nil + + return orderEntityMap, apiErrorMap, nil } type ClosePositionRequest struct { @@ -342,7 +363,7 @@ type ClosePositionRequest struct { Qty decimal.Decimal // Percentage of position to liquidate. Must be between 0 and 100. // Would only sell fractional if position is originally fractional. - // Can accept up to 9 decimal points. Cannot work with qty. + // Can accept up to 9 decimal points. Cannot wosrk with qty. Percentage decimal.Decimal } @@ -911,7 +932,7 @@ func GetPosition(symbol string) (*Position, error) { } // CloseAllPositions liquidates all open positions at market price. -func CloseAllPositions(req CloseAllPositionsRequest) ([]CloseAllPositionsResponse, error) { +func CloseAllPositions(req CloseAllPositionsRequest) (map[string]*Order, map[string]*APIError, error) { return DefaultClient.CloseAllPositions(req) } diff --git a/alpaca/rest_test.go b/alpaca/rest_test.go index 18f1aab..55501fc 100644 --- a/alpaca/rest_test.go +++ b/alpaca/rest_test.go @@ -182,8 +182,8 @@ func TestCancelAllPositions(t *testing.T) { c := DefaultClient closeAllPositionsResponse := []CloseAllPositionsResponse{ - {Symbol: "AAPL", Status: 200}, - {Symbol: "TSLA", Status: 422}, + {Symbol: "AAPL", Status: 200, Body: json.RawMessage(`{"id":"0571ce61-bf65-4f0c-b3de-6f42ce628422"}`)}, + {Symbol: "TSLA", Status: 422, Body: json.RawMessage(`{"code": 42210000, "message": "error"}`)}, } c.do = func(c *Client, req *http.Request) (*http.Response, error) { assert.Equal(t, "/v2/positions", req.URL.Path) @@ -193,15 +193,24 @@ func TestCancelAllPositions(t *testing.T) { Body: genBody(closeAllPositionsResponse), }, nil } - got, err := c.CloseAllPositions(CloseAllPositionsRequest{ + gotOrders, gotApiErrors, err := c.CloseAllPositions(CloseAllPositionsRequest{ CancelOrders: true, }) require.NoError(t, err) - require.Len(t, got, 2) - assert.Equal(t, "AAPL", got[0].Symbol) - assert.Equal(t, 200, got[0].Status) - assert.Equal(t, "TSLA", got[1].Symbol) - assert.Equal(t, 422, got[1].Status) + require.Len(t, gotOrders, 1) + require.Len(t, gotApiErrors, 1) + + aaplOrder, ok := gotOrders["AAPL"] + require.True(t, ok) + require.NotNil(t, aaplOrder) + + tslaOrder, ok := gotOrders["TSLA"] + require.False(t, ok) + require.Nil(t, tslaOrder) + + apiErr, ok := gotApiErrors["TSLA"] + require.True(t, ok) + require.NotNil(t, apiErr) } func TestGetClock(t *testing.T) { From 2ef5813e6ae9dcb8a0700c6384cd5f6200806815 Mon Sep 17 00:00:00 2001 From: sai-g Date: Wed, 5 Jun 2024 20:27:46 -0400 Subject: [PATCH 4/5] Not to change method signature --- alpaca/rest.go | 36 ++++++++++++++++++++++-------------- alpaca/rest_test.go | 22 +++++----------------- 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/alpaca/rest.go b/alpaca/rest.go index 7c086f8..0e57d49 100644 --- a/alpaca/rest.go +++ b/alpaca/rest.go @@ -3,6 +3,7 @@ package alpaca import ( "bytes" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -314,10 +315,12 @@ type CloseAllPositionsRequest struct { } // CloseAllPositions liquidates all open positions at market price. -func (c *Client) CloseAllPositions(req CloseAllPositionsRequest) (map[string]*Order, map[string]*APIError, error) { +// It returns the list of orders that were submitted to close the positions. +// If an error occurs while closing a position, the error will be returned +func (c *Client) CloseAllPositions(req CloseAllPositionsRequest) ([]Order, error) { u, err := url.Parse(fmt.Sprintf("%s/%s/positions", c.opts.BaseURL, apiVersion)) if err != nil { - return nil, nil, err + return nil, err } q := u.Query() @@ -326,35 +329,40 @@ func (c *Client) CloseAllPositions(req CloseAllPositionsRequest) (map[string]*Or resp, err := c.delete(u) if err != nil { - return nil, nil, err + return nil, err } var closeAllPositions closeAllPositionsSlice if err = unmarshal(resp, &closeAllPositions); err != nil { - return nil, nil, err + return nil, err } var ( - orderEntityMap = make(map[string]*Order, len(closeAllPositions)) - apiErrorMap = make(map[string]*APIError, len(closeAllPositions)) + orders = make([]Order, 0, len(closeAllPositions)) + errs = make([]error, 0, len(closeAllPositions)) ) for _, capr := range closeAllPositions { if capr.Status == http.StatusOK { - var orderEntity Order - if err := easyjson.Unmarshal(capr.Body, &orderEntity); err != nil { - return nil, nil, err + var order Order + if err := easyjson.Unmarshal(capr.Body, &order); err != nil { + return nil, err } - orderEntityMap[capr.Symbol] = &orderEntity + orders = append(orders, order) continue } var apiErr APIError if err := easyjson.Unmarshal(capr.Body, &apiErr); err != nil { - return nil, nil, err + return nil, err } - apiErrorMap[capr.Symbol] = &apiErr + apiErr.StatusCode = capr.Status + errs = append(errs, &apiErr) } - return orderEntityMap, apiErrorMap, nil + if len(errs) > 0 { + return orders, errors.Join(errs...) + } + + return orders, nil } type ClosePositionRequest struct { @@ -932,7 +940,7 @@ func GetPosition(symbol string) (*Position, error) { } // CloseAllPositions liquidates all open positions at market price. -func CloseAllPositions(req CloseAllPositionsRequest) (map[string]*Order, map[string]*APIError, error) { +func CloseAllPositions(req CloseAllPositionsRequest) ([]Order, error) { return DefaultClient.CloseAllPositions(req) } diff --git a/alpaca/rest_test.go b/alpaca/rest_test.go index 55501fc..f9b7f60 100644 --- a/alpaca/rest_test.go +++ b/alpaca/rest_test.go @@ -182,7 +182,7 @@ func TestCancelAllPositions(t *testing.T) { c := DefaultClient closeAllPositionsResponse := []CloseAllPositionsResponse{ - {Symbol: "AAPL", Status: 200, Body: json.RawMessage(`{"id":"0571ce61-bf65-4f0c-b3de-6f42ce628422"}`)}, + {Symbol: "AAPL", Status: 200, Body: json.RawMessage(`{"id":"0571ce61-bf65-4f0c-b3de-6f42ce628422", "symbol": "AAPL"}`)}, {Symbol: "TSLA", Status: 422, Body: json.RawMessage(`{"code": 42210000, "message": "error"}`)}, } c.do = func(c *Client, req *http.Request) (*http.Response, error) { @@ -193,24 +193,12 @@ func TestCancelAllPositions(t *testing.T) { Body: genBody(closeAllPositionsResponse), }, nil } - gotOrders, gotApiErrors, err := c.CloseAllPositions(CloseAllPositionsRequest{ + gotOrders, err := c.CloseAllPositions(CloseAllPositionsRequest{ CancelOrders: true, }) - require.NoError(t, err) - require.Len(t, gotOrders, 1) - require.Len(t, gotApiErrors, 1) - - aaplOrder, ok := gotOrders["AAPL"] - require.True(t, ok) - require.NotNil(t, aaplOrder) - - tslaOrder, ok := gotOrders["TSLA"] - require.False(t, ok) - require.Nil(t, tslaOrder) - - apiErr, ok := gotApiErrors["TSLA"] - require.True(t, ok) - require.NotNil(t, apiErr) + require.Error(t, err) + assert.Len(t, gotOrders, 1) + assert.Equal(t, "AAPL", gotOrders[0].Symbol) } func TestGetClock(t *testing.T) { From 2f14f63f01265f6129f746468c7c47f4f8c442bc Mon Sep 17 00:00:00 2001 From: sai-g Date: Fri, 7 Jun 2024 09:16:32 -0400 Subject: [PATCH 5/5] address review comments --- alpaca/entities.go | 4 +- alpaca/entities_easyjson.go | 308 ++++++++++++++++++------------------ alpaca/rest.go | 12 +- alpaca/rest_test.go | 2 +- 4 files changed, 161 insertions(+), 165 deletions(-) diff --git a/alpaca/entities.go b/alpaca/entities.go index a4081ba..557e523 100644 --- a/alpaca/entities.go +++ b/alpaca/entities.go @@ -370,9 +370,9 @@ func (e *APIError) Error() string { } //easyjson:json -type closeAllPositionsSlice []CloseAllPositionsResponse +type closeAllPositionsSlice []closeAllPositionsResponse -type CloseAllPositionsResponse struct { +type closeAllPositionsResponse struct { Symbol string `json:"symbol"` Status int `json:"status"` Body json.RawMessage `json:"body,omitempty"` diff --git a/alpaca/entities_easyjson.go b/alpaca/entities_easyjson.go index de325b1..5087d25 100644 --- a/alpaca/entities_easyjson.go +++ b/alpaca/entities_easyjson.go @@ -234,7 +234,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(in *jlexer *out = (*out)[:0] } for !in.IsDelim(']') { - var v10 CloseAllPositionsResponse + var v10 closeAllPositionsResponse (v10).UnmarshalEasyJSON(in) *out = append(*out, v10) in.WantComma() @@ -283,7 +283,89 @@ func (v *closeAllPositionsSlice) UnmarshalJSON(data []byte) error { func (v *closeAllPositionsSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca3(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(in *jlexer.Lexer, out *calendarDaySlice) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(in *jlexer.Lexer, out *closeAllPositionsResponse) { + 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": + out.Status = int(in.Int()) + case "body": + if data := in.Raw(); in.Ok() { + in.AddError((out.Body).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(out *jwriter.Writer, in closeAllPositionsResponse) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"symbol\":" + out.RawString(prefix[1:]) + out.String(string(in.Symbol)) + } + { + const prefix string = ",\"status\":" + out.RawString(prefix) + out.Int(int(in.Status)) + } + if len(in.Body) != 0 { + const prefix string = ",\"body\":" + out.RawString(prefix) + out.Raw((in.Body).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v closeAllPositionsResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v closeAllPositionsResponse) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *closeAllPositionsResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *closeAllPositionsResponse) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(l, v) +} +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(in *jlexer.Lexer, out *calendarDaySlice) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() @@ -311,7 +393,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(out *jwriter.Writer, in calendarDaySlice) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(out *jwriter.Writer, in calendarDaySlice) { if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { @@ -329,27 +411,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(out *jwrit // MarshalJSON supports json.Marshaler interface func (v calendarDaySlice) 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 calendarDaySlice) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *calendarDaySlice) 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 *calendarDaySlice) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca4(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(in *jlexer.Lexer, out *assetSlice) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(in *jlexer.Lexer, out *assetSlice) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() @@ -377,7 +459,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(out *jwriter.Writer, in assetSlice) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(out *jwriter.Writer, in assetSlice) { if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { @@ -395,27 +477,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(out *jwrit // MarshalJSON supports json.Marshaler interface func (v assetSlice) 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 assetSlice) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *assetSlice) 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 *assetSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca5(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(in *jlexer.Lexer, out *announcementSlice) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(in *jlexer.Lexer, out *announcementSlice) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() @@ -443,7 +525,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(out *jwriter.Writer, in announcementSlice) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(out *jwriter.Writer, in announcementSlice) { if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { @@ -461,27 +543,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(out *jwrit // MarshalJSON supports json.Marshaler interface func (v announcementSlice) 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 announcementSlice) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *announcementSlice) 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 *announcementSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca6(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(in *jlexer.Lexer, out *accountSlice) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(in *jlexer.Lexer, out *accountSlice) { isTopLevel := in.IsStart() if in.IsNull() { in.Skip() @@ -509,7 +591,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(out *jwriter.Writer, in accountSlice) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(out *jwriter.Writer, in accountSlice) { if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { @@ -527,27 +609,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(out *jwrit // MarshalJSON supports json.Marshaler interface func (v accountSlice) 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 accountSlice) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *accountSlice) 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 *accountSlice) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca7(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(in *jlexer.Lexer, out *Watchlist) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(in *jlexer.Lexer, out *Watchlist) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -609,7 +691,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(out *jwriter.Writer, in Watchlist) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(out *jwriter.Writer, in Watchlist) { out.RawByte('{') first := true _ = first @@ -660,27 +742,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(out *jwrit // MarshalJSON supports json.Marshaler interface func (v Watchlist) 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 Watchlist) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Watchlist) 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 *Watchlist) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca8(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(in *jlexer.Lexer, out *UpdateWatchlistRequest) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(in *jlexer.Lexer, out *UpdateWatchlistRequest) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -734,7 +816,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(in *jlexer in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(out *jwriter.Writer, in UpdateWatchlistRequest) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(out *jwriter.Writer, in UpdateWatchlistRequest) { out.RawByte('{') first := true _ = first @@ -765,27 +847,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(out *jwrit // MarshalJSON supports json.Marshaler interface func (v UpdateWatchlistRequest) 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 UpdateWatchlistRequest) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *UpdateWatchlistRequest) 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 *UpdateWatchlistRequest) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca9(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(in *jlexer.Lexer, out *TradeUpdate) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(in *jlexer.Lexer, out *TradeUpdate) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -874,7 +956,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(out *jwriter.Writer, in TradeUpdate) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(out *jwriter.Writer, in TradeUpdate) { out.RawByte('{') first := true _ = first @@ -945,27 +1027,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(out *jwri // MarshalJSON supports json.Marshaler interface func (v TradeUpdate) 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 TradeUpdate) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *TradeUpdate) 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 *TradeUpdate) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca10(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(in *jlexer.Lexer, out *RemoveSymbolFromWatchlistRequest) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(in *jlexer.Lexer, out *RemoveSymbolFromWatchlistRequest) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -996,7 +1078,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(out *jwriter.Writer, in RemoveSymbolFromWatchlistRequest) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(out *jwriter.Writer, in RemoveSymbolFromWatchlistRequest) { out.RawByte('{') first := true _ = first @@ -1011,27 +1093,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(out *jwri // MarshalJSON supports json.Marshaler interface func (v RemoveSymbolFromWatchlistRequest) 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 RemoveSymbolFromWatchlistRequest) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *RemoveSymbolFromWatchlistRequest) 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 *RemoveSymbolFromWatchlistRequest) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca11(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(in *jlexer.Lexer, out *Position) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(in *jlexer.Lexer, out *Position) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -1184,7 +1266,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(out *jwriter.Writer, in Position) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(out *jwriter.Writer, in Position) { out.RawByte('{') first := true _ = first @@ -1316,27 +1398,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(out *jwri // MarshalJSON supports json.Marshaler interface func (v Position) 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 Position) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Position) 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 *Position) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca12(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(in *jlexer.Lexer, out *PortfolioHistory) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(in *jlexer.Lexer, out *PortfolioHistory) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -1469,7 +1551,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(out *jwriter.Writer, in PortfolioHistory) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(out *jwriter.Writer, in PortfolioHistory) { out.RawByte('{') first := true _ = first @@ -1553,27 +1635,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(out *jwri // MarshalJSON supports json.Marshaler interface func (v PortfolioHistory) 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 PortfolioHistory) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *PortfolioHistory) 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 *PortfolioHistory) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca13(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(in *jlexer.Lexer, out *Order) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(in *jlexer.Lexer, out *Order) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -1839,7 +1921,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(out *jwriter.Writer, in Order) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(out *jwriter.Writer, in Order) { out.RawByte('{') first := true _ = first @@ -2075,27 +2157,27 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(out *jwri // MarshalJSON supports json.Marshaler interface func (v Order) 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 Order) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(w, v) + easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Order) 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 *Order) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca14(l, v) + easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(l, v) } -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(in *jlexer.Lexer, out *CreateWatchlistRequest) { +func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(in *jlexer.Lexer, out *CreateWatchlistRequest) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -2149,7 +2231,7 @@ func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(in *jlexe in.Consumed() } } -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(out *jwriter.Writer, in CreateWatchlistRequest) { +func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(out *jwriter.Writer, in CreateWatchlistRequest) { out.RawByte('{') first := true _ = first @@ -2179,107 +2261,25 @@ func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(out *jwri // MarshalJSON supports json.Marshaler interface func (v CreateWatchlistRequest) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v CreateWatchlistRequest) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *CreateWatchlistRequest) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *CreateWatchlistRequest) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca15(l, v) -} -func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(in *jlexer.Lexer, out *CloseAllPositionsResponse) { - 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": - out.Status = int(in.Int()) - case "body": - if data := in.Raw(); in.Ok() { - in.AddError((out.Body).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(out *jwriter.Writer, in CloseAllPositionsResponse) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"symbol\":" - out.RawString(prefix[1:]) - out.String(string(in.Symbol)) - } - { - const prefix string = ",\"status\":" - out.RawString(prefix) - out.Int(int(in.Status)) - } - if len(in.Body) != 0 { - const prefix string = ",\"body\":" - out.RawString(prefix) - out.Raw((in.Body).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v CloseAllPositionsResponse) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface -func (v CloseAllPositionsResponse) MarshalEasyJSON(w *jwriter.Writer) { +func (v CreateWatchlistRequest) MarshalEasyJSON(w *jwriter.Writer) { easyjson3e8ab7adEncodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(w, v) } // UnmarshalJSON supports json.Unmarshaler interface -func (v *CloseAllPositionsResponse) UnmarshalJSON(data []byte) error { +func (v *CreateWatchlistRequest) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *CloseAllPositionsResponse) UnmarshalEasyJSON(l *jlexer.Lexer) { +func (v *CreateWatchlistRequest) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(l, v) } func easyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca17(in *jlexer.Lexer, out *Clock) { diff --git a/alpaca/rest.go b/alpaca/rest.go index 0e57d49..3e8fa52 100644 --- a/alpaca/rest.go +++ b/alpaca/rest.go @@ -315,8 +315,8 @@ type CloseAllPositionsRequest struct { } // CloseAllPositions liquidates all open positions at market price. -// It returns the list of orders that were submitted to close the positions. -// If an error occurs while closing a position, the error will be returned +// It returns the list of orders that were created to close the positions. +// If errors occur while closing some of the positions, the errors will also be returned (possibly among orders) func (c *Client) CloseAllPositions(req CloseAllPositionsRequest) ([]Order, error) { u, err := url.Parse(fmt.Sprintf("%s/%s/positions", c.opts.BaseURL, apiVersion)) if err != nil { @@ -358,11 +358,7 @@ func (c *Client) CloseAllPositions(req CloseAllPositionsRequest) ([]Order, error errs = append(errs, &apiErr) } - if len(errs) > 0 { - return orders, errors.Join(errs...) - } - - return orders, nil + return orders, errors.Join(errs...) } type ClosePositionRequest struct { @@ -371,7 +367,7 @@ type ClosePositionRequest struct { Qty decimal.Decimal // Percentage of position to liquidate. Must be between 0 and 100. // Would only sell fractional if position is originally fractional. - // Can accept up to 9 decimal points. Cannot wosrk with qty. + // Can accept up to 9 decimal points. Cannot work with qty. Percentage decimal.Decimal } diff --git a/alpaca/rest_test.go b/alpaca/rest_test.go index f9b7f60..db57459 100644 --- a/alpaca/rest_test.go +++ b/alpaca/rest_test.go @@ -181,7 +181,7 @@ func TestCancelPosition(t *testing.T) { func TestCancelAllPositions(t *testing.T) { c := DefaultClient - closeAllPositionsResponse := []CloseAllPositionsResponse{ + closeAllPositionsResponse := []closeAllPositionsResponse{ {Symbol: "AAPL", Status: 200, Body: json.RawMessage(`{"id":"0571ce61-bf65-4f0c-b3de-6f42ce628422", "symbol": "AAPL"}`)}, {Symbol: "TSLA", Status: 422, Body: json.RawMessage(`{"code": 42210000, "message": "error"}`)}, }