mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
types: add gid field
This commit is contained in:
parent
279e4d8682
commit
bdc76e8db6
|
@ -38,7 +38,7 @@ func prepareDB(t *testing.T) (*rockhopper.DB, error) {
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
err = rockhopper.Up(ctx, db, migrations, 0, 0)
|
err = rockhopper.Up(ctx, db, migrations, 0, 0)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err, "should migrate successfully")
|
||||||
|
|
||||||
return db, err
|
return db, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,19 +25,24 @@ func TestMarginService(t *testing.T) {
|
||||||
ex.MarginSettings.IsIsolatedMargin = true
|
ex.MarginSettings.IsIsolatedMargin = true
|
||||||
ex.MarginSettings.IsolatedMarginSymbol = "DOTUSDT"
|
ex.MarginSettings.IsolatedMarginSymbol = "DOTUSDT"
|
||||||
|
|
||||||
|
logrus.SetLevel(logrus.ErrorLevel)
|
||||||
db, err := prepareDB(t)
|
db, err := prepareDB(t)
|
||||||
|
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fail()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
logrus.SetLevel(logrus.DebugLevel)
|
|
||||||
|
|
||||||
dbx := sqlx.NewDb(db.DB, "sqlite3")
|
dbx := sqlx.NewDb(db.DB, "sqlite3")
|
||||||
service := &MarginService{DB: dbx}
|
service := &MarginService{DB: dbx}
|
||||||
|
|
||||||
|
logrus.SetLevel(logrus.DebugLevel)
|
||||||
err = service.Sync(ctx, ex, "USDT", time.Date(2022, time.February, 1, 0, 0, 0, 0, time.UTC))
|
err = service.Sync(ctx, ex, "USDT", time.Date(2022, time.February, 1, 0, 0, 0, 0, time.UTC))
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ func Test_fieldsNamesOf(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "MarginInterest",
|
name: "MarginInterest",
|
||||||
args: args{record: &types.MarginInterest{}},
|
args: args{record: &types.MarginInterest{}},
|
||||||
want: []string{"exchange", "asset", "principle", "interest", "interest_rate", "isolated_symbol", "time"},
|
want: []string{"gid", "exchange", "asset", "principle", "interest", "interest_rate", "isolated_symbol", "time"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
|
|
@ -60,6 +60,7 @@ type MarginBorrowRepayService interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MarginInterest struct {
|
type MarginInterest struct {
|
||||||
|
GID uint64 `json:"gid" db:"gid"`
|
||||||
Exchange ExchangeName `json:"exchange" db:"exchange"`
|
Exchange ExchangeName `json:"exchange" db:"exchange"`
|
||||||
Asset string `json:"asset" db:"asset"`
|
Asset string `json:"asset" db:"asset"`
|
||||||
Principle fixedpoint.Value `json:"principle" db:"principle"`
|
Principle fixedpoint.Value `json:"principle" db:"principle"`
|
||||||
|
@ -70,6 +71,7 @@ type MarginInterest struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MarginLoan struct {
|
type MarginLoan struct {
|
||||||
|
GID uint64 `json:"gid" db:"gid"`
|
||||||
Exchange ExchangeName `json:"exchange" db:"exchange"`
|
Exchange ExchangeName `json:"exchange" db:"exchange"`
|
||||||
TransactionID uint64 `json:"transactionID" db:"transaction_id"`
|
TransactionID uint64 `json:"transactionID" db:"transaction_id"`
|
||||||
Asset string `json:"asset" db:"asset"`
|
Asset string `json:"asset" db:"asset"`
|
||||||
|
@ -79,6 +81,7 @@ type MarginLoan struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MarginRepay struct {
|
type MarginRepay struct {
|
||||||
|
GID uint64 `json:"gid" db:"gid"`
|
||||||
Exchange ExchangeName `json:"exchange" db:"exchange"`
|
Exchange ExchangeName `json:"exchange" db:"exchange"`
|
||||||
TransactionID uint64 `json:"transactionID" db:"transaction_id"`
|
TransactionID uint64 `json:"transactionID" db:"transaction_id"`
|
||||||
Asset string `json:"asset" db:"asset"`
|
Asset string `json:"asset" db:"asset"`
|
||||||
|
@ -88,6 +91,7 @@ type MarginRepay struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MarginLiquidation struct {
|
type MarginLiquidation struct {
|
||||||
|
GID uint64 `json:"gid" db:"gid"`
|
||||||
Exchange ExchangeName `json:"exchange" db:"exchange"`
|
Exchange ExchangeName `json:"exchange" db:"exchange"`
|
||||||
AveragePrice fixedpoint.Value `json:"averagePrice" db:"average_price"`
|
AveragePrice fixedpoint.Value `json:"averagePrice" db:"average_price"`
|
||||||
ExecutedQuantity fixedpoint.Value `json:"executedQuantity" db:"executed_quantity"`
|
ExecutedQuantity fixedpoint.Value `json:"executedQuantity" db:"executed_quantity"`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user