mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
ftx: add ioc order test
This commit is contained in:
parent
17034b2467
commit
3a488a4c0f
|
@ -8,6 +8,7 @@ import (
|
|||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -17,6 +18,46 @@ import (
|
|||
"github.com/c9s/bbgo/pkg/types"
|
||||
)
|
||||
|
||||
func integrationTestConfigured() (key, secret string, ok bool) {
|
||||
var hasKey, hasSecret bool
|
||||
key, hasKey = os.LookupEnv("FTX_API_KEY")
|
||||
secret, hasSecret = os.LookupEnv("FTX_API_SECRET")
|
||||
ok = hasKey && hasSecret && os.Getenv("TEST_FTX") == "1"
|
||||
return key, secret, ok
|
||||
}
|
||||
|
||||
func TestExchange_IOCOrder(t *testing.T) {
|
||||
key, secret, ok := integrationTestConfigured()
|
||||
if !ok {
|
||||
t.SkipNow()
|
||||
return
|
||||
}
|
||||
|
||||
ex := NewExchange(key, secret, "")
|
||||
createdOrder, err := ex.SubmitOrders(context.Background(), types.SubmitOrder{
|
||||
Symbol: "LTCUSDT",
|
||||
Side: types.SideTypeBuy,
|
||||
Type: types.OrderTypeLimitMaker,
|
||||
Quantity: fixedpoint.NewFromFloat(1.0),
|
||||
Price: fixedpoint.NewFromFloat(50.0),
|
||||
Market: types.Market{
|
||||
Symbol: "LTCUSDT",
|
||||
LocalSymbol: "LTC/USDT",
|
||||
PricePrecision: 3,
|
||||
VolumePrecision: 2,
|
||||
QuoteCurrency: "USDT",
|
||||
BaseCurrency: "LTC",
|
||||
MinQuantity: fixedpoint.NewFromFloat(0.01),
|
||||
StepSize: fixedpoint.NewFromFloat(0.01),
|
||||
TickSize: fixedpoint.NewFromFloat(0.01),
|
||||
},
|
||||
TimeInForce: "IOC",
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, createdOrder)
|
||||
t.Logf("created orders: %+v", createdOrder)
|
||||
}
|
||||
|
||||
func TestExchange_QueryAccountBalances(t *testing.T) {
|
||||
successResp := `
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user