mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
types: add MarshalJSON method on strint64
This commit is contained in:
parent
9c6de12e19
commit
2fe915f73a
|
@ -3,14 +3,18 @@ package bitgetapi
|
||||||
//go:generate -command GetRequest requestgen -method GET -responseType .APIResponse -responseDataField Data
|
//go:generate -command GetRequest requestgen -method GET -responseType .APIResponse -responseDataField Data
|
||||||
//go:generate -command PostRequest requestgen -method POST -responseType .APIResponse -responseDataField Data
|
//go:generate -command PostRequest requestgen -method POST -responseType .APIResponse -responseDataField Data
|
||||||
|
|
||||||
import "github.com/c9s/requestgen"
|
import (
|
||||||
|
"github.com/c9s/requestgen"
|
||||||
|
|
||||||
|
"github.com/c9s/bbgo/pkg/types"
|
||||||
|
)
|
||||||
|
|
||||||
type Account struct {
|
type Account struct {
|
||||||
UserId string `json:"user_id"`
|
UserId types.StrInt64 `json:"user_id"`
|
||||||
InviterId string `json:"inviter_id"`
|
InviterId types.StrInt64 `json:"inviter_id"`
|
||||||
Ips string `json:"ips"`
|
Ips string `json:"ips"`
|
||||||
Authorities []string `json:"authorities"`
|
Authorities []string `json:"authorities"`
|
||||||
ParentId string `json:"parentId"`
|
ParentId types.StrInt64 `json:"parentId"`
|
||||||
Trader bool `json:"trader"`
|
Trader bool `json:"trader"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Fill struct {
|
type Fill struct {
|
||||||
AccountId string `json:"accountId"`
|
AccountId types.StrInt64 `json:"accountId"`
|
||||||
Symbol string `json:"symbol"`
|
Symbol string `json:"symbol"`
|
||||||
OrderId string `json:"orderId"`
|
OrderId types.StrInt64 `json:"orderId"`
|
||||||
FillId string `json:"fillId"`
|
FillId types.StrInt64 `json:"fillId"`
|
||||||
OrderType OrderType `json:"orderType"`
|
OrderType OrderType `json:"orderType"`
|
||||||
Side OrderSide `json:"side"`
|
Side OrderSide `json:"side"`
|
||||||
FillPrice fixedpoint.Value `json:"fillPrice"`
|
FillPrice fixedpoint.Value `json:"fillPrice"`
|
||||||
|
|
|
@ -11,9 +11,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type OrderDetail struct {
|
type OrderDetail struct {
|
||||||
AccountId string `json:"accountId"`
|
AccountId types.StrInt64 `json:"accountId"`
|
||||||
Symbol string `json:"symbol"`
|
Symbol string `json:"symbol"`
|
||||||
OrderId string `json:"orderId"`
|
OrderId types.StrInt64 `json:"orderId"`
|
||||||
ClientOrderId string `json:"clientOrderId"`
|
ClientOrderId string `json:"clientOrderId"`
|
||||||
Price fixedpoint.Value `json:"price"`
|
Price fixedpoint.Value `json:"price"`
|
||||||
Quantity fixedpoint.Value `json:"quantity"`
|
Quantity fixedpoint.Value `json:"quantity"`
|
||||||
|
|
|
@ -8,6 +8,11 @@ import (
|
||||||
|
|
||||||
type StrInt64 int64
|
type StrInt64 int64
|
||||||
|
|
||||||
|
func (s *StrInt64) MarshalJSON() ([]byte, error) {
|
||||||
|
ss := strconv.FormatInt(int64(*s), 10)
|
||||||
|
return json.Marshal(ss)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *StrInt64) UnmarshalJSON(body []byte) error {
|
func (s *StrInt64) UnmarshalJSON(body []byte) error {
|
||||||
var arg interface{}
|
var arg interface{}
|
||||||
if err := json.Unmarshal(body, &arg); err != nil {
|
if err := json.Unmarshal(body, &arg); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user