From 57a78777df606c090eaf2b86587ade4788d57c6c Mon Sep 17 00:00:00 2001 From: c9s Date: Thu, 20 May 2021 01:32:26 +0800 Subject: [PATCH] move Time type to types.Time --- pkg/backtest/matching.go | 7 +++---- pkg/exchange/binance/convert.go | 7 +++---- pkg/exchange/binance/exchange.go | 5 ++--- pkg/exchange/binance/parse.go | 5 ++--- pkg/exchange/ftx/convert.go | 9 ++++----- pkg/exchange/ftx/exchange_test.go | 5 ++--- pkg/exchange/ftx/stream_message_handler_test.go | 7 +++---- pkg/exchange/max/convert.go | 7 +++---- pkg/exchange/max/exchange.go | 5 ++--- pkg/exchange/max/maxapi/reward.go | 3 +-- pkg/exchange/max/stream.go | 5 ++--- pkg/service/deposit_test.go | 3 +-- pkg/service/reward_test.go | 11 +++++------ pkg/service/withdraw_test.go | 3 +-- pkg/types/deposit.go | 4 +--- pkg/types/order.go | 17 ++++++++--------- pkg/types/reward.go | 3 +-- pkg/{datatype => types}/time.go | 2 +- pkg/types/trade.go | 13 ++++++------- pkg/types/withdraw.go | 14 ++++++-------- 20 files changed, 57 insertions(+), 78 deletions(-) rename pkg/{datatype => types}/time.go (98%) diff --git a/pkg/backtest/matching.go b/pkg/backtest/matching.go index 3bc208459..825d34381 100644 --- a/pkg/backtest/matching.go +++ b/pkg/backtest/matching.go @@ -9,7 +9,6 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/fixedpoint" "github.com/c9s/bbgo/pkg/types" ) @@ -237,7 +236,7 @@ func (m *SimplePriceMatching) newTradeFromOrder(order types.Order, isMaker bool) Side: order.Side, IsBuyer: order.Side == types.SideTypeBuy, IsMaker: isMaker, - Time: datatype.Time(m.CurrentTime), + Time: types.Time(m.CurrentTime), Fee: fee, FeeCurrency: feeCurrency, } @@ -439,7 +438,7 @@ func (m *SimplePriceMatching) newOrder(o types.SubmitOrder, orderID uint64) type Status: types.OrderStatusNew, ExecutedQuantity: 0, IsWorking: true, - CreationTime: datatype.Time(m.CurrentTime), - UpdateTime: datatype.Time(m.CurrentTime), + CreationTime: types.Time(m.CurrentTime), + UpdateTime: types.Time(m.CurrentTime), } } diff --git a/pkg/exchange/binance/convert.go b/pkg/exchange/binance/convert.go index 10aba5ef3..5060704d0 100644 --- a/pkg/exchange/binance/convert.go +++ b/pkg/exchange/binance/convert.go @@ -8,7 +8,6 @@ import ( "github.com/adshao/go-binance/v2" "github.com/pkg/errors" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/fixedpoint" "github.com/c9s/bbgo/pkg/types" "github.com/c9s/bbgo/pkg/util" @@ -150,8 +149,8 @@ func ToGlobalOrder(binanceOrder *binance.Order, isMargin bool) (*types.Order, er OrderID: uint64(binanceOrder.OrderID), Status: toGlobalOrderStatus(binanceOrder.Status), ExecutedQuantity: util.MustParseFloat(binanceOrder.ExecutedQuantity), - CreationTime: datatype.Time(millisecondTime(binanceOrder.Time)), - UpdateTime: datatype.Time(millisecondTime(binanceOrder.UpdateTime)), + CreationTime: types.Time(millisecondTime(binanceOrder.Time)), + UpdateTime: types.Time(millisecondTime(binanceOrder.UpdateTime)), IsMargin: isMargin, IsIsolated: binanceOrder.IsIsolated, }, nil @@ -208,7 +207,7 @@ func ToGlobalTrade(t binance.TradeV3, isMargin bool) (*types.Trade, error) { IsMaker: t.IsMaker, Fee: fee, FeeCurrency: t.CommissionAsset, - Time: datatype.Time(millisecondTime(t.Time)), + Time: types.Time(millisecondTime(t.Time)), IsMargin: isMargin, IsIsolated: t.IsIsolated, }, nil diff --git a/pkg/exchange/binance/exchange.go b/pkg/exchange/binance/exchange.go index e0f92297c..cabad7bf2 100644 --- a/pkg/exchange/binance/exchange.go +++ b/pkg/exchange/binance/exchange.go @@ -14,7 +14,6 @@ import ( "github.com/sirupsen/logrus" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/fixedpoint" "github.com/c9s/bbgo/pkg/types" "github.com/c9s/bbgo/pkg/util" @@ -283,7 +282,7 @@ func (e *Exchange) QueryWithdrawHistory(ctx context.Context, asset string, since txIDs[d.TxID] = struct{}{} allWithdraws = append(allWithdraws, types.Withdraw{ Exchange: types.ExchangeBinance, - ApplyTime: datatype.Time(time.Unix(0, d.ApplyTime*int64(time.Millisecond))), + ApplyTime: types.Time(time.Unix(0, d.ApplyTime*int64(time.Millisecond))), Asset: d.Asset, Amount: d.Amount, Address: d.Address, @@ -356,7 +355,7 @@ func (e *Exchange) QueryDepositHistory(ctx context.Context, asset string, since, txIDs[d.TxID] = struct{}{} allDeposits = append(allDeposits, types.Deposit{ Exchange: types.ExchangeBinance, - Time: datatype.Time(time.Unix(0, d.InsertTime*int64(time.Millisecond))), + Time: types.Time(time.Unix(0, d.InsertTime*int64(time.Millisecond))), Asset: d.Asset, Amount: d.Amount, Address: d.Address, diff --git a/pkg/exchange/binance/parse.go b/pkg/exchange/binance/parse.go index 110237a09..7923f8955 100644 --- a/pkg/exchange/binance/parse.go +++ b/pkg/exchange/binance/parse.go @@ -9,7 +9,6 @@ import ( "github.com/adshao/go-binance/v2" "github.com/valyala/fastjson" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/fixedpoint" "github.com/c9s/bbgo/pkg/types" "github.com/c9s/bbgo/pkg/util" @@ -126,7 +125,7 @@ func (e *ExecutionReportEvent) Order() (*types.Order, error) { OrderID: uint64(e.OrderID), Status: toGlobalOrderStatus(binance.OrderStatusType(e.CurrentOrderStatus)), ExecutedQuantity: util.MustParseFloat(e.CumulativeFilledQuantity), - CreationTime: datatype.Time(orderCreationTime), + CreationTime: types.Time(orderCreationTime), }, nil } @@ -147,7 +146,7 @@ func (e *ExecutionReportEvent) Trade() (*types.Trade, error) { QuoteQuantity: util.MustParseFloat(e.LastQuoteAssetTransactedQuantity), IsBuyer: e.Side == "BUY", IsMaker: e.IsMaker, - Time: datatype.Time(tt), + Time: types.Time(tt), Fee: util.MustParseFloat(e.CommissionAmount), FeeCurrency: e.CommissionAsset, }, nil diff --git a/pkg/exchange/ftx/convert.go b/pkg/exchange/ftx/convert.go index 9b886e44c..362faf5c9 100644 --- a/pkg/exchange/ftx/convert.go +++ b/pkg/exchange/ftx/convert.go @@ -7,7 +7,6 @@ import ( log "github.com/sirupsen/logrus" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/fixedpoint" "github.com/c9s/bbgo/pkg/types" ) @@ -52,8 +51,8 @@ func toGlobalOrder(r order) (types.Order, error) { OrderID: uint64(r.ID), Status: "", ExecutedQuantity: r.FilledSize, - CreationTime: datatype.Time(r.CreatedAt.Time), - UpdateTime: datatype.Time(r.CreatedAt.Time), + CreationTime: types.Time(r.CreatedAt.Time), + UpdateTime: types.Time(r.CreatedAt.Time), } // `new` (accepted but not processed yet), `open`, or `closed` (filled or cancelled) @@ -93,7 +92,7 @@ func toGlobalDeposit(input depositHistory) (types.Deposit, error) { d := types.Deposit{ GID: 0, Exchange: types.ExchangeFTX, - Time: datatype.Time(t.Time), + Time: types.Time(t.Time), Amount: input.Size, Asset: toGlobalCurrency(input.Coin), TransactionID: input.TxID, @@ -126,7 +125,7 @@ func toGlobalTrade(f fill) (types.Trade, error) { Side: f.Side, IsBuyer: f.Side == types.SideTypeBuy, IsMaker: f.Liquidity == "maker", - Time: datatype.Time(f.Time.Time), + Time: types.Time(f.Time.Time), Fee: f.Fee, FeeCurrency: f.FeeCurrency, IsMargin: false, diff --git a/pkg/exchange/ftx/exchange_test.go b/pkg/exchange/ftx/exchange_test.go index 246429569..a87bbe927 100644 --- a/pkg/exchange/ftx/exchange_test.go +++ b/pkg/exchange/ftx/exchange_test.go @@ -13,7 +13,6 @@ import ( "github.com/stretchr/testify/assert" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/fixedpoint" "github.com/c9s/bbgo/pkg/types" ) @@ -467,7 +466,7 @@ func TestExchange_QueryDepositHistory(t *testing.T) { assert.Len(t, dh, 1) assert.Equal(t, types.Deposit{ Exchange: types.ExchangeFTX, - Time: datatype.Time(actualConfirmedTime), + Time: types.Time(actualConfirmedTime), Amount: 99.0, Asset: "TUSD", TransactionID: "0x8078356ae4b06a036d64747546c274af19581f1c78c510b60505798a7ffcaf1", @@ -610,7 +609,7 @@ func TestExchange_QueryTrades(t *testing.T) { Side: types.SideTypeSell, IsBuyer: false, IsMaker: true, - Time: datatype.Time(actualConfirmedTime), + Time: types.Time(actualConfirmedTime), Fee: -0.0033625, FeeCurrency: "USD", IsMargin: false, diff --git a/pkg/exchange/ftx/stream_message_handler_test.go b/pkg/exchange/ftx/stream_message_handler_test.go index 95b3658a0..3d532ae22 100644 --- a/pkg/exchange/ftx/stream_message_handler_test.go +++ b/pkg/exchange/ftx/stream_message_handler_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/assert" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/types" ) @@ -55,8 +54,8 @@ func Test_messageHandler_handleMessage(t *testing.T) { OrderID: 36379, Status: types.OrderStatusFilled, ExecutedQuantity: 1.0, - CreationTime: datatype.Time(mustParseDatetime("2021-03-28T06:12:50.991447+00:00")), - UpdateTime: datatype.Time(mustParseDatetime("2021-03-28T06:12:50.991447+00:00")), + CreationTime: types.Time(mustParseDatetime("2021-03-28T06:12:50.991447+00:00")), + UpdateTime: types.Time(mustParseDatetime("2021-03-28T06:12:50.991447+00:00")), }, order) }) h.handleMessage(input) @@ -104,7 +103,7 @@ func Test_messageHandler_handleMessage(t *testing.T) { Side: types.SideTypeBuy, IsBuyer: true, IsMaker: false, - Time: datatype.Time(mustParseDatetime("2021-03-28T06:12:34.702926+00:00")), + Time: types.Time(mustParseDatetime("2021-03-28T06:12:34.702926+00:00")), Fee: 0.00153917575, FeeCurrency: "USD", IsMargin: false, diff --git a/pkg/exchange/max/convert.go b/pkg/exchange/max/convert.go index 1481cc319..3c9f6a474 100644 --- a/pkg/exchange/max/convert.go +++ b/pkg/exchange/max/convert.go @@ -8,7 +8,6 @@ import ( "github.com/pkg/errors" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/exchange/max/maxapi" "github.com/c9s/bbgo/pkg/fixedpoint" "github.com/c9s/bbgo/pkg/types" @@ -201,8 +200,8 @@ func toGlobalOrder(maxOrder max.Order) (*types.Order, error) { OrderID: maxOrder.ID, Status: toGlobalOrderStatus(maxOrder.State, executedVolume, remainingVolume), ExecutedQuantity: executedVolume.Float64(), - CreationTime: datatype.Time(maxOrder.CreatedAt), - UpdateTime: datatype.Time(maxOrder.CreatedAt), + CreationTime: types.Time(maxOrder.CreatedAt), + UpdateTime: types.Time(maxOrder.CreatedAt), }, nil } @@ -246,7 +245,7 @@ func toGlobalTrade(t max.Trade) (*types.Trade, error) { Fee: fee, FeeCurrency: toGlobalCurrency(t.FeeCurrency), QuoteQuantity: quoteQuantity, - Time: datatype.Time(mts), + Time: types.Time(mts), }, nil } diff --git a/pkg/exchange/max/exchange.go b/pkg/exchange/max/exchange.go index 42c718afc..df9ec4240 100644 --- a/pkg/exchange/max/exchange.go +++ b/pkg/exchange/max/exchange.go @@ -13,7 +13,6 @@ import ( "github.com/sirupsen/logrus" "golang.org/x/time/rate" - "github.com/c9s/bbgo/pkg/datatype" maxapi "github.com/c9s/bbgo/pkg/exchange/max/maxapi" "github.com/c9s/bbgo/pkg/fixedpoint" "github.com/c9s/bbgo/pkg/types" @@ -610,7 +609,7 @@ func (e *Exchange) QueryWithdrawHistory(ctx context.Context, asset string, since txIDs[d.TxID] = struct{}{} withdraw := types.Withdraw{ Exchange: types.ExchangeMax, - ApplyTime: datatype.Time(time.Unix(d.CreatedAt, 0)), + ApplyTime: types.Time(time.Unix(d.CreatedAt, 0)), Asset: toGlobalCurrency(d.Currency), Amount: util.MustParseFloat(d.Amount), Address: "", @@ -682,7 +681,7 @@ func (e *Exchange) QueryDepositHistory(ctx context.Context, asset string, since, allDeposits = append(allDeposits, types.Deposit{ Exchange: types.ExchangeMax, - Time: datatype.Time(time.Unix(d.CreatedAt, 0)), + Time: types.Time(time.Unix(d.CreatedAt, 0)), Amount: util.MustParseFloat(d.Amount), Asset: toGlobalCurrency(d.Currency), Address: "", // not supported diff --git a/pkg/exchange/max/maxapi/reward.go b/pkg/exchange/max/maxapi/reward.go index 188afae90..aceea0301 100644 --- a/pkg/exchange/max/maxapi/reward.go +++ b/pkg/exchange/max/maxapi/reward.go @@ -6,7 +6,6 @@ import ( "fmt" "strings" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/fixedpoint" "github.com/c9s/bbgo/pkg/types" ) @@ -112,7 +111,7 @@ func (reward Reward) Reward() (*types.Reward, error) { State: reward.State, Note: reward.Note, Spent: false, - CreatedAt: datatype.Time(reward.CreatedAt), + CreatedAt: types.Time(reward.CreatedAt), }, nil } diff --git a/pkg/exchange/max/stream.go b/pkg/exchange/max/stream.go index 330a07cf1..0845a5083 100644 --- a/pkg/exchange/max/stream.go +++ b/pkg/exchange/max/stream.go @@ -8,7 +8,6 @@ import ( "github.com/gorilla/websocket" - "github.com/c9s/bbgo/pkg/datatype" max "github.com/c9s/bbgo/pkg/exchange/max/maxapi" "github.com/c9s/bbgo/pkg/fixedpoint" "github.com/c9s/bbgo/pkg/types" @@ -226,7 +225,7 @@ func convertWebSocketTrade(t max.TradeUpdate) (*types.Trade, error) { Fee: fee, FeeCurrency: toGlobalCurrency(t.FeeCurrency), QuoteQuantity: quoteQuantity, - Time: datatype.Time(mts), + Time: types.Time(mts), }, nil } @@ -257,6 +256,6 @@ func toGlobalOrderUpdate(u max.OrderUpdate) (*types.Order, error) { OrderID: u.ID, Status: toGlobalOrderStatus(u.State, executedVolume, remainingVolume), ExecutedQuantity: executedVolume.Float64(), - CreationTime: datatype.Time(time.Unix(0, u.CreatedAtMs*int64(time.Millisecond))), + CreationTime: types.Time(time.Unix(0, u.CreatedAtMs*int64(time.Millisecond))), }, nil } diff --git a/pkg/service/deposit_test.go b/pkg/service/deposit_test.go index 8519098dc..2bd97b0b1 100644 --- a/pkg/service/deposit_test.go +++ b/pkg/service/deposit_test.go @@ -7,7 +7,6 @@ import ( "github.com/jmoiron/sqlx" "github.com/stretchr/testify/assert" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/types" ) @@ -24,7 +23,7 @@ func TestDepositService(t *testing.T) { err = service.Insert(types.Deposit{ Exchange: types.ExchangeMax, - Time: datatype.Time(time.Now()), + Time: types.Time(time.Now()), Amount: 0.001, Asset: "BTC", Address: "test", diff --git a/pkg/service/reward_test.go b/pkg/service/reward_test.go index ef8f13475..36661c468 100644 --- a/pkg/service/reward_test.go +++ b/pkg/service/reward_test.go @@ -8,7 +8,6 @@ import ( "github.com/jmoiron/sqlx" "github.com/stretchr/testify/assert" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/fixedpoint" "github.com/c9s/bbgo/pkg/types" ) @@ -34,7 +33,7 @@ func TestRewardService_InsertAndQueryUnspent(t *testing.T) { Quantity: 1, State: "done", Spent: false, - CreatedAt: datatype.Time(time.Now()), + CreatedAt: types.Time(time.Now()), }) assert.NoError(t, err) @@ -52,7 +51,7 @@ func TestRewardService_InsertAndQueryUnspent(t *testing.T) { Quantity: 1000000, State: "done", Spent: false, - CreatedAt: datatype.Time(time.Now()), + CreatedAt: types.Time(time.Now()), }) assert.NoError(t, err) @@ -99,7 +98,7 @@ func TestRewardService_AggregateUnspentCurrencyPosition(t *testing.T) { Quantity: 1, State: "done", Spent: false, - CreatedAt: datatype.Time(now), + CreatedAt: types.Time(now), }) assert.NoError(t, err) @@ -111,7 +110,7 @@ func TestRewardService_AggregateUnspentCurrencyPosition(t *testing.T) { Quantity: 2, State: "done", Spent: false, - CreatedAt: datatype.Time(now), + CreatedAt: types.Time(now), }) assert.NoError(t, err) @@ -123,7 +122,7 @@ func TestRewardService_AggregateUnspentCurrencyPosition(t *testing.T) { Quantity: 1000000, State: "done", Spent: false, - CreatedAt: datatype.Time(now), + CreatedAt: types.Time(now), }) assert.NoError(t, err) diff --git a/pkg/service/withdraw_test.go b/pkg/service/withdraw_test.go index 68ececc18..80c8d3b8e 100644 --- a/pkg/service/withdraw_test.go +++ b/pkg/service/withdraw_test.go @@ -7,7 +7,6 @@ import ( "github.com/jmoiron/sqlx" "github.com/stretchr/testify/assert" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/types" ) @@ -30,7 +29,7 @@ func TestWithdrawService(t *testing.T) { TransactionID: "01", TransactionFee: 0.0001, Network: "omni", - ApplyTime: datatype.Time(time.Now()), + ApplyTime: types.Time(time.Now()), }) assert.NoError(t, err) diff --git a/pkg/types/deposit.go b/pkg/types/deposit.go index 03a29724c..615ff90f1 100644 --- a/pkg/types/deposit.go +++ b/pkg/types/deposit.go @@ -2,8 +2,6 @@ package types import ( "time" - - "github.com/c9s/bbgo/pkg/datatype" ) type DepositStatus string @@ -26,7 +24,7 @@ const ( type Deposit struct { GID int64 `json:"gid" db:"gid"` Exchange ExchangeName `json:"exchange" db:"exchange"` - Time datatype.Time `json:"time" db:"time"` + Time Time `json:"time" db:"time"` Amount float64 `json:"amount" db:"amount"` Asset string `json:"asset" db:"asset"` Address string `json:"address" db:"address"` diff --git a/pkg/types/order.go b/pkg/types/order.go index aef9c587a..8a9fae151 100644 --- a/pkg/types/order.go +++ b/pkg/types/order.go @@ -9,7 +9,6 @@ import ( "github.com/pkg/errors" "github.com/slack-go/slack" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/util" ) @@ -145,14 +144,14 @@ func (o *SubmitOrder) SlackAttachment() slack.Attachment { type Order struct { SubmitOrder - Exchange ExchangeName `json:"exchange" db:"exchange"` - GID uint64 `json:"gid" db:"gid"` - OrderID uint64 `json:"orderID" db:"order_id"` // order id - Status OrderStatus `json:"status" db:"status"` - ExecutedQuantity float64 `json:"executedQuantity" db:"executed_quantity"` - IsWorking bool `json:"isWorking" db:"is_working"` - CreationTime datatype.Time `json:"creationTime" db:"created_at"` - UpdateTime datatype.Time `json:"updateTime" db:"updated_at"` + Exchange ExchangeName `json:"exchange" db:"exchange"` + GID uint64 `json:"gid" db:"gid"` + OrderID uint64 `json:"orderID" db:"order_id"` // order id + Status OrderStatus `json:"status" db:"status"` + ExecutedQuantity float64 `json:"executedQuantity" db:"executed_quantity"` + IsWorking bool `json:"isWorking" db:"is_working"` + CreationTime Time `json:"creationTime" db:"created_at"` + UpdateTime Time `json:"updateTime" db:"updated_at"` IsMargin bool `json:"isMargin" db:"is_margin"` IsIsolated bool `json:"isIsolated" db:"is_isolated"` diff --git a/pkg/types/reward.go b/pkg/types/reward.go index 9e262d2e7..a645e96e3 100644 --- a/pkg/types/reward.go +++ b/pkg/types/reward.go @@ -3,7 +3,6 @@ package types import ( "time" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/fixedpoint" ) @@ -30,7 +29,7 @@ type Reward struct { Spent bool `json:"spent" db:"spent"` // Unix timestamp in seconds - CreatedAt datatype.Time `json:"created_at" db:"created_at"` + CreatedAt Time `json:"created_at" db:"created_at"` } type RewardSlice []Reward diff --git a/pkg/datatype/time.go b/pkg/types/time.go similarity index 98% rename from pkg/datatype/time.go rename to pkg/types/time.go index 10e27c594..f531a209f 100644 --- a/pkg/datatype/time.go +++ b/pkg/types/time.go @@ -1,4 +1,4 @@ -package datatype +package types import ( "database/sql/driver" diff --git a/pkg/types/trade.go b/pkg/types/trade.go index ba4852d32..082020e2a 100644 --- a/pkg/types/trade.go +++ b/pkg/types/trade.go @@ -9,7 +9,6 @@ import ( "github.com/slack-go/slack" - "github.com/c9s/bbgo/pkg/datatype" "github.com/c9s/bbgo/pkg/util" ) @@ -59,12 +58,12 @@ type Trade struct { QuoteQuantity float64 `json:"quoteQuantity" db:"quote_quantity"` Symbol string `json:"symbol" db:"symbol"` - Side SideType `json:"side" db:"side"` - IsBuyer bool `json:"isBuyer" db:"is_buyer"` - IsMaker bool `json:"isMaker" db:"is_maker"` - Time datatype.Time `json:"tradedAt" db:"traded_at"` - Fee float64 `json:"fee" db:"fee"` - FeeCurrency string `json:"feeCurrency" db:"fee_currency"` + Side SideType `json:"side" db:"side"` + IsBuyer bool `json:"isBuyer" db:"is_buyer"` + IsMaker bool `json:"isMaker" db:"is_maker"` + Time Time `json:"tradedAt" db:"traded_at"` + Fee float64 `json:"fee" db:"fee"` + FeeCurrency string `json:"feeCurrency" db:"fee_currency"` IsMargin bool `json:"isMargin" db:"is_margin"` IsIsolated bool `json:"isIsolated" db:"is_isolated"` diff --git a/pkg/types/withdraw.go b/pkg/types/withdraw.go index d3ea2501d..a579a8ef4 100644 --- a/pkg/types/withdraw.go +++ b/pkg/types/withdraw.go @@ -3,8 +3,6 @@ package types import ( "fmt" "time" - - "github.com/c9s/bbgo/pkg/datatype" ) type Withdraw struct { @@ -16,12 +14,12 @@ type Withdraw struct { AddressTag string `json:"addressTag"` Status string `json:"status"` - 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"` + 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 `json:"applyTime" db:"time"` + Network string `json:"network" db:"network"` } func (w Withdraw) String() string {