better trade endpoints
This commit is contained in:
@@ -41,13 +41,13 @@ type Trade struct {
|
||||
}
|
||||
|
||||
type AddTradeRequest struct {
|
||||
TickerId int `json:"ticker_id"`
|
||||
Shares int `json:"shares"`
|
||||
Product int `json:"product"`
|
||||
Type bool `json:"type"`
|
||||
Price float64 `json:"price"`
|
||||
Currency string `json:"currency"`
|
||||
Date time.Time `json:"date"`
|
||||
TickerId int `json:"ticker_id"`
|
||||
Shares int `json:"shares"`
|
||||
Product int `json:"product"`
|
||||
Type bool `json:"type"`
|
||||
Price float64 `json:"price"`
|
||||
CurrencyCode string `json:"currency_code"`
|
||||
Date time.Time `json:"date"`
|
||||
}
|
||||
|
||||
func (r *AddTradeRequest) Validate() error {
|
||||
@@ -63,7 +63,7 @@ func (r *AddTradeRequest) Validate() error {
|
||||
if r.Price <= 0 {
|
||||
return errors.New("price must be a positive number")
|
||||
}
|
||||
if r.Currency == "" {
|
||||
if r.CurrencyCode != "" {
|
||||
return errors.New("currency is required")
|
||||
}
|
||||
if r.Date.IsZero() {
|
||||
|
||||
Reference in New Issue
Block a user