X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=markets%2Fpoloniex.go;h=595d5a4890ac73001f37c2a20f9cf4ba5abe18eb;hb=c086df915bf9884fe514a00b6c6d04f36321e1e3;hpb=f7521f251456fea091d1eb950fd55a7cd4257c65;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FFront.git diff --git a/markets/poloniex.go b/markets/poloniex.go index cadc829..595d5a4 100644 --- a/markets/poloniex.go +++ b/markets/poloniex.go @@ -16,6 +16,8 @@ var ( IPRestricted = utils.InitFlag(&ErrorFlagCounter, "IPRestricted") ) +const defaultTimeout = 10 + func poloniexInvalidCredentialsError(err error) bool { if err == nil { return false @@ -43,7 +45,7 @@ type Poloniex struct { } func NewPoloniex() *Poloniex { - client, _ := poloniex.NewClient("", "") + client, _ := poloniex.NewClient("", "", defaultTimeout) return &Poloniex{ TickerCache: make(map[string]CurrencyPair), @@ -52,8 +54,8 @@ func NewPoloniex() *Poloniex { } } -func (p *Poloniex) TestCredentials(apiKey, apiSecret string) error { - client, _ := poloniex.NewClient(apiKey, apiSecret) +func (p *Poloniex) TestCredentials(apiKey, apiSecret string, timeout int32) error { + client, _ := poloniex.NewClient(apiKey, apiSecret, timeout) _, err := client.TradeReturnDepositAdresses() @@ -68,8 +70,8 @@ func (p *Poloniex) TestCredentials(apiKey, apiSecret string) error { return err } -func (p *Poloniex) GetBalance(apiKey, apiSecret string) (Summary, error) { - client, _ := poloniex.NewClient(apiKey, apiSecret) +func (p *Poloniex) GetBalance(apiKey, apiSecret string, timeout int32) (Summary, error) { + client, _ := poloniex.NewClient(apiKey, apiSecret, timeout) var summary Summary accounts, err := client.TradeReturnAvailableAccountBalances()