mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-31 15:10:42 +00:00
FTX: Add REST staking and basic subaccount functionality (#692)
* Add FTX staking, missing margin APIs and basic subaccount support * Fix backtester tests and add optional subaccount support to exchange_wrapper_issues tool * subAccount to subaccount * Fix TyPo * Expand test coverage * Address nitterinos * Fix typos * Remove unusued error type
This commit is contained in:
@@ -652,6 +652,9 @@ func loadLiveData(cfg *config.Config, base *gctexchange.Base) error {
|
||||
if cfg.DataSettings.LiveData.API2FAOverride != "" {
|
||||
base.API.Credentials.PEMKey = cfg.DataSettings.LiveData.API2FAOverride
|
||||
}
|
||||
if cfg.DataSettings.LiveData.APISubaccountOverride != "" {
|
||||
base.API.Credentials.Subaccount = cfg.DataSettings.LiveData.APISubaccountOverride
|
||||
}
|
||||
validated := base.ValidateAPICredentials()
|
||||
base.API.AuthenticatedSupport = validated
|
||||
if !validated && cfg.DataSettings.LiveData.RealOrders {
|
||||
|
||||
@@ -228,11 +228,12 @@ func TestLoadData(t *testing.T) {
|
||||
}
|
||||
cfg.DataSettings.CSVData = nil
|
||||
cfg.DataSettings.LiveData = &config.LiveData{
|
||||
APIKeyOverride: "test",
|
||||
APISecretOverride: "test",
|
||||
APIClientIDOverride: "test",
|
||||
API2FAOverride: "test",
|
||||
RealOrders: true,
|
||||
APIKeyOverride: "test",
|
||||
APISecretOverride: "test",
|
||||
APIClientIDOverride: "test",
|
||||
API2FAOverride: "test",
|
||||
APISubaccountOverride: "test",
|
||||
RealOrders: true,
|
||||
}
|
||||
_, err = bt.loadData(cfg, exch, cp, asset.Spot)
|
||||
if err != nil {
|
||||
@@ -305,10 +306,11 @@ func TestLoadLiveData(t *testing.T) {
|
||||
AuthenticatedWebsocketSupport: false,
|
||||
PEMKeySupport: false,
|
||||
Credentials: struct {
|
||||
Key string
|
||||
Secret string
|
||||
ClientID string
|
||||
PEMKey string
|
||||
Key string
|
||||
Secret string
|
||||
ClientID string
|
||||
PEMKey string
|
||||
Subaccount string
|
||||
}{},
|
||||
CredentialsValidator: struct {
|
||||
RequiresPEM bool
|
||||
@@ -344,6 +346,7 @@ func TestLoadLiveData(t *testing.T) {
|
||||
cfg.DataSettings.LiveData.APISecretOverride = "1234"
|
||||
cfg.DataSettings.LiveData.APIClientIDOverride = "1234"
|
||||
cfg.DataSettings.LiveData.API2FAOverride = "1234"
|
||||
cfg.DataSettings.LiveData.APISubaccountOverride = "1234"
|
||||
err = loadLiveData(cfg, b)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
|
||||
Reference in New Issue
Block a user