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

View File

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