From ac45bb306a953ec8d8dc78a30b83bd075714abac Mon Sep 17 00:00:00 2001 From: c9s Date: Sun, 14 Mar 2021 11:01:05 +0800 Subject: [PATCH] types: update deposit fields and withdraw fields --- pkg/types/deposit.go | 20 +++++++++++++------- pkg/types/withdraw.go | 32 +++++++++++++++++++------------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/pkg/types/deposit.go b/pkg/types/deposit.go index e75117f99..1f78c85e8 100644 --- a/pkg/types/deposit.go +++ b/pkg/types/deposit.go @@ -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() } diff --git a/pkg/types/withdraw.go b/pkg/types/withdraw.go index 803d585a6..02748fe9f 100644 --- a/pkg/types/withdraw.go +++ b/pkg/types/withdraw.go @@ -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"` - AddressTag string `json:"addressTag"` - Status string `json:"status"` + 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"` - WithdrawOrderID string `json:"withdrawOrderId"` - ApplyTime time.Time `json:"applyTime"` - Network string `json:"network"` + 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 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() }