diff --git a/config/config.go b/config/config.go index 3b956fc3..17b2e18f 100644 --- a/config/config.go +++ b/config/config.go @@ -96,6 +96,7 @@ type Config struct { Portfolio portfolio.Base `json:"PortfolioAddresses"` Webserver WebserverConfig `json:"Webserver"` Exchanges []ExchangeConfig `json:"Exchanges"` + BankAccounts []BankAccount `json:"BankAccounts"` // Deprecated config settings, will be removed at a future date CurrencyPairFormat *CurrencyPairFormatConfig `json:"CurrencyPairFormat,omitempty"` @@ -125,6 +126,29 @@ type ExchangeConfig struct { PairsLastUpdated int64 `json:",omitempty"` ConfigCurrencyPairFormat *CurrencyPairFormatConfig `json:"ConfigCurrencyPairFormat"` RequestCurrencyPairFormat *CurrencyPairFormatConfig `json:"RequestCurrencyPairFormat"` + BankAccounts []BankAccount +} + +// BankAccount holds differing bank account details by supported funding +// currency +type BankAccount struct { + Enabled bool `json:",omitempty"` + BankName string + BankAddress string + AccountName string + AccountNumber string + SWIFTCode string + IBAN string + BSBNumber string `json:",omitempty"` + SupportedCurrencies string + SupportedExchanges string `json:",omitempty"` +} + +// BankTransaction defines a related banking transaction +type BankTransaction struct { + ReferenceNumber string + TransactionNumber string + PaymentInstructions string } // CurrencyConfig holds all the information needed for currency related manipulation @@ -196,6 +220,120 @@ func (c *Config) GetCurrencyConfig() CurrencyConfig { return c.Currency } +// GetExchangeBankAccounts returns banking details associated with an exchange +// for depositing funds +func (c *Config) GetExchangeBankAccounts(exchangeName, depositingCurrency string) (BankAccount, error) { + m.Lock() + defer m.Unlock() + + for _, exch := range c.Exchanges { + if exch.Name == exchangeName { + for _, account := range exch.BankAccounts { + if common.StringContains(account.SupportedCurrencies, depositingCurrency) { + return account, nil + } + } + } + } + return BankAccount{}, fmt.Errorf("Exchange %s bank details not found for %s", + exchangeName, + depositingCurrency) +} + +// UpdateExchangeBankAccounts updates the configuration for the associated +// exchange bank +func (c *Config) UpdateExchangeBankAccounts(exchangeName string, bankCfg []BankAccount) error { + m.Lock() + defer m.Unlock() + + for i := range c.Exchanges { + if c.Exchanges[i].Name == exchangeName { + c.Exchanges[i].BankAccounts = bankCfg + return nil + } + } + return fmt.Errorf("UpdateExchangeBankAccounts() error exchange %s not found", + exchangeName) +} + +// GetClientBankAccounts returns banking details used for a given exchange +// and currency +func (c *Config) GetClientBankAccounts(exchangeName, targetCurrency string) (BankAccount, error) { + m.Lock() + defer m.Unlock() + + for _, bank := range c.BankAccounts { + if (common.StringContains(bank.SupportedExchanges, exchangeName) || bank.SupportedExchanges == "ALL") && common.StringContains(bank.SupportedCurrencies, targetCurrency) { + return bank, nil + + } + } + return BankAccount{}, fmt.Errorf("client banking details not found for %s and currency %s", + exchangeName, + targetCurrency) +} + +// UpdateClientBankAccounts updates the configuration for a bank +func (c *Config) UpdateClientBankAccounts(bankCfg BankAccount) error { + m.Lock() + defer m.Unlock() + + for i := range c.BankAccounts { + if c.BankAccounts[i].BankName == bankCfg.BankName && c.BankAccounts[i].AccountNumber == bankCfg.AccountNumber { + c.BankAccounts[i] = bankCfg + return nil + } + } + return fmt.Errorf("client banking details for %s not found, update not applied", + bankCfg.BankName) +} + +// CheckClientBankAccounts checks client bank details +func (c *Config) CheckClientBankAccounts() error { + m.Lock() + defer m.Unlock() + + if len(c.BankAccounts) == 0 { + c.BankAccounts = append(c.BankAccounts, + BankAccount{ + BankName: "test", + BankAddress: "test", + AccountName: "TestAccount", + AccountNumber: "0234", + SWIFTCode: "91272837", + IBAN: "98218738671897", + SupportedCurrencies: "USD", + SupportedExchanges: "ANX,Kraken", + }, + ) + return nil + } + + for _, bank := range c.BankAccounts { + if bank.Enabled == true { + if bank.BankName == "" || bank.BankAddress == "" { + return fmt.Errorf("banking details for %s is enabled but variables not set correctly", + bank.BankName) + } + + if bank.AccountName == "" || bank.AccountNumber == "" { + return fmt.Errorf("banking account details for %s variables not set correctly", + bank.BankName) + } + if bank.IBAN == "" && bank.SWIFTCode == "" && bank.BSBNumber == "" { + return fmt.Errorf("critical banking numbers not set for %s in %s account", + bank.BankName, + bank.AccountName) + } + + if bank.SupportedExchanges == "" { + bank.SupportedExchanges = "ALL" + } + } + } + return nil +} + // GetCommunicationsConfig returns the communications configuration func (c *Config) GetCommunicationsConfig() CommunicationsConfig { m.Lock() @@ -510,6 +648,35 @@ func (c *Config) CheckExchangeConfigValues() error { log.Printf("Exchange %s HTTP Timeout value not set, defaulting to %v.", exch.Name, configDefaultHTTPTimeout) c.Exchanges[i].HTTPTimeout = configDefaultHTTPTimeout } + + if len(exch.BankAccounts) == 0 { + c.Exchanges[i].BankAccounts = append(c.Exchanges[i].BankAccounts, BankAccount{}) + } else { + for _, bankAccount := range exch.BankAccounts { + if bankAccount.Enabled == true { + if bankAccount.BankName == "" || bankAccount.BankAddress == "" { + return fmt.Errorf("banking details for %s is enabled but variables not set", + exch.Name) + } + + if bankAccount.AccountName == "" || bankAccount.AccountNumber == "" { + return fmt.Errorf("banking account details for %s variables not set", + exch.Name) + } + + if bankAccount.SupportedCurrencies == "" { + return fmt.Errorf("banking account details for %s acceptable funding currencies not set", + exch.Name) + } + + if bankAccount.BSBNumber == "" && bankAccount.IBAN == "" && + bankAccount.SWIFTCode == "" { + return fmt.Errorf("banking account details for %s critical banking numbers not set", + exch.Name) + } + } + } + } exchanges++ } } @@ -815,7 +982,6 @@ func (c *Config) SaveConfig(configPath string) error { if c.EncryptConfig == configFileEncryptionEnabled { var key []byte - var err error if IsInitialSetup { key, err = PromptForConfigKey(true) @@ -867,6 +1033,11 @@ func (c *Config) CheckConfig() error { c.GlobalHTTPTimeout = configDefaultHTTPTimeout } + err = c.CheckClientBankAccounts() + if err != nil { + return err + } + return nil } diff --git a/config/config_encryption_test.go b/config/config_encryption_test.go index 8c7a1332..f75166b4 100644 --- a/config/config_encryption_test.go +++ b/config/config_encryption_test.go @@ -59,17 +59,17 @@ func TestDecryptConfigFile(t *testing.T) { t.Fatal(err) } - result, err = DecryptConfigFile(result, nil) + _, err = DecryptConfigFile(result, nil) if err == nil { t.Fatal("Test failed. Expected different result") } - result, err = DecryptConfigFile([]byte("test"), nil) + _, err = DecryptConfigFile([]byte("test"), nil) if err == nil { t.Fatal("Test failed. Expected different result") } - result, err = DecryptConfigFile([]byte("test"), []byte("AAAAAAAAAAAAAAAA")) + _, err = DecryptConfigFile([]byte("test"), []byte("AAAAAAAAAAAAAAAA")) if err == nil { t.Fatalf("Test failed. Expected %s", errAESBlockSize) } @@ -79,7 +79,7 @@ func TestDecryptConfigFile(t *testing.T) { t.Fatal(err) } - result, err = DecryptConfigFile(result, []byte("key")) + _, err = DecryptConfigFile(result, []byte("key")) if err != nil { t.Fatal(err) } diff --git a/config/config_test.go b/config/config_test.go index a5fed91b..83a5071d 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -7,6 +7,123 @@ import ( "github.com/thrasher-/gocryptotrader/currency/pair" ) +func TestGetCurrencyConfig(t *testing.T) { + cfg := GetConfig() + err := cfg.LoadConfig(ConfigTestFile) + if err != nil { + t.Error("Test failed. GetCurrencyConfig LoadConfig error", err) + } + _ = cfg.GetCurrencyConfig() +} + +func TestGetExchangeBankAccounts(t *testing.T) { + cfg := GetConfig() + err := cfg.LoadConfig(ConfigTestFile) + if err != nil { + t.Error("Test failed. GetDepositBankAccounts LoadConfig error", err) + } + _, err = cfg.GetExchangeBankAccounts("Bitfinex", "USD") + if err != nil { + t.Error("Test failed. GetDepositBankAccounts error", err) + } +} + +func TestUpdateExchangeBankAccounts(t *testing.T) { + cfg := GetConfig() + err := cfg.LoadConfig(ConfigTestFile) + if err != nil { + t.Error("Test failed. UpdateDepositBankAccounts LoadConfig error", err) + } + + b := []BankAccount{BankAccount{Enabled: false}} + err = cfg.UpdateExchangeBankAccounts("Bitfinex", b) + if err != nil { + t.Error("Test failed. UpdateDepositBankAccounts error", err) + } + var count int + for _, exch := range cfg.Exchanges { + if exch.Name == "Bitfinex" { + if exch.BankAccounts[0].Enabled == false { + count++ + } + } + } + if count != 1 { + t.Error("Test failed. UpdateDepositBankAccounts error") + } +} + +func TestGetClientBankAccounts(t *testing.T) { + cfg := GetConfig() + err := cfg.LoadConfig(ConfigTestFile) + if err != nil { + t.Error("Test failed. GetClientBankAccounts LoadConfig error", err) + } + _, err = cfg.GetClientBankAccounts("Kraken", "USD") + if err != nil { + t.Error("Test failed. GetClientBankAccounts error", err) + } + _, err = cfg.GetClientBankAccounts("Bla", "USD") + if err == nil { + t.Error("Test failed. GetClientBankAccounts error") + } + _, err = cfg.GetClientBankAccounts("Kraken", "JPY") + if err == nil { + t.Error("Test failed. GetClientBankAccounts error", err) + } +} + +func TestUpdateClientBankAccounts(t *testing.T) { + cfg := GetConfig() + err := cfg.LoadConfig(ConfigTestFile) + if err != nil { + t.Error("Test failed. UpdateClientBankAccounts LoadConfig error", err) + } + b := BankAccount{Enabled: false, BankName: "test", AccountNumber: "0234"} + err = cfg.UpdateClientBankAccounts(b) + if err != nil { + t.Error("Test failed. UpdateClientBankAccounts error", err) + } + + err = cfg.UpdateClientBankAccounts(BankAccount{}) + if err == nil { + t.Error("Test failed. UpdateClientBankAccounts error") + } + + var count int + for _, bank := range cfg.BankAccounts { + if bank.BankName == b.BankName { + if bank.Enabled == false { + count++ + } + } + } + if count != 1 { + t.Error("Test failed. UpdateDepositBankAccounts error") + } +} + +func TestGetCommunicationsConfig(t *testing.T) { + cfg := GetConfig() + err := cfg.LoadConfig(ConfigTestFile) + if err != nil { + t.Error("Test failed. GetCommunicationsConfig LoadConfig error", err) + } + _ = cfg.GetCommunicationsConfig() +} + +func TestUpdateCommunicationsConfig(t *testing.T) { + cfg := GetConfig() + err := cfg.LoadConfig(ConfigTestFile) + if err != nil { + t.Error("Test failed. UpdateCommunicationsConfig LoadConfig error", err) + } + cfg.UpdateCommunicationsConfig(CommunicationsConfig{SlackConfig: SlackConfig{Name: "TEST"}}) + if cfg.Communications.SlackConfig.Name != "TEST" { + t.Error("Test failed. UpdateCommunicationsConfig LoadConfig error") + } +} + func TestSupportsPair(t *testing.T) { cfg := GetConfig() err := cfg.LoadConfig(ConfigTestFile) @@ -218,6 +335,17 @@ func TestGetCurrencyPairDisplayConfig(t *testing.T) { } } +func TestGetAllExchangeConfigs(t *testing.T) { + cfg := GetConfig() + err := cfg.LoadConfig(ConfigTestFile) + if err != nil { + t.Error("Test failed. GetAllExchangeConfigs. LoadConfig error", err) + } + if len(cfg.GetAllExchangeConfigs()) < 26 { + t.Error("Test failed. GetAllExchangeConfigs error") + } +} + func TestGetExchangeConfig(t *testing.T) { GetExchangeConfig := GetConfig() err := GetExchangeConfig.LoadConfig(ConfigTestFile) @@ -226,18 +354,41 @@ func TestGetExchangeConfig(t *testing.T) { "Test failed. GetExchangeConfig.LoadConfig Error: %s", err.Error(), ) } - r, err := GetExchangeConfig.GetExchangeConfig("ANX") - if err != nil && (ExchangeConfig{}) == r { - t.Errorf( - "Test failed. GetExchangeConfig.GetExchangeConfig Error: %s", err.Error(), - ) + _, err = GetExchangeConfig.GetExchangeConfig("ANX") + if err != nil { + t.Errorf("Test failed. GetExchangeConfig.GetExchangeConfig Error: %s", + err.Error()) } - r, err = GetExchangeConfig.GetExchangeConfig("Testy") - if err == nil && (ExchangeConfig{}) == r { + _, err = GetExchangeConfig.GetExchangeConfig("Testy") + if err == nil { t.Error("Test failed. GetExchangeConfig.GetExchangeConfig Error") } } +func TestGetForexProviderConfig(t *testing.T) { + cfg := GetConfig() + err := cfg.LoadConfig(ConfigTestFile) + if err != nil { + t.Error("Test failed. GetForexProviderConfig. LoadConfig error", err) + } + _, err = cfg.GetForexProviderConfig("Fixer") + if err != nil { + t.Error("Test failed. GetForexProviderConfig error", err) + } +} + +func TestGetPrimaryForexProvider(t *testing.T) { + cfg := GetConfig() + err := cfg.LoadConfig(ConfigTestFile) + if err != nil { + t.Error("Test failed. GetPrimaryForexProvider. LoadConfig error", err) + } + primary := cfg.GetPrimaryForexProvider() + if primary == "" { + t.Error("Test failed. GetPrimaryForexProvider error") + } +} + func TestUpdateExchangeConfig(t *testing.T) { UpdateExchangeConfig := GetConfig() err := UpdateExchangeConfig.LoadConfig(ConfigTestFile) @@ -514,9 +665,7 @@ func TestGetFilePath(t *testing.T) { if result != expected { t.Errorf("Test failed. TestGetFilePath: expected %s got %s", expected, result) } - testBypass = true - result, _ = GetFilePath("") } func TestCheckConfig(t *testing.T) { @@ -552,6 +701,9 @@ func TestUpdateConfig(t *testing.T) { newCfg.Currency.Cryptocurrencies = "" err = c.UpdateConfig("", newCfg) + if err != nil { + t.Errorf("Test failed. %s", err) + } if len(c.Currency.Cryptocurrencies) == 0 { t.Fatalf("Test failed. Cryptocurrencies should have been repopulated") } diff --git a/config_example.json b/config_example.json index 0f47a954..015852a4 100644 --- a/config_example.json +++ b/config_example.json @@ -147,7 +147,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Binance", @@ -171,7 +182,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Bitfinex", @@ -194,7 +216,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Bitflyer", @@ -220,7 +253,18 @@ "RequestCurrencyPairFormat": { "Uppercase": true, "Delimiter": "_" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Bithumb", @@ -245,7 +289,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Bitstamp", @@ -269,7 +324,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Bittrex", @@ -294,7 +360,18 @@ "RequestCurrencyPairFormat": { "Uppercase": true, "Delimiter": "-" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "BTCC", @@ -317,7 +394,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": false - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "BTC Markets", @@ -340,7 +428,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "COINUT", @@ -364,7 +463,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "EXMO", @@ -390,7 +500,18 @@ "Uppercase": true, "Delimiter": "_", "Separator": "," - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "CoinbasePro", @@ -415,7 +536,18 @@ "RequestCurrencyPairFormat": { "Uppercase": true, "Delimiter": "-" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Gemini", @@ -438,7 +570,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "HitBTC", @@ -462,7 +605,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Huobi", @@ -486,7 +640,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": false - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "ITBIT", @@ -511,7 +676,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Kraken", @@ -536,7 +712,18 @@ "RequestCurrencyPairFormat": { "Uppercase": true, "Separator": "," - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "LakeBTC", @@ -559,7 +746,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Liqui", @@ -585,7 +783,18 @@ "Uppercase": false, "Delimiter": "_", "Separator": "-" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "LocalBitcoins", @@ -609,7 +818,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "OKCOIN China", @@ -634,7 +854,18 @@ "RequestCurrencyPairFormat": { "Uppercase": false, "Delimiter": "_" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "OKCOIN International", @@ -659,7 +890,18 @@ "RequestCurrencyPairFormat": { "Uppercase": false, "Delimiter": "_" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "OKEX", @@ -685,7 +927,18 @@ "RequestCurrencyPairFormat": { "Uppercase": false, "Delimiter": "_" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Poloniex", @@ -710,7 +963,18 @@ "RequestCurrencyPairFormat": { "Uppercase": true, "Delimiter": "_" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "WEX", @@ -723,7 +987,7 @@ "AuthenticatedAPISupport": false, "APIKey": "Key", "APISecret": "Secret", - "AvailablePairs": "BCH_USD,BCH_BTC,USDET_USD,LTC_USD,LTC_EUR,DSH_LTC,ETH_USD,NMCET_NMC,USDT_USD,LTC_RUR,EUR_USD,EUR_RUR,PPC_BTC,DSH_ZEC,ETH_EUR,ETH_ZEC,BCH_EUR,BTC_EUR,NMC_BTC,NVC_BTC,DSH_EUR,EURET_EUR,RURET_RUR,BTC_RUR,LTC_BTC,PPC_USD,DSH_RUR,BTC_USD,ETH_RUR,BCH_ETH,PPCET_PPC,BCH_RUR,BCH_LTC,BTCET_BTC,LTCET_LTC,NVC_USD,DSH_ETH,ETH_BTC,ETH_LTC,ETHET_ETH,NVCET_NVC,BCHET_BCH,USD_RUR,DSH_USD,BCH_ZEC,ZEC_BTC,ZEC_LTC,DSHET_DSH,NMC_USD,DSH_BTC,BCH_DSH,ZEC_USD", + "AvailablePairs": "BTC_RUR,BCH_RUR,BCH_ETH,BCH_ZEC,BTC_USDT,LTC_BTC,ETH_LTC,ZEC_USD,BCH_EUR,BCH_LTC,ZEC_BTC,LTC_USD,LTC_EUR,DSH_RUR,BCH_BTC,NVC_BTC,PPC_USD,BCH_DSH,LTCET_LTC,ETHET_ETH,NMC_USD,DSH_ZEC,ETH_RUR,NMC_BTC,DSH_LTC,ZEC_LTC,EURET_EUR,LTC_RUR,EUR_USD,ETH_ZEC,RURET_RUR,NMCET_NMC,PPCET_PPC,BTC_EUR,NVCET_NVC,DSHET_DSH,BCH_USD,BTCET_BTC,NVC_USD,DSH_BTC,DSH_USD,DSH_EUR,USDET_USD,BTC_USD,ETH_USD,USD_RUR,EUR_RUR,DSH_ETH,ETH_EUR,BCHET_BCH,USDT_USD,PPC_BTC,ETH_BTC", "EnabledPairs": "BTC_USD,LTC_USD,LTC_BTC,ETH_USD", "BaseCurrencies": "USD,RUR,EUR", "AssetTypes": "SPOT", @@ -736,7 +1000,18 @@ "Uppercase": false, "Delimiter": "_", "Separator": "-" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Yobit", @@ -763,7 +1038,30 @@ "Uppercase": false, "Delimiter": "_", "Separator": "-" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] + } + ], + "BankAccounts": [ + { + "BankName": "test", + "BankAddress": "test", + "AccountName": "TestAccount", + "AccountNumber": "0234", + "SWIFTCode": "91272837", + "IBAN": "98218738671897", + "SupportedCurrencies": "USD", + "SupportedExchanges": "ANX,Kraken" } ] } \ No newline at end of file diff --git a/exchanges/alphapoint/alphapoint_wrapper.go b/exchanges/alphapoint/alphapoint_wrapper.go index 75d6312a..bb4d1fc2 100644 --- a/exchanges/alphapoint/alphapoint_wrapper.go +++ b/exchanges/alphapoint/alphapoint_wrapper.go @@ -89,6 +89,13 @@ func (a *Alphapoint) GetOrderbookEx(p pair.CurrencyPair, assetType string) (orde return ob, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (a *Alphapoint) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (a *Alphapoint) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -98,24 +105,28 @@ func (a *Alphapoint) GetExchangeHistory(p pair.CurrencyPair, assetType string) ( // SubmitExchangeOrder submits a new order and returns a true value when // successfully submitted -func (a *Alphapoint) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { - return a.CreateOrder(p.Pair().String(), side, orderType, amount, price) +func (a *Alphapoint) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { + //return a.CreateOrder(p.Pair().String(), side, orderType, amount, price) + return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (a *Alphapoint) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { - return a.ModifyOrder(p.Pair().String(), orderID, action) +func (a *Alphapoint) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { + //return a.ModifyOrder(p.Pair().String(), orderID, action) + return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (a *Alphapoint) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return a.CancelOrder(p.Pair().String(), orderID) +func (a *Alphapoint) CancelExchangeOrder(orderID int64) error { + //return a.CancelOrder(p.Pair().String(), orderID) + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (a *Alphapoint) CancelAllExchangeOrders(p pair.CurrencyPair) error { - return a.CancelAllOrders(p.Pair().String()) +func (a *Alphapoint) CancelAllExchangeOrders() error { + //return a.CancelAllOrders(p.Pair().String()) + return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order @@ -136,21 +147,27 @@ func (a *Alphapoint) GetExchangeOrderInfo(orderID int64) (float64, error) { } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (a *Alphapoint) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (a *Alphapoint) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { addreses, err := a.GetDepositAddresses() if err != nil { return "", err } for x := range addreses { - if addreses[x].Name == p.Pair().String() { + if addreses[x].Name == cryptocurrency.String() { return addreses[x].DepositAddress, nil } } return "", errors.New("associated currency address not found") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (a *Alphapoint) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { - return "", a.WithdrawCoins(p.Pair().String(), p.GetFirstCurrency().String(), address, amount) +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (a *Alphapoint) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFunds returns a withdrawal ID when a withdrawal is submitted +func (a *Alphapoint) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") } diff --git a/exchanges/anx/anx_wrapper.go b/exchanges/anx/anx_wrapper.go index 31bc447e..703518c3 100644 --- a/exchanges/anx/anx_wrapper.go +++ b/exchanges/anx/anx_wrapper.go @@ -181,6 +181,13 @@ func (a *ANX) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (a *ANX) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (a *ANX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -189,37 +196,51 @@ func (a *ANX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]excha } // SubmitExchangeOrder submits a new order -func (a *ANX) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (a *ANX) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (a *ANX) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (a *ANX) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (a *ANX) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (a *ANX) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (a *ANX) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (a *ANX) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (a *ANX) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (a *ANX) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (a *ANX) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (a *ANX) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (a *ANX) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (a *ANX) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a withdrawal is +// submitted +func (a *ANX) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is +// submitted +func (a *ANX) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/binance/binance_wrapper.go b/exchanges/binance/binance_wrapper.go index ef222fb6..5d98438e 100644 --- a/exchanges/binance/binance_wrapper.go +++ b/exchanges/binance/binance_wrapper.go @@ -126,6 +126,13 @@ func (b *Binance) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, errors.New("not implemented") } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (b *Binance) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (b *Binance) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -134,37 +141,51 @@ func (b *Binance) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]e } // SubmitExchangeOrder submits a new order -func (b *Binance) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (b *Binance) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (b *Binance) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (b *Binance) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (b *Binance) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (b *Binance) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (b *Binance) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (b *Binance) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (b *Binance) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (b *Binance) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (b *Binance) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (b *Binance) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (b *Binance) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (b *Binance) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *Binance) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *Binance) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/bitfinex/bitfinex_wrapper.go b/exchanges/bitfinex/bitfinex_wrapper.go index 526be24e..767e3a74 100644 --- a/exchanges/bitfinex/bitfinex_wrapper.go +++ b/exchanges/bitfinex/bitfinex_wrapper.go @@ -163,6 +163,13 @@ func (b *Bitfinex) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (b *Bitfinex) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (b *Bitfinex) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -171,37 +178,50 @@ func (b *Bitfinex) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([] } // SubmitExchangeOrder submits a new order -func (b *Bitfinex) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (b *Bitfinex) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (b *Bitfinex) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (b *Bitfinex) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (b *Bitfinex) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (b *Bitfinex) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (b *Bitfinex) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (b *Bitfinex) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (b *Bitfinex) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (b *Bitfinex) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (b *Bitfinex) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (b *Bitfinex) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } // WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (b *Bitfinex) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +func (b *Bitfinex) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *Bitfinex) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *Bitfinex) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/bitflyer/bitflyer_wrapper.go b/exchanges/bitflyer/bitflyer_wrapper.go index 0325828c..2800f32b 100644 --- a/exchanges/bitflyer/bitflyer_wrapper.go +++ b/exchanges/bitflyer/bitflyer_wrapper.go @@ -138,6 +138,13 @@ func (b *Bitflyer) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (b *Bitflyer) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (b *Bitflyer) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -146,37 +153,51 @@ func (b *Bitflyer) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([] } // SubmitExchangeOrder submits a new order -func (b *Bitflyer) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (b *Bitflyer) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (b *Bitflyer) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (b *Bitflyer) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (b *Bitflyer) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (b *Bitflyer) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (b *Bitflyer) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (b *Bitflyer) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (b *Bitflyer) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (b *Bitflyer) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (b *Bitflyer) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (b *Bitflyer) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (b *Bitflyer) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (b *Bitflyer) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *Bitflyer) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *Bitflyer) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/bithumb/bithumb_wrapper.go b/exchanges/bithumb/bithumb_wrapper.go index e87fbd68..67d84065 100644 --- a/exchanges/bithumb/bithumb_wrapper.go +++ b/exchanges/bithumb/bithumb_wrapper.go @@ -125,6 +125,13 @@ func (b *Bithumb) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, errors.New("not implemented") } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (b *Bithumb) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (b *Bithumb) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -133,37 +140,51 @@ func (b *Bithumb) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]e } // SubmitExchangeOrder submits a new order -func (b *Bithumb) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (b *Bithumb) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (b *Bithumb) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (b *Bithumb) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (b *Bithumb) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (b *Bithumb) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (b *Bithumb) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (b *Bithumb) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (b *Bithumb) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (b *Bithumb) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (b *Bithumb) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (b *Bithumb) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (b *Bithumb) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (b *Bithumb) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *Bithumb) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *Bithumb) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/bitstamp/bitstamp_wrapper.go b/exchanges/bitstamp/bitstamp_wrapper.go index 161868dc..2e89fc5a 100644 --- a/exchanges/bitstamp/bitstamp_wrapper.go +++ b/exchanges/bitstamp/bitstamp_wrapper.go @@ -148,6 +148,13 @@ func (b *Bitstamp) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (b *Bitstamp) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (b *Bitstamp) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -156,37 +163,51 @@ func (b *Bitstamp) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([] } // SubmitExchangeOrder submits a new order -func (b *Bitstamp) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (b *Bitstamp) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (b *Bitstamp) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (b *Bitstamp) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (b *Bitstamp) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (b *Bitstamp) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (b *Bitstamp) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (b *Bitstamp) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (b *Bitstamp) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (b *Bitstamp) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (b *Bitstamp) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (b *Bitstamp) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (b *Bitstamp) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (b *Bitstamp) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *Bitstamp) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *Bitstamp) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/bittrex/bittrex_wrapper.go b/exchanges/bittrex/bittrex_wrapper.go index 81232767..ba373ac5 100644 --- a/exchanges/bittrex/bittrex_wrapper.go +++ b/exchanges/bittrex/bittrex_wrapper.go @@ -154,6 +154,13 @@ func (b *Bittrex) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderb return orderbook.GetOrderbook(b.Name, p, assetType) } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (b *Bittrex) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (b *Bittrex) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -162,37 +169,51 @@ func (b *Bittrex) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]e } // SubmitExchangeOrder submits a new order -func (b *Bittrex) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (b *Bittrex) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (b *Bittrex) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (b *Bittrex) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (b *Bittrex) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (b *Bittrex) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (b *Bittrex) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (b *Bittrex) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (b *Bittrex) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (b *Bittrex) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (b *Bittrex) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (b *Bittrex) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (b *Bittrex) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (b *Bittrex) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *Bittrex) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *Bittrex) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/btcc/btcc_wrapper.go b/exchanges/btcc/btcc_wrapper.go index 2c4d6dc4..c6d6f595 100644 --- a/exchanges/btcc/btcc_wrapper.go +++ b/exchanges/btcc/btcc_wrapper.go @@ -133,6 +133,13 @@ func (b *BTCC) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (b *BTCC) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (b *BTCC) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -141,37 +148,51 @@ func (b *BTCC) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exch } // SubmitExchangeOrder submits a new order -func (b *BTCC) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (b *BTCC) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (b *BTCC) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (b *BTCC) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (b *BTCC) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (b *BTCC) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (b *BTCC) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (b *BTCC) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (b *BTCC) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (b *BTCC) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (b *BTCC) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (b *BTCC) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (b *BTCC) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (b *BTCC) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *BTCC) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *BTCC) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/btcmarkets/btcmarkets.go b/exchanges/btcmarkets/btcmarkets.go index b50ae263..ad697bb6 100644 --- a/exchanges/btcmarkets/btcmarkets.go +++ b/exchanges/btcmarkets/btcmarkets.go @@ -146,7 +146,7 @@ func (b *BTCMarkets) GetTrades(firstPair, secondPair string, values url.Values) // orderside - example "Bid" or "Ask" // orderType - example "limit" // clientReq - example "abc-cdf-1000" -func (b *BTCMarkets) NewOrder(currency, instrument string, price, amount float64, orderSide, orderType, clientReq string) (int, error) { +func (b *BTCMarkets) NewOrder(currency, instrument string, price, amount float64, orderSide, orderType, clientReq string) (int64, error) { newPrice := int64(price * float64(common.SatoshisPerBTC)) newVolume := int64(amount * float64(common.SatoshisPerBTC)) @@ -170,7 +170,7 @@ func (b *BTCMarkets) NewOrder(currency, instrument string, price, amount float64 if !resp.Success { return 0, fmt.Errorf("%s Unable to place order. Error message: %s", b.GetName(), resp.ErrorMessage) } - return resp.ID, nil + return int64(resp.ID), nil } // CancelOrder cancels an order by its ID @@ -217,10 +217,19 @@ func (b *BTCMarkets) CancelOrder(orderID []int64) (bool, error) { // historic - if false just normal Orders open func (b *BTCMarkets) GetOrders(currency, instrument string, limit, since int64, historic bool) ([]Order, error) { request := make(map[string]interface{}) - request["currency"] = common.StringToUpper(currency) - request["instrument"] = common.StringToUpper(instrument) - request["limit"] = limit - request["since"] = since + + if currency != "" { + request["currency"] = common.StringToUpper(currency) + } + if instrument != "" { + request["instrument"] = common.StringToUpper(instrument) + } + if limit != 0 { + request["limit"] = limit + } + if since != 0 { + request["since"] = since + } path := btcMarketsOrderOpen if historic { diff --git a/exchanges/btcmarkets/btcmarkets_test.go b/exchanges/btcmarkets/btcmarkets_test.go index a55aa0ec..6838bd75 100644 --- a/exchanges/btcmarkets/btcmarkets_test.go +++ b/exchanges/btcmarkets/btcmarkets_test.go @@ -3,9 +3,10 @@ package btcmarkets import ( "net/url" "testing" - "time" "github.com/thrasher-/gocryptotrader/config" + "github.com/thrasher-/gocryptotrader/currency/pair" + exchange "github.com/thrasher-/gocryptotrader/exchanges" ) var bm BTCMarkets @@ -21,9 +22,6 @@ func TestSetDefaults(t *testing.T) { } func TestSetup(t *testing.T) { - t.Parallel() - b := BTCMarkets{} - b.Name = "BTC Markets" cfg := config.GetConfig() cfg.LoadConfig("../../testdata/configtest.json") bConfig, err := cfg.GetExchangeConfig("BTC Markets") @@ -31,21 +29,13 @@ func TestSetup(t *testing.T) { t.Error("Test Failed - BTC Markets Setup() init error") } - b.SetDefaults() - b.Setup(bConfig) - - if !b.IsEnabled() || b.AuthenticatedAPISupport || b.RESTPollingDelay != time.Duration(10) || - b.Verbose || b.Websocket || len(b.BaseCurrencies) < 1 || - len(b.AvailablePairs) < 1 || len(b.EnabledPairs) < 1 { - t.Error("Test Failed - BTC Markets Setup values not set correctly") + if apiKey != "" && apiSecret != "" { + bConfig.APIKey = apiKey + bConfig.APISecret = apiSecret + bConfig.AuthenticatedAPISupport = true } - bConfig.Enabled = false - b.Setup(bConfig) - - if b.IsEnabled() { - t.Error("Test failed - BTC Markets TestSetup incorrect value") - } + bm.Setup(bConfig) } func TestGetFee(t *testing.T) { @@ -145,3 +135,67 @@ func TestWithdrawAUD(t *testing.T) { t.Error("Test failed - WithdrawAUD() error", err) } } + +func TestGetExchangeAccountInfo(t *testing.T) { + _, err := bm.GetExchangeAccountInfo() + if err == nil { + t.Error("Test failed - GetExchangeAccountInfo() error", err) + } +} + +func TestGetExchangeFundTransferHistory(t *testing.T) { + _, err := bm.GetExchangeFundTransferHistory() + if err == nil { + t.Error("Test failed - GetExchangeAccountInfo() error", err) + } +} + +func TestSubmitExchangeOrder(t *testing.T) { + p := pair.NewCurrencyPair("LTC", "AUD") + _, err := bm.SubmitExchangeOrder(p, exchange.OrderSideSell(), exchange.OrderTypeMarket(), 0, 0.0, "testID001") + if err == nil { + t.Error("Test failed - SubmitExchangeOrder() error", err) + } +} + +func TestModifyExchangeOrder(t *testing.T) { + _, err := bm.ModifyExchangeOrder(1337, exchange.ModifyOrder{}) + if err == nil { + t.Error("Test failed - ModifyExchangeOrder() error", err) + } +} + +func TestCancelExchangeOrder(t *testing.T) { + err := bm.CancelExchangeOrder(1337) + if err == nil { + t.Error("Test failed - CancelExchangeOrder() error", err) + } +} + +func TestCancelAllExchangeOrders(t *testing.T) { + err := bm.CancelAllExchangeOrders() + if err == nil { + t.Error("Test failed - CancelAllExchangeOrders() error", err) + } +} + +func TestGetExchangeOrderInfo(t *testing.T) { + _, err := bm.GetExchangeOrderInfo(1337) + if err == nil { + t.Error("Test failed - GetExchangeOrderInfo() error", err) + } +} + +func TestWithdrawExchangeCryptoFunds(t *testing.T) { + _, err := bm.WithdrawCryptoExchangeFunds("someaddress", "ltc", 0) + if err == nil { + t.Error("Test failed - WithdrawExchangeFunds() error", err) + } +} + +func TestWithdrawExchangeFiatFundsToLocalBank(t *testing.T) { + _, err := bm.WithdrawFiatExchangeFunds("AUD", 0) + if err == nil { + t.Error("Test failed - WithdrawExchangeFiatFunds() error", err) + } +} diff --git a/exchanges/btcmarkets/btcmarkets_wrapper.go b/exchanges/btcmarkets/btcmarkets_wrapper.go index 6c9a1241..19e81e84 100644 --- a/exchanges/btcmarkets/btcmarkets_wrapper.go +++ b/exchanges/btcmarkets/btcmarkets_wrapper.go @@ -118,10 +118,12 @@ func (b *BTCMarkets) UpdateOrderbook(p pair.CurrencyPair, assetType string) (ord func (b *BTCMarkets) GetExchangeAccountInfo() (exchange.AccountInfo, error) { var response exchange.AccountInfo response.ExchangeName = b.GetName() + accountBalance, err := b.GetAccountBalance() if err != nil { return response, err } + for i := 0; i < len(accountBalance); i++ { var exchangeCurrency exchange.AccountCurrencyInfo exchangeCurrency.CurrencyName = accountBalance[i].Currency @@ -133,6 +135,13 @@ func (b *BTCMarkets) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (b *BTCMarkets) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (b *BTCMarkets) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -141,37 +150,100 @@ func (b *BTCMarkets) GetExchangeHistory(p pair.CurrencyPair, assetType string) ( } // SubmitExchangeOrder submits a new order -func (b *BTCMarkets) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { - return 0, errors.New("not yet implemented") +func (b *BTCMarkets) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { + return b.NewOrder(p.GetFirstCurrency().Upper().String(), p.GetSecondCurrency().Upper().String(), price, amount, side.Format(b.GetName()), orderType.Format(b.GetName()), clientID) } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (b *BTCMarkets) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (b *BTCMarkets) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { + return 0, errors.New("not supported on exchange") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (b *BTCMarkets) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (b *BTCMarkets) CancelExchangeOrder(orderID int64) error { + _, err := b.CancelOrder([]int64{orderID}) + if err != nil { + return err + } + return nil } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (b *BTCMarkets) CancelAllExchangeOrders(p pair.CurrencyPair) error { - return errors.New("not yet implemented") +func (b *BTCMarkets) CancelAllExchangeOrders() error { + orders, err := b.GetOrders("", "", 0, 0, true) + if err != nil { + return err + } + + var orderList []int64 + for _, order := range orders { + orderList = append(orderList, order.ID) + } + + _, err = b.CancelOrder(orderList) + if err != nil { + return err + } + return nil } // GetExchangeOrderInfo returns information on a current open order -func (b *BTCMarkets) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (b *BTCMarkets) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var OrderDetail exchange.OrderDetail + + orders, err := b.GetOrderDetail([]int64{orderID}) + if err != nil { + return OrderDetail, err + } + + if len(orders) > 1 { + return OrderDetail, errors.New("too many orders returned") + } + + if len(orders) == 0 { + return OrderDetail, errors.New("no orders found") + } + + for _, order := range orders { + OrderDetail.Amount = order.Volume + OrderDetail.BaseCurrency = order.Currency + OrderDetail.CreationTime = int64(order.CreationTime) + OrderDetail.Exchange = b.GetName() + OrderDetail.ID = order.ID + OrderDetail.OpenVolume = order.OpenVolume + OrderDetail.OrderSide = order.OrderSide + OrderDetail.OrderType = order.OrderType + OrderDetail.Price = order.Price + OrderDetail.QuoteCurrency = order.Instrument + OrderDetail.Status = order.Status + } + + return OrderDetail, nil } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (b *BTCMarkets) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { - return "", errors.New("not yet implemented") +func (b *BTCMarkets) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { + return "", errors.New("not supported on exchange") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (b *BTCMarkets) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawCryptoExchangeFunds returns a withdrawal ID when a withdrawal is submitted +func (b *BTCMarkets) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return b.WithdrawCrypto(amount, cryptocurrency.String(), address) +} + +// WithdrawFiatExchangeFunds returns a withdrawal ID when a +// withdrawal is submitted +func (b *BTCMarkets) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + bd, err := b.GetClientBankAccounts(b.Name, currency.Upper().String()) + if err != nil { + return "", err + } + return b.WithdrawAUD(bd.AccountName, bd.AccountNumber, bd.BankName, bd.BSBNumber, amount) +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (b *BTCMarkets) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/coinbasepro/coinbasepro_wrapper.go b/exchanges/coinbasepro/coinbasepro_wrapper.go index 801e4ddf..8c3d7a25 100644 --- a/exchanges/coinbasepro/coinbasepro_wrapper.go +++ b/exchanges/coinbasepro/coinbasepro_wrapper.go @@ -133,7 +133,14 @@ func (c *CoinbasePro) UpdateOrderbook(p pair.CurrencyPair, assetType string) (or return orderbook.GetOrderbook(c.Name, p, assetType) } -// GetExchangeHistory returns historic trade data since exchange openinc. +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (c *CoinbasePro) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + +// GetExchangeHistory returns historic trade data since exchange opening. func (c *CoinbasePro) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -141,37 +148,45 @@ func (c *CoinbasePro) GetExchangeHistory(p pair.CurrencyPair, assetType string) } // SubmitExchangeOrder submits a new order -func (c *CoinbasePro) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (c *CoinbasePro) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (c *CoinbasePro) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (c *CoinbasePro) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (c *CoinbasePro) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (c *CoinbasePro) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (c *CoinbasePro) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (c *CoinbasePro) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (c *CoinbasePro) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (c *CoinbasePro) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (c *CoinbasePro) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (c *CoinbasePro) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (c *CoinbasePro) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawCryptoExchangeFunds returns a withdrawal ID when a withdrawal is +// submitted +func (c *CoinbasePro) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawFiatExchangeFunds returns a withdrawal ID when a withdrawal is +// submitted +func (c *CoinbasePro) WithdrawFiatExchangeFunds(cryptocurrency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/coinut/coinut_wrapper.go b/exchanges/coinut/coinut_wrapper.go index 75b36e48..3d7d7a8b 100644 --- a/exchanges/coinut/coinut_wrapper.go +++ b/exchanges/coinut/coinut_wrapper.go @@ -130,6 +130,13 @@ func (c *COINUT) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbo return orderbook.GetOrderbook(c.Name, p, assetType) } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (c *COINUT) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (c *COINUT) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -138,37 +145,51 @@ func (c *COINUT) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]ex } // SubmitExchangeOrder submits a new order -func (c *COINUT) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (c *COINUT) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (c *COINUT) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (c *COINUT) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (c *COINUT) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (c *COINUT) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (c *COINUT) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (c *COINUT) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (c *COINUT) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (c *COINUT) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (c *COINUT) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (c *COINUT) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (c *COINUT) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (c *COINUT) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (c *COINUT) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (c *COINUT) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/exchange.go b/exchanges/exchange.go index f26428d9..e54693c5 100644 --- a/exchanges/exchange.go +++ b/exchanges/exchange.go @@ -50,6 +50,39 @@ type TradeHistory struct { Type string } +// OrderDetail holds order detail data +type OrderDetail struct { + Exchange string + ID int64 + BaseCurrency string + QuoteCurrency string + OrderSide string + OrderType string + CreationTime int64 + Status string + Price float64 + Amount float64 + OpenVolume float64 +} + +// FundHistory holds exchange funding history data +type FundHistory struct { + ExchangeName string + Status string + TransferID int64 + Description string + Timestamp int64 + Currency string + Amount float64 + Fee float64 + TransferType string + CryptoToAddress string + CryptoFromAddress string + CryptoTxID string + BankTo string + BankFrom string +} + // Base stores the individual exchange information type Base struct { Name string @@ -99,13 +132,16 @@ type IBotExchange interface { GetLastPairsUpdateTime() int64 SupportsRESTTickerBatchUpdates() bool - SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) - ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) - CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) - CancelAllExchangeOrders(p pair.CurrencyPair) error - GetExchangeOrderInfo(orderID int64) (float64, error) - GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) - WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) + GetExchangeFundTransferHistory() ([]FundHistory, error) + SubmitExchangeOrder(p pair.CurrencyPair, side OrderSide, orderType OrderType, amount, price float64, clientID string) (int64, error) + ModifyExchangeOrder(orderID int64, modify ModifyOrder) (int64, error) + CancelExchangeOrder(orderID int64) error + CancelAllExchangeOrders() error + GetExchangeOrderInfo(orderID int64) (OrderDetail, error) + GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) + + WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) + WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) } // SupportsRESTTickerBatchUpdates returns whether or not the @@ -217,6 +253,20 @@ func GetExchangeAssetTypes(exchName string) ([]string, error) { return common.SplitStrings(exch.AssetTypes, ","), nil } +// GetClientBankAccounts returns banking details associated with +// a client for withdrawal purposes +func (e *Base) GetClientBankAccounts(exchangeName, withdrawalCurrency string) (config.BankAccount, error) { + cfg := config.GetConfig() + return cfg.GetClientBankAccounts(exchangeName, withdrawalCurrency) +} + +// GetExchangeBankAccounts returns banking details associated with an +// exchange for funding purposes +func (e *Base) GetExchangeBankAccounts(exchangeName, depositCurrency string) (config.BankAccount, error) { + cfg := config.GetConfig() + return cfg.GetExchangeBankAccounts(exchangeName, depositCurrency) +} + // CompareCurrencyPairFormats checks and returns whether or not the two supplied // config currency pairs match func CompareCurrencyPairFormats(pair1 config.CurrencyPairFormatConfig, pair2 *config.CurrencyPairFormatConfig) bool { @@ -480,3 +530,82 @@ func (e *Base) UpdateCurrencies(exchangeProducts []string, enabled, force bool) } return nil } + +// ModifyOrder is a an order modifyer +type ModifyOrder struct { + OrderType + OrderSide + Price float64 + Amount float64 +} + +// Format holds exchange formatting +type Format struct { + ExchangeName string + OrderType map[string]string + OrderSide map[string]string +} + +// Formatting contain a range of exchanges formatting +type Formatting []Format + +// formats is a quick formatting list for generic paramaters +var formats = Formatting{ + Format{ + ExchangeName: "BTC Markets", + OrderType: map[string]string{ + "Limit": "Limit", + "Market": "Market", + }, + OrderSide: map[string]string{ + "Buy": "Bid", + "Sell": "Ask", + }, + }, +} + +// OrderType enforces a standard for Ordertypes across the code base +type OrderType string + +// Format changes the ordertype to the exchange standard and returns a string +func (o OrderType) Format(exchangeName string) string { + for _, format := range formats { + if format.ExchangeName == exchangeName { + return format.OrderType[string(o)] + } + } + return "" +} + +// OrderTypeLimit returns an OrderType limit order +func OrderTypeLimit() OrderType { + return "Limit" +} + +// OrderTypeMarket returns an OrderType Market order +func OrderTypeMarket() OrderType { + return "Market" +} + +// OrderSide enforces a standard for OrderSides across the code base +type OrderSide string + +// Format changes the ordertype to the exchange standard and returns a string +func (o OrderSide) Format(exchangeName string) string { + for _, format := range formats { + if format.ExchangeName == exchangeName { + return format.OrderSide[string(o)] + } + } + return "" +} + +// OrderSideBuy returns an OrderSide buy order +func OrderSideBuy() OrderSide { + return "Buy" +} + +// OrderSideSell returns an OrderSide Sell order +func OrderSideSell() OrderSide { + return "Sell" +} diff --git a/exchanges/exmo/exmo_wrapper.go b/exchanges/exmo/exmo_wrapper.go index baa715e7..0faa3448 100644 --- a/exchanges/exmo/exmo_wrapper.go +++ b/exchanges/exmo/exmo_wrapper.go @@ -161,6 +161,13 @@ func (e *EXMO) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (e *EXMO) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (e *EXMO) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -169,37 +176,51 @@ func (e *EXMO) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exch } // SubmitExchangeOrder submits a new order -func (e *EXMO) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (e *EXMO) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (e *EXMO) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (e *EXMO) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (e *EXMO) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (e *EXMO) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (e *EXMO) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (e *EXMO) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (e *EXMO) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (e *EXMO) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (e *EXMO) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (e *EXMO) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (e *EXMO) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (e *EXMO) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (e *EXMO) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (e *EXMO) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/gemini/gemini_wrapper.go b/exchanges/gemini/gemini_wrapper.go index 02695bbc..e59aba7f 100644 --- a/exchanges/gemini/gemini_wrapper.go +++ b/exchanges/gemini/gemini_wrapper.go @@ -112,6 +112,13 @@ func (g *Gemini) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbo return orderbook.GetOrderbook(g.Name, p, assetType) } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (g *Gemini) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (g *Gemini) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -120,37 +127,51 @@ func (g *Gemini) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]ex } // SubmitExchangeOrder submits a new order -func (g *Gemini) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (g *Gemini) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (g *Gemini) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (g *Gemini) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (g *Gemini) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (g *Gemini) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (g *Gemini) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (g *Gemini) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (g *Gemini) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (g *Gemini) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (g *Gemini) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (g *Gemini) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (g *Gemini) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (g *Gemini) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (g *Gemini) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (g *Gemini) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/hitbtc/hitbtc_wrapper.go b/exchanges/hitbtc/hitbtc_wrapper.go index fa10b022..48f1979d 100644 --- a/exchanges/hitbtc/hitbtc_wrapper.go +++ b/exchanges/hitbtc/hitbtc_wrapper.go @@ -144,6 +144,13 @@ func (h *HitBTC) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (h *HitBTC) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (h *HitBTC) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -152,37 +159,51 @@ func (h *HitBTC) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]ex } // SubmitExchangeOrder submits a new order -func (h *HitBTC) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (h *HitBTC) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (h *HitBTC) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (h *HitBTC) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (h *HitBTC) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (h *HitBTC) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (h *HitBTC) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (h *HitBTC) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (h *HitBTC) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (h *HitBTC) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (h *HitBTC) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (h *HitBTC) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (h *HitBTC) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (h *HitBTC) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (h *HitBTC) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (h *HitBTC) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/huobi/huobi_wrapper.go b/exchanges/huobi/huobi_wrapper.go index 1b704902..b87432a0 100644 --- a/exchanges/huobi/huobi_wrapper.go +++ b/exchanges/huobi/huobi_wrapper.go @@ -149,6 +149,13 @@ func (h *HUOBI) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (h *HUOBI) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (h *HUOBI) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -157,37 +164,51 @@ func (h *HUOBI) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exc } // SubmitExchangeOrder submits a new order -func (h *HUOBI) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (h *HUOBI) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (h *HUOBI) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (h *HUOBI) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (h *HUOBI) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (h *HUOBI) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (h *HUOBI) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (h *HUOBI) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (h *HUOBI) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (h *HUOBI) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (h *HUOBI) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (h *HUOBI) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (h *HUOBI) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (h *HUOBI) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (h *HUOBI) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (h *HUOBI) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/itbit/itbit_wrapper.go b/exchanges/itbit/itbit_wrapper.go index d9ef87dc..25f43590 100644 --- a/exchanges/itbit/itbit_wrapper.go +++ b/exchanges/itbit/itbit_wrapper.go @@ -114,6 +114,13 @@ func (i *ItBit) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (i *ItBit) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (i *ItBit) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -122,37 +129,51 @@ func (i *ItBit) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exc } // SubmitExchangeOrder submits a new order -func (i *ItBit) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (i *ItBit) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (i *ItBit) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (i *ItBit) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (i *ItBit) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (i *ItBit) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (i *ItBit) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (i *ItBit) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (i *ItBit) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (i *ItBit) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (i *ItBit) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (i *ItBit) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (i *ItBit) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (i *ItBit) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (i *ItBit) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (i *ItBit) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/kraken/kraken_wrapper.go b/exchanges/kraken/kraken_wrapper.go index df9cf5c9..6277d589 100644 --- a/exchanges/kraken/kraken_wrapper.go +++ b/exchanges/kraken/kraken_wrapper.go @@ -185,6 +185,13 @@ func (k *Kraken) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (k *Kraken) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (k *Kraken) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -193,37 +200,51 @@ func (k *Kraken) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]ex } // SubmitExchangeOrder submits a new order -func (k *Kraken) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (k *Kraken) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (k *Kraken) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (k *Kraken) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (k *Kraken) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (k *Kraken) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (k *Kraken) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (k *Kraken) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (k *Kraken) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (k *Kraken) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (k *Kraken) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (k *Kraken) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (k *Kraken) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (k *Kraken) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (k *Kraken) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (k *Kraken) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/lakebtc/lakebtc_wrapper.go b/exchanges/lakebtc/lakebtc_wrapper.go index 761281ec..fba9f166 100644 --- a/exchanges/lakebtc/lakebtc_wrapper.go +++ b/exchanges/lakebtc/lakebtc_wrapper.go @@ -124,6 +124,13 @@ func (l *LakeBTC) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (l *LakeBTC) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (l *LakeBTC) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -132,37 +139,51 @@ func (l *LakeBTC) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]e } // SubmitExchangeOrder submits a new order -func (l *LakeBTC) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (l *LakeBTC) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (l *LakeBTC) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (l *LakeBTC) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (l *LakeBTC) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (l *LakeBTC) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (l *LakeBTC) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (l *LakeBTC) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (l *LakeBTC) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (l *LakeBTC) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (l *LakeBTC) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (l *LakeBTC) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (l *LakeBTC) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (l *LakeBTC) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (l *LakeBTC) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (l *LakeBTC) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/liqui/liqui_wrapper.go b/exchanges/liqui/liqui_wrapper.go index 188ad419..5d259e78 100644 --- a/exchanges/liqui/liqui_wrapper.go +++ b/exchanges/liqui/liqui_wrapper.go @@ -133,6 +133,13 @@ func (l *Liqui) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (l *Liqui) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (l *Liqui) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -141,37 +148,51 @@ func (l *Liqui) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exc } // SubmitExchangeOrder submits a new order -func (l *Liqui) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (l *Liqui) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (l *Liqui) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (l *Liqui) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (l *Liqui) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (l *Liqui) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (l *Liqui) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (l *Liqui) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (l *Liqui) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (l *Liqui) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (l *Liqui) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (l *Liqui) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (l *Liqui) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (l *Liqui) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (l *Liqui) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (l *Liqui) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/localbitcoins/localbitcoins_wrapper.go b/exchanges/localbitcoins/localbitcoins_wrapper.go index 1780d304..eb9531ab 100644 --- a/exchanges/localbitcoins/localbitcoins_wrapper.go +++ b/exchanges/localbitcoins/localbitcoins_wrapper.go @@ -105,6 +105,13 @@ func (l *LocalBitcoins) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (l *LocalBitcoins) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (l *LocalBitcoins) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -113,37 +120,51 @@ func (l *LocalBitcoins) GetExchangeHistory(p pair.CurrencyPair, assetType string } // SubmitExchangeOrder submits a new order -func (l *LocalBitcoins) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (l *LocalBitcoins) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (l *LocalBitcoins) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (l *LocalBitcoins) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (l *LocalBitcoins) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (l *LocalBitcoins) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (l *LocalBitcoins) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (l *LocalBitcoins) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (l *LocalBitcoins) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (l *LocalBitcoins) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (l *LocalBitcoins) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (l *LocalBitcoins) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (l *LocalBitcoins) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (l *LocalBitcoins) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (l *LocalBitcoins) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (l *LocalBitcoins) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/okcoin/okcoin_wrapper.go b/exchanges/okcoin/okcoin_wrapper.go index 59af34bb..438dd001 100644 --- a/exchanges/okcoin/okcoin_wrapper.go +++ b/exchanges/okcoin/okcoin_wrapper.go @@ -147,6 +147,13 @@ func (o *OKCoin) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (o *OKCoin) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (o *OKCoin) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -155,37 +162,51 @@ func (o *OKCoin) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]ex } // SubmitExchangeOrder submits a new order -func (o *OKCoin) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (o *OKCoin) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (o *OKCoin) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (o *OKCoin) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (o *OKCoin) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (o *OKCoin) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (o *OKCoin) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (o *OKCoin) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (o *OKCoin) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (o *OKCoin) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (o *OKCoin) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (o *OKCoin) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (o *OKCoin) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (o *OKCoin) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (o *OKCoin) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (o *OKCoin) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/okex/okex_wrapper.go b/exchanges/okex/okex_wrapper.go index a80ed005..7dcd2fae 100644 --- a/exchanges/okex/okex_wrapper.go +++ b/exchanges/okex/okex_wrapper.go @@ -152,6 +152,13 @@ func (o *OKEX) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, errors.New("not implemented") } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (o *OKEX) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (o *OKEX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -160,37 +167,51 @@ func (o *OKEX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exch } // SubmitExchangeOrder submits a new order -func (o *OKEX) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (o *OKEX) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (o *OKEX) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (o *OKEX) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (o *OKEX) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (o *OKEX) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (o *OKEX) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (o *OKEX) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (o *OKEX) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (o *OKEX) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (o *OKEX) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (o *OKEX) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (o *OKEX) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (o *OKEX) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (o *OKEX) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (o *OKEX) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/poloniex/poloniex_wrapper.go b/exchanges/poloniex/poloniex_wrapper.go index 1235c0d4..b82a5de4 100644 --- a/exchanges/poloniex/poloniex_wrapper.go +++ b/exchanges/poloniex/poloniex_wrapper.go @@ -144,6 +144,13 @@ func (po *Poloniex) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (po *Poloniex) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (po *Poloniex) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -152,37 +159,51 @@ func (po *Poloniex) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([ } // SubmitExchangeOrder submits a new order -func (po *Poloniex) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (po *Poloniex) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (po *Poloniex) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (po *Poloniex) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (po *Poloniex) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (po *Poloniex) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (po *Poloniex) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (po *Poloniex) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (po *Poloniex) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (po *Poloniex) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (po *Poloniex) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (po *Poloniex) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (po *Poloniex) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (po *Poloniex) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (po *Poloniex) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (po *Poloniex) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/wex/wex_wrapper.go b/exchanges/wex/wex_wrapper.go index 190ff2c4..35ecc135 100644 --- a/exchanges/wex/wex_wrapper.go +++ b/exchanges/wex/wex_wrapper.go @@ -143,6 +143,13 @@ func (w *WEX) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (w *WEX) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (w *WEX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -151,37 +158,51 @@ func (w *WEX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]excha } // SubmitExchangeOrder submits a new order -func (w *WEX) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (w *WEX) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (w *WEX) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (w *WEX) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (w *WEX) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (w *WEX) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (w *WEX) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (w *WEX) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (w *WEX) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (w *WEX) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (w *WEX) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (w *WEX) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (w *WEX) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (w *WEX) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (w *WEX) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (w *WEX) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/yobit/yobit_wrapper.go b/exchanges/yobit/yobit_wrapper.go index b606c3ec..87e4b739 100644 --- a/exchanges/yobit/yobit_wrapper.go +++ b/exchanges/yobit/yobit_wrapper.go @@ -125,6 +125,13 @@ func (y *Yobit) GetExchangeAccountInfo() (exchange.AccountInfo, error) { return response, nil } +// GetExchangeFundTransferHistory returns funding history, deposits and +// withdrawals +func (y *Yobit) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error) { + var fundHistory []exchange.FundHistory + return fundHistory, errors.New("not supported on exchange") +} + // GetExchangeHistory returns historic trade data since exchange opening. func (y *Yobit) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) { var resp []exchange.TradeHistory @@ -133,37 +140,51 @@ func (y *Yobit) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exc } // SubmitExchangeOrder submits a new order -func (y *Yobit) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error) { +func (y *Yobit) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error) { return 0, errors.New("not yet implemented") } // ModifyExchangeOrder will allow of changing orderbook placement and limit to // market conversion -func (y *Yobit) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error) { +func (y *Yobit) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error) { return 0, errors.New("not yet implemented") } // CancelExchangeOrder cancels an order by its corresponding ID number -func (y *Yobit) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) { - return 0, errors.New("not yet implemented") +func (y *Yobit) CancelExchangeOrder(orderID int64) error { + return errors.New("not yet implemented") } // CancelAllExchangeOrders cancels all orders associated with a currency pair -func (y *Yobit) CancelAllExchangeOrders(p pair.CurrencyPair) error { +func (y *Yobit) CancelAllExchangeOrders() error { return errors.New("not yet implemented") } // GetExchangeOrderInfo returns information on a current open order -func (y *Yobit) GetExchangeOrderInfo(orderID int64) (float64, error) { - return 0, errors.New("not yet implemented") +func (y *Yobit) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error) { + var orderDetail exchange.OrderDetail + return orderDetail, errors.New("not yet implemented") } // GetExchangeDepositAddress returns a deposit address for a specified currency -func (y *Yobit) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error) { +func (y *Yobit) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error) { return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted -func (y *Yobit) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error) { +// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// submitted +func (y *Yobit) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToLocalBank returns a withdrawal ID when a +// withdrawal is submitted +func (y *Yobit) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error) { + return "", errors.New("not yet implemented") +} + +// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// withdrawal is submitted +func (y *Yobit) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/testdata/configtest.json b/testdata/configtest.json index 6634d8e3..cba01f55 100644 --- a/testdata/configtest.json +++ b/testdata/configtest.json @@ -147,7 +147,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Binance", @@ -171,7 +182,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Bitfinex", @@ -194,7 +216,27 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "Deutsche Bank Privat Und Geschaeftskunden AG", + "BankAddress": "Karlsruhe, 76125, GERMANY", + "AccountName": "GLOBAL TRADE SOLUTIONS GmbH", + "AccountNumber": "DE51660700240057016802", + "SWIFTCode": "DEUTDEDB660", + "IBAN": "DE51660700240057016802", + "SupportedCurrencies": "EUR,USD" + }, + { + "BankName": "Deutsche Bank Privat Und Geschaeftskunden AG", + "BankAddress": "Karlsruhe, 76125, GERMANY", + "AccountName": "GLOBAL TRADE SOLUTIONS GmbH", + "AccountNumber": "DE78660700240057016801", + "SWIFTCode": "DEUTDEDB660", + "IBAN": "DE78660700240057016801", + "SupportedCurrencies": "JPY,GBP" + } + ] }, { "Name": "Bitflyer", @@ -220,7 +262,18 @@ "RequestCurrencyPairFormat": { "Uppercase": true, "Delimiter": "_" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Bithumb", @@ -245,7 +298,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Bitstamp", @@ -269,7 +333,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Bittrex", @@ -294,7 +369,18 @@ "RequestCurrencyPairFormat": { "Uppercase": true, "Delimiter": "-" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "BTCC", @@ -317,7 +403,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": false - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "WEX", @@ -343,7 +440,18 @@ "Uppercase": false, "Delimiter": "_", "Separator": "-" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "BTC Markets", @@ -366,7 +474,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "COINUT", @@ -390,7 +509,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "EXMO", @@ -416,7 +546,18 @@ "Uppercase": true, "Delimiter": "_", "Separator": "," - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "CoinbasePro", @@ -441,7 +582,18 @@ "RequestCurrencyPairFormat": { "Uppercase": true, "Delimiter": "-" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Gemini", @@ -464,7 +616,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "HitBTC", @@ -488,7 +651,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Huobi", @@ -512,7 +686,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": false - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "ITBIT", @@ -537,7 +722,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Kraken", @@ -562,7 +758,18 @@ "RequestCurrencyPairFormat": { "Uppercase": true, "Separator": "," - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "LakeBTC", @@ -585,7 +792,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Liqui", @@ -611,7 +829,18 @@ "Uppercase": false, "Delimiter": "_", "Separator": "-" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "LocalBitcoins", @@ -635,7 +864,18 @@ }, "RequestCurrencyPairFormat": { "Uppercase": true - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "OKCOIN China", @@ -660,7 +900,18 @@ "RequestCurrencyPairFormat": { "Uppercase": false, "Delimiter": "_" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "OKCOIN International", @@ -685,7 +936,18 @@ "RequestCurrencyPairFormat": { "Uppercase": false, "Delimiter": "_" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "OKEX", @@ -711,7 +973,18 @@ "RequestCurrencyPairFormat": { "Uppercase": false, "Delimiter": "_" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Poloniex", @@ -736,7 +1009,18 @@ "RequestCurrencyPairFormat": { "Uppercase": true, "Delimiter": "_" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] }, { "Name": "Yobit", @@ -763,7 +1047,30 @@ "Uppercase": false, "Delimiter": "_", "Separator": "-" - } + }, + "BankAccounts": [ + { + "BankName": "", + "BankAddress": "", + "AccountName": "", + "AccountNumber": "", + "SWIFTCode": "", + "IBAN": "", + "SupportedCurrencies": "" + } + ] + } + ], + "BankAccounts": [ + { + "BankName": "test", + "BankAddress": "test", + "AccountName": "TestAccount", + "AccountNumber": "0234", + "SWIFTCode": "91272837", + "IBAN": "98218738671897", + "SupportedCurrencies": "USD", + "SupportedExchanges": "ANX,Kraken" } ] } \ No newline at end of file