types: update deposit fields and withdraw fields

This commit is contained in:
c9s 2021-03-14 11:01:05 +08:00
parent 2b485602ad
commit ac45bb306a
2 changed files with 32 additions and 20 deletions

View File

@ -1,6 +1,10 @@
package types package types
import "time" import (
"time"
"github.com/c9s/bbgo/pkg/datatype"
)
type DepositStatus string type DepositStatus string
@ -20,15 +24,17 @@ const (
) )
type Deposit struct { type Deposit struct {
Time time.Time `json:"time"` GID int64 `json:"gid" db:"gid"`
Amount float64 `json:"amount"` Exchange ExchangeName `json:"exchange" db:"exchange"`
Asset string `json:"asset"` Time datatype.Time `json:"time" db:"time"`
Address string `json:"address"` Amount float64 `json:"amount" db:"amount"`
Asset string `json:"asset" db:"asset"`
Address string `json:"address" db:"address"`
AddressTag string `json:"addressTag"` AddressTag string `json:"addressTag"`
TransactionID string `json:"txId"` TransactionID string `json:"transactionID" db:"txn_id"`
Status DepositStatus `json:"status"` Status DepositStatus `json:"status"`
} }
func (d Deposit) EffectiveTime() time.Time { func (d Deposit) EffectiveTime() time.Time {
return d.Time return d.Time.Time()
} }

View File

@ -1,22 +1,28 @@
package types package types
import "time" import (
"time"
"github.com/c9s/bbgo/pkg/datatype"
)
type Withdraw struct { type Withdraw struct {
ID string `json:"id"` GID int64 `json:"gid" db:"gid"`
Asset string `json:"asset"` Exchange ExchangeName `json:"exchange" db:"exchange"`
Amount float64 `json:"amount"` Asset string `json:"asset" db:"asset"`
Address string `json:"address"` Amount float64 `json:"amount" db:"amount"`
Address string `json:"address" db:"address"`
AddressTag string `json:"addressTag"` AddressTag string `json:"addressTag"`
Status string `json:"status"` Status string `json:"status"`
TransactionID string `json:"txId"` TransactionID string `json:"transactionID" db:"txn_id"`
TransactionFee float64 `json:"transactionFee"` TransactionFee float64 `json:"transactionFee" db:"txn_fee"`
TransactionFeeCurrency string `json:"transactionFeeCurrency" db:"txn_fee_currency"`
WithdrawOrderID string `json:"withdrawOrderId"` WithdrawOrderID string `json:"withdrawOrderId"`
ApplyTime time.Time `json:"applyTime"` ApplyTime datatype.Time `json:"applyTime" db:"time"`
Network string `json:"network"` Network string `json:"network" db:"network"`
} }
func (w Withdraw) EffectiveTime() time.Time { func (w Withdraw) EffectiveTime() time.Time {
return w.ApplyTime return w.ApplyTime.Time()
} }