diff options
Diffstat (limited to 'markets/poloniex.go')
-rw-r--r-- | markets/poloniex.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/markets/poloniex.go b/markets/poloniex.go index 9aaeafb..58645b2 100644 --- a/markets/poloniex.go +++ b/markets/poloniex.go | |||
@@ -52,6 +52,22 @@ func NewPoloniex() *Poloniex { | |||
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
55 | func (p *Poloniex) TestCredentials(apiKey, apiSecret string) error { | ||
56 | client, _ := poloniex.NewClient(apiKey, apiSecret) | ||
57 | |||
58 | _, err := client.TradeReturnDepositAdresses() | ||
59 | |||
60 | if poloniexInvalidCredentialsError(err) { | ||
61 | return utils.Error{InvalidCredentials, "invalid poloniex credentials"} | ||
62 | } | ||
63 | |||
64 | if poloniexRestrictedIPError(err) { | ||
65 | return utils.Error{IPRestricted, "IP restricted api key"} | ||
66 | } | ||
67 | |||
68 | return nil | ||
69 | } | ||
70 | |||
55 | func (p *Poloniex) GetBalance(apiKey, apiSecret string) (Summary, error) { | 71 | func (p *Poloniex) GetBalance(apiKey, apiSecret string) (Summary, error) { |
56 | client, _ := poloniex.NewClient(apiKey, apiSecret) | 72 | client, _ := poloniex.NewClient(apiKey, apiSecret) |
57 | var summary Summary | 73 | var summary Summary |