diff options
author | jloup <jeanloup.jamet@gmail.com> | 2018-05-09 19:44:17 +0200 |
---|---|---|
committer | jloup <jeanloup.jamet@gmail.com> | 2018-05-09 19:44:17 +0200 |
commit | 24e4797900b3d2edf642fdb547bc22357a5b39ad (patch) | |
tree | a2e62dd7382eb4c9ba817c25ba2fa15a659638d3 /markets | |
parent | 78e3e81ddf01f41102f3f4e32c5a3955cf5fb04f (diff) | |
download | Front-24e4797900b3d2edf642fdb547bc22357a5b39ad.tar.gz Front-24e4797900b3d2edf642fdb547bc22357a5b39ad.tar.zst Front-24e4797900b3d2edf642fdb547bc22357a5b39ad.zip |
Refactor Portfolio balance.
Diffstat (limited to 'markets')
-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 |