From 0f209165d5dd1380dfb3514ede1edd48cd1454c3 Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Wed, 18 Jul 2018 07:46:47 +0200 Subject: [PATCH] Improved code quality (#154) * Removed package-lock.json form gitignore as it ensures specific package versions * Updated all @angular web dependencies * Resolved tslint errors using autofix option * Resolved some more tslint issues * Added lint scripts to package.json to easy lint the ts files * Updated codelyzer and tslint * Run web on travis using node 10 and run the lint task * Resolved some more tslint issues after upgrading tslint and codelyzer * Resolved golint issues with regards to exchange comments * Resolved spelling errors shown by goreportcard.com * Resolved gofmt warnings using goreportcard.com * Resolved golint issue by removing unrequired else statement * Refactored slack.go to reduce cyclomatic complexity * Fixed govet issue where Slack was passed as value instead of reference --- .travis.yml | 50 +- common/common.go | 2 +- communications/slack/slack.go | 133 ++-- config/config.go | 2 +- config/config_test.go | 2 +- currency/forexprovider/base/base_interface.go | 2 +- exchanges/alphapoint/alphapoint_wrapper.go | 4 +- exchanges/anx/anx_wrapper.go | 8 +- exchanges/binance/binance.go | 4 +- exchanges/binance/binance_wrapper.go | 8 +- exchanges/bitfinex/bitfinex_wrapper.go | 8 +- exchanges/bitflyer/bitflyer_wrapper.go | 8 +- exchanges/bithumb/bithumb_wrapper.go | 8 +- exchanges/bitstamp/bitstamp_wrapper.go | 8 +- exchanges/bittrex/bittrex_wrapper.go | 8 +- exchanges/btcc/btcc_wrapper.go | 8 +- exchanges/btcmarkets/btcmarkets_test.go | 6 +- exchanges/btcmarkets/btcmarkets_wrapper.go | 4 +- exchanges/coinut/coinut_wrapper.go | 8 +- exchanges/exchange.go | 2 +- exchanges/exmo/exmo_wrapper.go | 8 +- exchanges/gemini/gemini_wrapper.go | 8 +- exchanges/hitbtc/hitbtc_wrapper.go | 8 +- exchanges/huobi/huobi_wrapper.go | 8 +- exchanges/itbit/itbit_wrapper.go | 8 +- exchanges/kraken/kraken_wrapper.go | 8 +- exchanges/lakebtc/lakebtc_wrapper.go | 8 +- exchanges/liqui/liqui_wrapper.go | 8 +- .../localbitcoins/localbitcoins_wrapper.go | 8 +- exchanges/okcoin/okcoin_wrapper.go | 8 +- exchanges/okex/okex_wrapper.go | 8 +- exchanges/poloniex/poloniex_wrapper.go | 8 +- exchanges/wex/wex_wrapper.go | 8 +- exchanges/yobit/yobit_wrapper.go | 8 +- helpers_test.go | 2 +- web/.gitignore | 1 - web/.travis.yml | 8 - web/package-lock.json | 134 ++-- web/package.json | 32 +- web/src/app/app-routing.module.ts | 10 +- web/src/app/app.component.ts | 28 +- web/src/app/app.module.ts | 14 +- .../currency-list/currency-list.component.ts | 34 +- .../pages/dashboard/dashboard.component.ts | 8 +- .../exchange-grid/exchange-grid.component.ts | 26 +- .../app/pages/settings/settings.component.ts | 32 +- web/src/app/pages/wallet/wallet.component.ts | 24 +- .../app/services/sidebar/sidebar.service.ts | 4 +- .../style-manager.service.spec.ts | 12 +- .../style-manager/style-manager.service.ts | 4 +- .../theme-storage.service.spec.ts | 2 +- .../theme-storage/theme-storage.service.ts | 2 +- .../websocket-response-handler.service.ts | 58 +- .../services/websocket/websocket.service.ts | 26 +- .../all-updates-ticker.component.ts | 30 +- .../app/shared/buy-form/buy-form.component.ts | 16 +- .../app/shared/buy-sell/buy-sell.component.ts | 2 +- web/src/app/shared/classes/config.ts | 100 ++- web/src/app/shared/classes/pipes.ts | 14 +- web/src/app/shared/classes/ticker.ts | 6 +- web/src/app/shared/classes/wallet.ts | 8 +- web/src/app/shared/classes/websocket.ts | 22 +- .../shared/my-orders/my-orders.component.ts | 14 +- web/src/app/shared/navbar/navbar.component.ts | 2 +- web/src/app/shared/orders/orders.component.ts | 16 +- .../price-history/price-history.component.ts | 714 +++++++++--------- .../shared/sell-form/sell-form.component.ts | 20 +- .../app/shared/theme-picker/theme-picker.ts | 8 +- .../trade-history/trade-history.component.ts | 14 +- web/tslint.json | 2 +- websocket.go | 42 +- 71 files changed, 970 insertions(+), 916 deletions(-) delete mode 100644 web/.travis.yml diff --git a/.travis.yml b/.travis.yml index 5bc0bcc1..ec529317 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,31 @@ -language: go +matrix: + include: + - language: node_js + node_js: + - '10' + - '8' + - '6' + before_install: + - cd web/ + install: + - npm install + script: + - npm run lint + - npm run build -go: - - 1.10.x - -before_install: - - go get -t -v ./... - -script: - - ./testdata/test.sh - -install: - - go get github.com/gorilla/websocket - - go get github.com/toorop/go-pusher - - go get github.com/thrasher-/socketio - - go get github.com/beatgammit/turnpike - - go get github.com/gorilla/mux - - go get golang.org/x/crypto/scrypt - -after_success: - - bash <(curl -s https://codecov.io/bash) + - language: go + go: + - 1.10.x + before_install: + - go get -t -v ./... + script: + - ./testdata/test.sh + install: + - go get github.com/gorilla/websocket + - go get github.com/toorop/go-pusher + - go get github.com/thrasher-/socketio + - go get github.com/beatgammit/turnpike + - go get github.com/gorilla/mux + - go get golang.org/x/crypto/scrypt + after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/common/common.go b/common/common.go index a7216cf6..a8ec5e7c 100644 --- a/common/common.go +++ b/common/common.go @@ -53,7 +53,7 @@ func initialiseHTTPClient() { } } -// NewHTTPClientWithTimeout initalises a new HTTP client with the specified +// NewHTTPClientWithTimeout initialises a new HTTP client with the specified // timeout duration func NewHTTPClientWithTimeout(t time.Duration) *http.Client { h := &http.Client{Timeout: t} diff --git a/communications/slack/slack.go b/communications/slack/slack.go index a0b96ef8..7e03e833 100644 --- a/communications/slack/slack.go +++ b/communications/slack/slack.go @@ -59,7 +59,7 @@ type Slack struct { } // Setup takes in a slack configuration, sets bots target channel and -// sets verfication token to access workspace +// sets verification token to access workspace func (s *Slack) Setup(config config.CommunicationsConfig) { s.Name = config.SlackConfig.Name s.Enabled = config.SlackConfig.Enabled @@ -213,75 +213,32 @@ func (s *Slack) WebsocketReader() { switch data.Type { case "error": - if data.Error.Msg == "Socket URL has expired" { - if s.Verbose { - log.Println("Slack websocket URL has expired.. Reconnecting") - } - if err = s.WebsocketConn.Close(); err != nil { - log.Println(err) - } - s.ReconnectURL = "" - s.Connected = false - if err := s.NewConnection(); err != nil { - log.Fatal(err) - } - return - } + s.handleErrorResponse(data) case "hello": - if s.Verbose { - log.Println("Websocket connected successfully.") - } - s.Connected = true - go s.WebsocketKeepAlive() + s.handleHelloResponse(data) case "reconnect_url": - type reconnectResponse struct { - URL string `json:"url"` - } - var recURL reconnectResponse - err = common.JSONDecode(resp, &recURL) + err = s.handleReconnectResponse(resp) if err != nil { continue } - s.ReconnectURL = recURL.URL - if s.Verbose { - log.Printf("Reconnect URL set to %s\n", s.ReconnectURL) - } case "presence_change": - var pres PresenceChange - err = common.JSONDecode(resp, &pres) + err = s.handlePresenceChange(resp) if err != nil { continue } - if s.Verbose { - log.Printf("Presence change. User %s [%s] changed status to %s\n", - s.GetUsernameByID(pres.User), - pres.User, pres.Presence) - } case "message": - if data.ReplyTo != 0 { - continue - } - var msg Message - err = common.JSONDecode(resp, &msg) + err = s.handleMessageResponse(resp, data) if err != nil { continue } - if s.Verbose { - log.Printf("Msg received by %s [%s] with text: %s\n", - s.GetUsernameByID(msg.User), - msg.User, msg.Text) - } - if string(msg.Text[0]) == "!" { - s.HandleMessage(msg) - } case "pong": if s.Verbose { - log.Println("Pong recieved from server") + log.Println("Pong received from server") } default: log.Println(string(resp)) @@ -289,6 +246,80 @@ func (s *Slack) WebsocketReader() { } } +func (s *Slack) handlePresenceChange(resp []byte) error { + var pres PresenceChange + err := common.JSONDecode(resp, &pres) + if err != nil { + return err + } + if s.Verbose { + log.Printf("Presence change. User %s [%s] changed status to %s\n", + s.GetUsernameByID(pres.User), + pres.User, pres.Presence) + } + return nil +} + +func (s *Slack) handleMessageResponse(resp []byte, data WebsocketResponse) error { + if data.ReplyTo != 0 { + return fmt.Errorf("ReplyTo != 0") + } + var msg Message + err := common.JSONDecode(resp, &msg) + if err != nil { + return err + } + if s.Verbose { + log.Printf("Msg received by %s [%s] with text: %s\n", + s.GetUsernameByID(msg.User), + msg.User, msg.Text) + } + if string(msg.Text[0]) == "!" { + s.HandleMessage(msg) + } + return nil +} +func (s *Slack) handleErrorResponse(data WebsocketResponse) { + if data.Error.Msg == "Socket URL has expired" { + if s.Verbose { + log.Println("Slack websocket URL has expired.. Reconnecting") + } + if err := s.WebsocketConn.Close(); err != nil { + log.Println(err) + } + s.ReconnectURL = "" + s.Connected = false + if err := s.NewConnection(); err != nil { + log.Fatal(err) + } + return + } +} + +func (s *Slack) handleHelloResponse(data WebsocketResponse) { + if s.Verbose { + log.Println("Websocket connected successfully.") + } + s.Connected = true + go s.WebsocketKeepAlive() +} + +func (s *Slack) handleReconnectResponse(resp []byte) error { + type reconnectResponse struct { + URL string `json:"url"` + } + var recURL reconnectResponse + err := common.JSONDecode(resp, &recURL) + if err != nil { + return err + } + s.ReconnectURL = recURL.URL + if s.Verbose { + log.Printf("Reconnect URL set to %s\n", s.ReconnectURL) + } + return nil +} + // WebsocketKeepAlive sends a ping every 5 minutes to keep connection alive func (s *Slack) WebsocketKeepAlive() { ticker := time.NewTicker(5 * time.Minute) @@ -319,7 +350,7 @@ func (s *Slack) WebsocketSend(eventType, text string) error { } // HandleMessage handles incoming messages and/or commands from slack -func (s Slack) HandleMessage(msg Message) { +func (s *Slack) HandleMessage(msg Message) { switch { case common.StringContains(msg.Text, cmdStatus): s.WebsocketSend("message", s.GetStatus()) diff --git a/config/config.go b/config/config.go index 307e959a..f83a55f7 100644 --- a/config/config.go +++ b/config/config.go @@ -386,7 +386,7 @@ func (c *Config) CheckCommunicationsConfig() error { Password: "test", Contacts: []SMSContact{ - SMSContact{ + { Name: "bob", Number: "1234", Enabled: false, diff --git a/config/config_test.go b/config/config_test.go index 83a5071d..396665f1 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -35,7 +35,7 @@ func TestUpdateExchangeBankAccounts(t *testing.T) { t.Error("Test failed. UpdateDepositBankAccounts LoadConfig error", err) } - b := []BankAccount{BankAccount{Enabled: false}} + b := []BankAccount{{Enabled: false}} err = cfg.UpdateExchangeBankAccounts("Bitfinex", b) if err != nil { t.Error("Test failed. UpdateDepositBankAccounts error", err) diff --git a/currency/forexprovider/base/base_interface.go b/currency/forexprovider/base/base_interface.go index e638fa44..44fe2193 100644 --- a/currency/forexprovider/base/base_interface.go +++ b/currency/forexprovider/base/base_interface.go @@ -35,7 +35,7 @@ func (fxp IFXProviders) GetCurrencyData(baseCurrency, symbols string) (map[strin return rates, nil } } - return nil, errors.New("ForexProvider error GetCurrencyData() failed to aquire data") + return nil, errors.New("ForexProvider error GetCurrencyData() failed to acquire data") } return rates, nil } diff --git a/exchanges/alphapoint/alphapoint_wrapper.go b/exchanges/alphapoint/alphapoint_wrapper.go index bb4d1fc2..3d052b23 100644 --- a/exchanges/alphapoint/alphapoint_wrapper.go +++ b/exchanges/alphapoint/alphapoint_wrapper.go @@ -161,13 +161,13 @@ func (a *Alphapoint) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) return "", errors.New("associated currency address not found") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 703518c3..29afcb63 100644 --- a/exchanges/anx/anx_wrapper.go +++ b/exchanges/anx/anx_wrapper.go @@ -227,20 +227,20 @@ func (a *ANX) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (strin return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a withdrawal is // submitted -func (a *ANX) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (a *ANX) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/binance/binance.go b/exchanges/binance/binance.go index d1dfc9a5..f49ebc0a 100644 --- a/exchanges/binance/binance.go +++ b/exchanges/binance/binance.go @@ -449,12 +449,12 @@ func (b *Binance) QueryOrder(symbol, origClientOrderID string, orderID int64) (Q // GetAccount returns binance user accounts func (b *Binance) GetAccount() (*Account, error) { - type respone struct { + type response struct { Response Account } - var resp respone + var resp response path := fmt.Sprintf("%s%s", apiURL, accountInfo) params := url.Values{} diff --git a/exchanges/binance/binance_wrapper.go b/exchanges/binance/binance_wrapper.go index 9ed650c9..90560e23 100644 --- a/exchanges/binance/binance_wrapper.go +++ b/exchanges/binance/binance_wrapper.go @@ -176,20 +176,20 @@ func (b *Binance) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (s return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (b *Binance) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (b *Binance) WithdrawFiatExchangeFundsToInternationalBank(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 767e3a74..e1873c49 100644 --- a/exchanges/bitfinex/bitfinex_wrapper.go +++ b/exchanges/bitfinex/bitfinex_wrapper.go @@ -209,19 +209,19 @@ func (b *Bitfinex) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) ( return "", errors.New("not yet implemented") } -// WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted +// WithdrawCryptoExchangeFunds returns a withdrawal ID when a withdrawal is submitted 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (b *Bitfinex) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (b *Bitfinex) WithdrawFiatExchangeFundsToInternationalBank(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 2800f32b..b18dca5f 100644 --- a/exchanges/bitflyer/bitflyer_wrapper.go +++ b/exchanges/bitflyer/bitflyer_wrapper.go @@ -184,20 +184,20 @@ func (b *Bitflyer) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) ( return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (b *Bitflyer) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (b *Bitflyer) WithdrawFiatExchangeFundsToInternationalBank(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 67d84065..eb684ba1 100644 --- a/exchanges/bithumb/bithumb_wrapper.go +++ b/exchanges/bithumb/bithumb_wrapper.go @@ -171,20 +171,20 @@ func (b *Bithumb) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (s return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (b *Bithumb) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (b *Bithumb) WithdrawFiatExchangeFundsToInternationalBank(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 2e89fc5a..4e8b7009 100644 --- a/exchanges/bitstamp/bitstamp_wrapper.go +++ b/exchanges/bitstamp/bitstamp_wrapper.go @@ -194,20 +194,20 @@ func (b *Bitstamp) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) ( return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (b *Bitstamp) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (b *Bitstamp) WithdrawFiatExchangeFundsToInternationalBank(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 ba373ac5..56ef5bc5 100644 --- a/exchanges/bittrex/bittrex_wrapper.go +++ b/exchanges/bittrex/bittrex_wrapper.go @@ -200,20 +200,20 @@ func (b *Bittrex) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (s return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (b *Bittrex) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (b *Bittrex) WithdrawFiatExchangeFundsToInternationalBank(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 c6d6f595..bb2b6c54 100644 --- a/exchanges/btcc/btcc_wrapper.go +++ b/exchanges/btcc/btcc_wrapper.go @@ -179,20 +179,20 @@ func (b *BTCC) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (stri return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (b *BTCC) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (b *BTCC) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/btcmarkets/btcmarkets_test.go b/exchanges/btcmarkets/btcmarkets_test.go index 6838bd75..50fd4f0d 100644 --- a/exchanges/btcmarkets/btcmarkets_test.go +++ b/exchanges/btcmarkets/btcmarkets_test.go @@ -186,16 +186,16 @@ func TestGetExchangeOrderInfo(t *testing.T) { } } -func TestWithdrawExchangeCryptoFunds(t *testing.T) { +func TestWithdrawCryptoExchangeFunds(t *testing.T) { _, err := bm.WithdrawCryptoExchangeFunds("someaddress", "ltc", 0) if err == nil { t.Error("Test failed - WithdrawExchangeFunds() error", err) } } -func TestWithdrawExchangeFiatFundsToLocalBank(t *testing.T) { +func TestWithdrawFiatExchangeFunds(t *testing.T) { _, err := bm.WithdrawFiatExchangeFunds("AUD", 0) if err == nil { - t.Error("Test failed - WithdrawExchangeFiatFunds() error", err) + t.Error("Test failed - WithdrawFiatExchangeFunds() error", err) } } diff --git a/exchanges/btcmarkets/btcmarkets_wrapper.go b/exchanges/btcmarkets/btcmarkets_wrapper.go index 19e81e84..3833e875 100644 --- a/exchanges/btcmarkets/btcmarkets_wrapper.go +++ b/exchanges/btcmarkets/btcmarkets_wrapper.go @@ -242,8 +242,8 @@ func (b *BTCMarkets) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amoun return b.WithdrawAUD(bd.AccountName, bd.AccountNumber, bd.BankName, bd.BSBNumber, amount) } -// WithdrawExchangeFiatFundsToInternationalBank returns a withdrawal ID when a +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (b *BTCMarkets) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (b *BTCMarkets) WithdrawFiatExchangeFundsToInternationalBank(currency 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 3d7d7a8b..28ed2c56 100644 --- a/exchanges/coinut/coinut_wrapper.go +++ b/exchanges/coinut/coinut_wrapper.go @@ -176,20 +176,20 @@ func (c *COINUT) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (st return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (c *COINUT) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (c *COINUT) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/exchanges/exchange.go b/exchanges/exchange.go index 8f29f9be..19b87b45 100644 --- a/exchanges/exchange.go +++ b/exchanges/exchange.go @@ -549,7 +549,7 @@ type Format struct { // Formatting contain a range of exchanges formatting type Formatting []Format -// formats is a quick formatting list for generic paramaters +// formats is a quick formatting list for generic parameters var formats = Formatting{ Format{ ExchangeName: "BTC Markets", diff --git a/exchanges/exmo/exmo_wrapper.go b/exchanges/exmo/exmo_wrapper.go index 0faa3448..81dbad12 100644 --- a/exchanges/exmo/exmo_wrapper.go +++ b/exchanges/exmo/exmo_wrapper.go @@ -207,20 +207,20 @@ func (e *EXMO) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (stri return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (e *EXMO) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (e *EXMO) WithdrawFiatExchangeFundsToInternationalBank(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 e59aba7f..f971268d 100644 --- a/exchanges/gemini/gemini_wrapper.go +++ b/exchanges/gemini/gemini_wrapper.go @@ -158,20 +158,20 @@ func (g *Gemini) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (st return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (g *Gemini) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (g *Gemini) WithdrawFiatExchangeFundsToInternationalBank(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 48f1979d..2db604ca 100644 --- a/exchanges/hitbtc/hitbtc_wrapper.go +++ b/exchanges/hitbtc/hitbtc_wrapper.go @@ -190,20 +190,20 @@ func (h *HitBTC) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (st return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (h *HitBTC) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (h *HitBTC) WithdrawFiatExchangeFundsToInternationalBank(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 b87432a0..bf5659c4 100644 --- a/exchanges/huobi/huobi_wrapper.go +++ b/exchanges/huobi/huobi_wrapper.go @@ -195,20 +195,20 @@ func (h *HUOBI) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (str return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (h *HUOBI) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (h *HUOBI) WithdrawFiatExchangeFundsToInternationalBank(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 25f43590..f27ef026 100644 --- a/exchanges/itbit/itbit_wrapper.go +++ b/exchanges/itbit/itbit_wrapper.go @@ -160,20 +160,20 @@ func (i *ItBit) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (str return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (i *ItBit) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (i *ItBit) WithdrawFiatExchangeFundsToInternationalBank(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 6277d589..459341b9 100644 --- a/exchanges/kraken/kraken_wrapper.go +++ b/exchanges/kraken/kraken_wrapper.go @@ -231,20 +231,20 @@ func (k *Kraken) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (st return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (k *Kraken) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (k *Kraken) WithdrawFiatExchangeFundsToInternationalBank(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 fba9f166..ae624d9d 100644 --- a/exchanges/lakebtc/lakebtc_wrapper.go +++ b/exchanges/lakebtc/lakebtc_wrapper.go @@ -170,20 +170,20 @@ func (l *LakeBTC) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (s return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (l *LakeBTC) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (l *LakeBTC) WithdrawFiatExchangeFundsToInternationalBank(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 5d259e78..32b10903 100644 --- a/exchanges/liqui/liqui_wrapper.go +++ b/exchanges/liqui/liqui_wrapper.go @@ -179,20 +179,20 @@ func (l *Liqui) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (str return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (l *Liqui) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (l *Liqui) WithdrawFiatExchangeFundsToInternationalBank(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 eb9531ab..8ceada02 100644 --- a/exchanges/localbitcoins/localbitcoins_wrapper.go +++ b/exchanges/localbitcoins/localbitcoins_wrapper.go @@ -151,20 +151,20 @@ func (l *LocalBitcoins) GetExchangeDepositAddress(cryptocurrency pair.CurrencyIt return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (l *LocalBitcoins) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (l *LocalBitcoins) WithdrawFiatExchangeFundsToInternationalBank(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 438dd001..4b6782c5 100644 --- a/exchanges/okcoin/okcoin_wrapper.go +++ b/exchanges/okcoin/okcoin_wrapper.go @@ -193,20 +193,20 @@ func (o *OKCoin) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (st return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (o *OKCoin) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (o *OKCoin) WithdrawFiatExchangeFundsToInternationalBank(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 7dcd2fae..f8ac9119 100644 --- a/exchanges/okex/okex_wrapper.go +++ b/exchanges/okex/okex_wrapper.go @@ -198,20 +198,20 @@ func (o *OKEX) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (stri return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (o *OKEX) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (o *OKEX) WithdrawFiatExchangeFundsToInternationalBank(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 b82a5de4..6e4eb393 100644 --- a/exchanges/poloniex/poloniex_wrapper.go +++ b/exchanges/poloniex/poloniex_wrapper.go @@ -190,20 +190,20 @@ func (po *Poloniex) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (po *Poloniex) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (po *Poloniex) WithdrawFiatExchangeFundsToInternationalBank(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 35ecc135..4b1555cb 100644 --- a/exchanges/wex/wex_wrapper.go +++ b/exchanges/wex/wex_wrapper.go @@ -189,20 +189,20 @@ func (w *WEX) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (strin return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (w *WEX) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (w *WEX) WithdrawFiatExchangeFundsToInternationalBank(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 87e4b739..d95967c5 100644 --- a/exchanges/yobit/yobit_wrapper.go +++ b/exchanges/yobit/yobit_wrapper.go @@ -171,20 +171,20 @@ func (y *Yobit) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (str return "", errors.New("not yet implemented") } -// WithdrawExchangeCryptoFunds returns a withdrawal ID when a withdrawal is +// WithdrawCryptoExchangeFunds 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 +// WithdrawFiatExchangeFunds 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 +// WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a // withdrawal is submitted -func (y *Yobit) WithdrawExchangeFiatFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { +func (y *Yobit) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error) { return "", errors.New("not yet implemented") } diff --git a/helpers_test.go b/helpers_test.go index 074c7193..c9b85437 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -145,7 +145,7 @@ func TestIsRelatablePairs(t *testing.T) { t.Fatal("Unexpected result") } - // Test relationl crypto pairs with diffrent ordering and similar names + // Test relationl crypto pairs with different ordering and similar names result = IsRelatablePairs(pair.NewCurrencyPair("LTC", "XBT"), pair.NewCurrencyPair("BTC", "LTC"), false) if !result { t.Fatal("Unexpected result") diff --git a/web/.gitignore b/web/.gitignore index e9ee344e..f3b334d1 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -34,7 +34,6 @@ main.js npm-debug.log testem.log /typings -package-lock.json # e2e /e2e/*.js diff --git a/web/.travis.yml b/web/.travis.yml deleted file mode 100644 index e3d2b94c..00000000 --- a/web/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - "7" - - "6" -install: - - npm install -script: - - npm run build diff --git a/web/package-lock.json b/web/package-lock.json index f8555add..9b2cd524 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -488,18 +488,18 @@ } }, "@angular/animations": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-6.0.7.tgz", - "integrity": "sha512-yOig45sxzpEmlXy+eFgh2v2yxoE/Hh9rn7BX82uj71yobSpCYoe58AEOay1cu0FCcLi/P5qltHepDrRRxNxPMw==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-6.0.9.tgz", + "integrity": "sha512-UJTHlxVGZLefCDxTS7T0qZxrAIaQ8gGghHwDI7F3QXpXZTsAk4nHiGSt2EvneW5o6io83i6Hpr/9Fde+YvzWNg==", "dev": true, "requires": { "tslib": "^1.9.0" } }, "@angular/cdk": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-6.2.1.tgz", - "integrity": "sha512-uwW4eIGJKqOkR+ew6YcEAh1J4SP98jdyDpsZ4IEMkV9+jXcKfcwcxGFpZvs9wJsAvAr8EgNmZ8h+iuZLwJsvmA==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-6.4.0.tgz", + "integrity": "sha512-JEJ7OsVxoyEgsWG5c48mXLFGOUq0I8Mijar1ktI+TcIqdoLwO1XClcoh8MbgwImp3ZISfOghHVqcjLxhp4UASA==", "dev": true, "requires": { "tslib": "^1.7.1" @@ -543,27 +543,27 @@ } }, "@angular/common": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/@angular/common/-/common-6.0.7.tgz", - "integrity": "sha512-MUCCs3FLwqyp5wuvkUTHVGMTd3bNGDxD5IJNvaLgVliGe4r0IlETRXYqyRPs7gdVFPbiJ97P1DUONArj9xL9XA==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/common/-/common-6.0.9.tgz", + "integrity": "sha512-zjJ9WDW9787sTRiNeUvQaCvGZJu1dI8A3fYtSL8BKrGhxLsf24cSa3ljbrSmtIsCGImNxTToHzPFXo4sx2dvYg==", "dev": true, "requires": { "tslib": "^1.9.0" } }, "@angular/compiler": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-6.0.7.tgz", - "integrity": "sha512-J9I2U4NiWIBXl0ZOJkBW5G7xXhphggSirTwFLD4yKCTeJXgyldZytJZRkDUx1uouZtI2/PycvaOZoRr85N67AA==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-6.0.9.tgz", + "integrity": "sha512-/A6U/W0settfkh3tmX9p3t7+OyZ0c2sIJMlQjhfF36do0ylnIl4wuqJtHF0BWr/wmmbQzg+qAsQyWrx8vp+2Iw==", "dev": true, "requires": { "tslib": "^1.9.0" } }, "@angular/compiler-cli": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-6.0.7.tgz", - "integrity": "sha512-nDIo4TtE3oXgZiQ5vJEcr5fi3FuXRDJQSOeOQinpCrtEt3s4pU5WAX5DLFGPSD2C/EXRDvHZgF9OTJeu5U4ErQ==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-6.0.9.tgz", + "integrity": "sha512-v3C5RyJLKoDcQocDt/U195t9v8UpBH+mwVaBkEM+nLkZAGC1Uvg9nPuUXisOwljuMm9VtOWG3A8hKQ5ZYieNBg==", "dev": true, "requires": { "chokidar": "^1.4.2", @@ -581,69 +581,79 @@ } }, "@angular/core": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/@angular/core/-/core-6.0.7.tgz", - "integrity": "sha512-aZ0NvbYsMGqg0zUu7+9vuDxnGzwe++RsBBhlwHZHz1ZZwJmU6VJhUhaI+MuKC7rHyFFr9vUxvJ7ilhGaK2+J7A==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/core/-/core-6.0.9.tgz", + "integrity": "sha512-NeEUgymsR/tLvWeEAA4mGEX/S4hHbIo/2uwPGGAQAvzlk+pL7xqPoFSMKeqQahdTnWSmYa/2+X33OdJgXKKXyg==", "dev": true, "requires": { "tslib": "^1.9.0" } }, "@angular/forms": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-6.0.7.tgz", - "integrity": "sha512-bFRdWxLmTiG7z0yZaq22oBHTgVSpJwUJEbZ5ieu21JqTgIDYne+YR/xCJrPj+P2S5NDlEK84g/4y4GoNt/thhQ==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-6.0.9.tgz", + "integrity": "sha512-hZxzoO/QAd9EetNUdGpb5Wiw4Lb7R+iOCjdV8sh+C8q6Ow5G35/dfiAlNanGXVqSi8e6Qqm1aO/r4cTUWFm6vw==", "dev": true, "requires": { "tslib": "^1.9.0" } }, "@angular/http": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/@angular/http/-/http-6.0.7.tgz", - "integrity": "sha512-zk/kjsfEXjEQIRpmsjuJO5wgFNxj7JGY6Bq0nianZuyCuj/mlm0zflww2NLX4O22IMnvVSun2Kx+kDY44n4hfw==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/http/-/http-6.0.9.tgz", + "integrity": "sha512-JaYvBQQ+hJ7SKqZ+zw4C20lc7b6U5kK50nSkams10tzhITke6L/+wK8g3kiNu4XcqE5nqcIN8S95UkMGPMsa7Q==", "dev": true, "requires": { "tslib": "^1.9.0" } }, "@angular/language-service": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/@angular/language-service/-/language-service-6.0.7.tgz", - "integrity": "sha512-R96kTy9Hpy5QPHirJz+5JjnzjJZdwbGwZ6rpq79Fe15RYaYfMjFTAAhmmOgWrnTFBug0QWBWyKV7950JcJIr3Q==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/language-service/-/language-service-6.0.9.tgz", + "integrity": "sha512-a9/Ee1DfRlj4duhDW17xl+52mO6zKlBLm3JOIyANrmJqoHCf/Nfvw3OmEhjMJ1A8O6xLCXyPF/Fq0WD9BfVSrg==", "dev": true }, "@angular/material": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/@angular/material/-/material-6.2.1.tgz", - "integrity": "sha512-SBoUXxHknkgwzp5pNDHW0jyrTM0d0Tk4lVyDbtEX8VEPtXqG5nL3BSgyjpJbTvqlmy2kOooUu3qgAmt87VH9lw==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/@angular/material/-/material-6.4.0.tgz", + "integrity": "sha512-M1qSNCV3pme2qlumHHQUwH6Vye9EJob2Ia6TWaz/1B/f/kAkcLDOkKf663ott462tPEwMqzWR/0p4XT6xh7v0w==", "dev": true, "requires": { + "parse5": "^5.0.0", "tslib": "^1.7.1" + }, + "dependencies": { + "parse5": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.0.0.tgz", + "integrity": "sha512-0ywuiUOnpWWeil5grH2rxjyTJoeQVwyBuO2si6QIU9dWtj2npjuyK1HaY1RbLnVfDhEbhyAPNUBKRK0Xj2xE0w==", + "dev": true, + "optional": true + } } }, "@angular/platform-browser": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-6.0.7.tgz", - "integrity": "sha512-CASH1CDr2DD+aBrWN9qpDDFTI3H6p/oqH23h28bEV+LZl7F57r4sj8KXKgaE+mcrOFRQqXTAlPoq3hRCLmhtVA==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-6.0.9.tgz", + "integrity": "sha512-q/1UGlbWBwZ6c63p8SDmBsgjYgMQUxyByY9GGt0hd5XhOfVFzvBSzybKSRc3FBhmxQJMCtVhEbI0kIzqrDxcWg==", "dev": true, "requires": { "tslib": "^1.9.0" } }, "@angular/platform-browser-dynamic": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-6.0.7.tgz", - "integrity": "sha512-8G45A9w8UJvX3vPEHqeJHt/sd0zu6w1M+rsnOCo78r35SjsLbrmDNhc4VkLZFJ+iNjgPWtNtdpeXQqtTHE46yw==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-6.0.9.tgz", + "integrity": "sha512-HsmLafy0hpMIZlwHz1XRicXczZWCKb0H6oCY+TepFV4u3SLZgJEO7/HZrhO0kEviipXuXrgZSpafV3IYP6eWPQ==", "dev": true, "requires": { "tslib": "^1.9.0" } }, "@angular/router": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/@angular/router/-/router-6.0.7.tgz", - "integrity": "sha512-KuQBeIgfiwV3bLafepMhYVJQIAF8cTckCudFh5Z0OqckJgGsWSgtvEdtBctPi+lzt7OQBi7Ym2rOv3X0dOvu0Q==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/router/-/router-6.0.9.tgz", + "integrity": "sha512-kS489FFpGWD4GEDDozfVb+eD5qf1E9cLYgsE7RO914uNMh/sJuRZt9PVu0bcX12fOOO7mTcOiWtlkefzUAJbkA==", "dev": true, "requires": { "tslib": "^1.9.0" @@ -1174,9 +1184,9 @@ "dev": true }, "app-root-path": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-2.0.1.tgz", - "integrity": "sha1-zWLc+OT9WkF+/GZNLlsQZTxlG0Y=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-2.1.0.tgz", + "integrity": "sha1-mL9lmTJ+zqGZMJhm6BQDaP0uZGo=", "dev": true }, "append-transform": { @@ -2516,17 +2526,25 @@ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "codelyzer": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/codelyzer/-/codelyzer-4.2.1.tgz", - "integrity": "sha512-CKwfgpfkqi9dyzy4s6ELaxJ54QgJ6A8iTSsM4bzHbLuTpbKncvNc3DUlCvpnkHBhK47gEf4qFsWoYqLrJPhy6g==", + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/codelyzer/-/codelyzer-4.4.2.tgz", + "integrity": "sha512-tW796ECKMAynFtl/yyS5NRYhufbT3CEKjjMQ450kUeCcQlK7OIqD9VGRVwC3gSQSK4VaewCKCaVL0bzv9PhsLg==", "dev": true, "requires": { "app-root-path": "^2.0.1", "css-selector-tokenizer": "^0.7.0", "cssauron": "^1.4.0", "semver-dsl": "^1.0.1", - "source-map": "^0.5.6", - "sprintf-js": "^1.0.3" + "source-map": "^0.5.7", + "sprintf-js": "^1.1.1" + }, + "dependencies": { + "sprintf-js": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.1.tgz", + "integrity": "sha1-Nr54Mgr+WAH2zqPueLblqrlA6gw=", + "dev": true + } } }, "collection-visit": { @@ -16448,9 +16466,9 @@ "dev": true }, "regenerate": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.3.tgz", - "integrity": "sha512-jVpo1GadrDAK59t/0jRx5VxYWQEDkkEKi6+HjE3joFVLfDOh9Xrdh0dF1eSq+BI/SwvTQ44gSscJ8N5zYL61sg==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", + "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", "dev": true }, "regenerator-runtime": { @@ -18326,9 +18344,9 @@ "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==" }, "tslint": { - "version": "5.9.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.9.1.tgz", - "integrity": "sha1-ElX4ej/1frCw4fDmEKi0dIBGya4=", + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz", + "integrity": "sha1-mPMMAurjzecAYgHkwzywi0hYHu0=", "requires": { "babel-code-frame": "^6.22.0", "builtin-modules": "^1.1.1", @@ -18341,7 +18359,7 @@ "resolve": "^1.3.2", "semver": "^5.3.0", "tslib": "^1.8.0", - "tsutils": "^2.12.1" + "tsutils": "^2.27.2" }, "dependencies": { "chalk": { @@ -18366,6 +18384,14 @@ "requires": { "has-flag": "^3.0.0" } + }, + "tsutils": { + "version": "2.27.2", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.27.2.tgz", + "integrity": "sha512-qf6rmT84TFMuxAKez2pIfR8UCai49iQsfB7YWVjV1bKpy/d0PWT5rEOSM6La9PiHZ0k1RRZQiwVdVJfQ3BPHgg==", + "requires": { + "tslib": "^1.8.1" + } } } }, diff --git a/web/package.json b/web/package.json index 430c9d6a..3da1585d 100644 --- a/web/package.json +++ b/web/package.json @@ -32,6 +32,8 @@ "start": "node hooks/environments/set_profile.js && npm-run-all -p ng:serve electron:serve", "build": "node hooks/environments/set_profile.js && ng build && npm run electron:tsc", "build:prod": "node hooks/environments/set_profile.js && ng build --prod && npm run electron:tsc", + "lint": "tslint -c tslint.json src/**/*{.ts,.tsx} main.ts", + "lint:fix": "tslint --fix -c tslint.json src/**/*{.ts,.tsx} main.ts", "ng:serve": "ng serve -o", "electron:tsc": "tsc main.ts", "electron:serve": "wait-on http-get://localhost:4200/ && npm run electron:tsc && electron . --serve", @@ -53,27 +55,27 @@ "devDependencies": { "@amcharts/amcharts3-angular": "^2.1.1", "@angular-devkit/build-angular": "~0.6.8", - "@angular/animations": "^6.0.7", - "@angular/cdk": "^6.2.1", + "@angular/animations": "^6.0.9", + "@angular/cdk": "^6.4.0", "@angular/cli": "^6.0.8", - "@angular/common": "^6.0.7", - "@angular/compiler": "^6.0.7", - "@angular/compiler-cli": "^6.0.7", - "@angular/core": "^6.0.7", - "@angular/forms": "^6.0.7", - "@angular/http": "^6.0.7", - "@angular/language-service": "^6.0.7", - "@angular/material": "^6.2.1", - "@angular/platform-browser": "^6.0.7", - "@angular/platform-browser-dynamic": "^6.0.7", - "@angular/router": "^6.0.7", + "@angular/common": "^6.0.9", + "@angular/compiler": "^6.0.9", + "@angular/compiler-cli": "^6.0.9", + "@angular/core": "^6.0.9", + "@angular/forms": "^6.0.9", + "@angular/http": "^6.0.9", + "@angular/language-service": "^6.0.9", + "@angular/material": "^6.4.0", + "@angular/platform-browser": "^6.0.9", + "@angular/platform-browser-dynamic": "^6.0.9", + "@angular/router": "^6.0.9", "@ngx-translate/core": "^9.1.1", "@ngx-translate/http-loader": "^2.0.1", "@types/core-js": "^0.9.46", "@types/jasmine": "^2.8.8", "@types/jasminewd2": "^2.0.3", "@types/node": "^7.0.67", - "codelyzer": "^4.2.1", + "codelyzer": "^4.4.2", "core-js": "^2.5.7", "cross-env": "^5.2.0", "dotenv": "^6.0.0", @@ -94,7 +96,7 @@ "replace": "^0.3.0", "rxjs": "^6.2.1", "ts-node": "^4.1.0", - "tslint": "^5.9.1", + "tslint": "^5.11.0", "typescript": "^2.7.2", "wait-on": "^2.1.0", "webdriver-manager": "^12.0.6", diff --git a/web/src/app/app-routing.module.ts b/web/src/app/app-routing.module.ts index d1098145..d5c6c95b 100644 --- a/web/src/app/app-routing.module.ts +++ b/web/src/app/app-routing.module.ts @@ -8,7 +8,7 @@ import { TradingComponent } from './pages/trading/trading.component'; import { ExchangeGridComponent } from './pages/exchange-grid/exchange-grid.component'; import { CurrencyListComponent } from './pages/currency-list/currency-list.component'; -//Settings +// Settings import { SettingsComponent } from './pages/settings/settings.component'; import { NgModule } from '@angular/core'; @@ -20,11 +20,11 @@ const routes: Routes = [ component: HomeComponent }, { - path:'about', + path: 'about', component: AboutComponent - }, + }, { - path:'dashboard', + path: 'dashboard', component: DashboardComponent }, { @@ -52,7 +52,7 @@ const routes: Routes = [ path: 'currency-list', component: CurrencyListComponent }, - //Settings + // Settings { path: 'settings', component: SettingsComponent diff --git a/web/src/app/app.component.ts b/web/src/app/app.component.ts index c148fd5d..180ae60d 100644 --- a/web/src/app/app.component.ts +++ b/web/src/app/app.component.ts @@ -1,22 +1,22 @@ -import { Component, OnInit,ViewChild } from '@angular/core'; +import { Component, OnInit, ViewChild } from '@angular/core'; import { ElectronService } from './providers/electron.service'; import { MatSidenav } from '@angular/material'; import { SidebarService } from './services/sidebar/sidebar.service'; import { Router, NavigationEnd } from '@angular/router'; -import {WebsocketResponseHandlerService }from './services/websocket-response-handler/websocket-response-handler.service'; +import {WebsocketResponseHandlerService } from './services/websocket-response-handler/websocket-response-handler.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'], }) -export class AppComponent { - sidebarService: SidebarService +export class AppComponent implements OnInit { + sidebarService: SidebarService; public currentUrl: string; @ViewChild('sidenav') public sidenav: MatSidenav; - private ws : WebsocketResponseHandlerService; - public isConnected :boolean = false; - + private ws: WebsocketResponseHandlerService; + public isConnected = false; + constructor(public electronService: ElectronService, sidebarService: SidebarService, private router: Router, private websocketHandler: WebsocketResponseHandlerService) { if (electronService.isElectron()) { @@ -32,23 +32,23 @@ export class AppComponent { this.isConnected = this.websocketHandler.isConnected; this.sidebarService = sidebarService; router.events.subscribe(event => { - + if (event instanceof NavigationEnd) { this.isConnected = this.websocketHandler.isConnected; - console.log("current url", event.url); // event.url has current url + console.log('current url', event.url); // event.url has current url this.currentUrl = event.url; } }); - var interval = setInterval(() => { + const interval = setInterval(() => { this.isConnected = this.websocketHandler.isConnected; }, 2000); - + } ngOnInit() { this.sidebarService.setSidenav(this.sidenav); - //This will be replaced with a log in prompt which will then add the credentials to session storage - window.sessionStorage["username"] = "admin"; - window.sessionStorage["password"] = "e7cf3ef4f17c3999a94f2c6f612e8a888e5b1026878e4e19398b23bd38ec221a"; + // This will be replaced with a log in prompt which will then add the credentials to session storage + window.sessionStorage['username'] = 'admin'; + window.sessionStorage['password'] = 'e7cf3ef4f17c3999a94f2c6f612e8a888e5b1026878e4e19398b23bd38ec221a'; } } diff --git a/web/src/app/app.module.ts b/web/src/app/app.module.ts index 2e3401fc..c53637b0 100644 --- a/web/src/app/app.module.ts +++ b/web/src/app/app.module.ts @@ -7,7 +7,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { HttpModule } from '@angular/http'; import { NgModule, Injectable } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { AmChartsModule } from "@amcharts/amcharts3-angular"; +import { AmChartsModule } from '@amcharts/amcharts3-angular'; import { MatButtonModule, @@ -31,7 +31,7 @@ import { MatDialogModule, } from '@angular/material'; -//Pages +// Pages import { AppComponent } from './app.component'; import { HomeComponent } from './pages/home/home.component'; import { AboutComponent } from './pages/about/about.component'; @@ -41,12 +41,12 @@ import { DonateComponent } from './pages/donate/donate.component'; import { SettingsComponent, EnabledCurrenciesDialogueComponent } from './pages/settings/settings.component'; -//Shared +// Shared import { NavbarComponent } from './shared/navbar/navbar.component'; import { AllEnabledCurrencyTickersComponent } from './shared/all-updates-ticker/all-updates-ticker.component'; import { ThemePickerComponent } from './shared/theme-picker/theme-picker'; import {IterateMapPipe, EnabledCurrenciesPipe} from './shared/classes/pipes'; -//services +// services import { WebsocketService } from './services/websocket/websocket.service'; import { WebsocketResponseHandlerService } from './services/websocket-response-handler/websocket-response-handler.service'; import { SidebarService } from './services/sidebar/sidebar.service'; @@ -54,7 +54,7 @@ import { ElectronService } from './providers/electron.service'; import { StyleManagerService } from './services/style-manager/style-manager.service'; import { ThemeStorageService } from './services/theme-storage/theme-storage.service'; -//Routing +// Routing import { AppRoutingModule } from './app-routing.module'; import { Wallet } from './shared/classes/wallet'; @@ -136,7 +136,7 @@ import { SellFormComponent } from './shared/sell-form/sell-form.component'; providers: [ ElectronService, WebsocketService, - WebsocketResponseHandlerService, + WebsocketResponseHandlerService, SidebarService, StyleManagerService, ThemeStorageService, @@ -145,4 +145,4 @@ import { SellFormComponent } from './shared/sell-form/sell-form.component'; }) export class AppModule { -} \ No newline at end of file +} diff --git a/web/src/app/pages/currency-list/currency-list.component.ts b/web/src/app/pages/currency-list/currency-list.component.ts index 0202fb4e..00b5d686 100644 --- a/web/src/app/pages/currency-list/currency-list.component.ts +++ b/web/src/app/pages/currency-list/currency-list.component.ts @@ -12,14 +12,14 @@ import { EnabledCurrenciesPipe, IterateMapPipe} from './../../shared/classes/p export class CurrencyListComponent implements OnInit { public settings: Config = new Config(); private ws: WebsocketResponseHandlerService; - public selectedCurrency :string; - public selectedExchange :string; + public selectedCurrency: string; + public selectedExchange: string; public exchangeCurrencies: Map = new Map < string, string[] > (); - constructor(private websocketHandler: WebsocketResponseHandlerService) { - this.selectedExchange = window.localStorage["selectedExchange"]; - this.selectedCurrency = window.localStorage["selectedCurrency"]; + constructor(private websocketHandler: WebsocketResponseHandlerService) { + this.selectedExchange = window.localStorage['selectedExchange']; + this.selectedCurrency = window.localStorage['selectedCurrency']; this.ws = websocketHandler; this.ws.shared.subscribe(msg => { if (msg.event === WebSocketMessageType.GetConfig) { @@ -33,24 +33,24 @@ export class CurrencyListComponent implements OnInit { this.getSettings(); } - public selectCurrency(exchange:string,currency:string) { - window.localStorage["selectedExchange"] = exchange; - window.localStorage["selectedCurrency"] = currency; - this.selectedExchange = window.localStorage["selectedExchange"]; - this.selectedCurrency = window.localStorage["selectedCurrency"]; + public selectCurrency(exchange: string, currency: string) { + window.localStorage['selectedExchange'] = exchange; + window.localStorage['selectedCurrency'] = currency; + this.selectedExchange = window.localStorage['selectedExchange']; + this.selectedCurrency = window.localStorage['selectedCurrency']; } public getExchangeCurrencies(): void { - for (var i = 0; i < this.settings.Exchanges.length; i++) { + for (let i = 0; i < this.settings.Exchanges.length; i++) { if (this.settings.Exchanges[i].Enabled === true) { - for (var j = 0; j < this.settings.Exchanges[i].Pairs.length; j++) { - if(this.settings.Exchanges[i].Pairs[j].Enabled) { - if(this.exchangeCurrencies.has(this.settings.Exchanges[i].Pairs[j].ParsedName)) { - var array = this.exchangeCurrencies.get(this.settings.Exchanges[i].Pairs[j].ParsedName); + for (let j = 0; j < this.settings.Exchanges[i].Pairs.length; j++) { + if (this.settings.Exchanges[i].Pairs[j].Enabled) { + if (this.exchangeCurrencies.has(this.settings.Exchanges[i].Pairs[j].ParsedName)) { + const array = this.exchangeCurrencies.get(this.settings.Exchanges[i].Pairs[j].ParsedName); array.push(this.settings.Exchanges[i].Name); this.exchangeCurrencies.set(this.settings.Exchanges[i].Pairs[j].ParsedName, array); } else { - var exchangeArray = new Array(); + const exchangeArray = new Array(); exchangeArray.push(this.settings.Exchanges[i].Name); this.exchangeCurrencies.set(this.settings.Exchanges[i].Pairs[j].ParsedName, exchangeArray); } @@ -62,7 +62,7 @@ export class CurrencyListComponent implements OnInit { private getSettings(): void { if (this.settings.isConfigCacheValid()) { - this.settings.setConfig(JSON.parse(window.localStorage['config'])) + this.settings.setConfig(JSON.parse(window.localStorage['config'])); this.getExchangeCurrencies(); } else { this.ws.messages.next(WebSocketMessage.GetSettingsMessage()); diff --git a/web/src/app/pages/dashboard/dashboard.component.ts b/web/src/app/pages/dashboard/dashboard.component.ts index 1c3bca54..5f2231c8 100644 --- a/web/src/app/pages/dashboard/dashboard.component.ts +++ b/web/src/app/pages/dashboard/dashboard.component.ts @@ -14,9 +14,9 @@ import { export class DashboardComponent implements OnInit { public dashboard: any; - public expanded: boolean = false; + public expanded = false; public trades: BuySellComponent[]; - public maxTrades:number = 3; + public maxTrades = 3; constructor() { this.trades = []; @@ -37,9 +37,9 @@ export class DashboardComponent implements OnInit { } public expandTile(tile: any) { - for (var i = 0; i < this.dashboard.tiles.length; i++) { + for (let i = 0; i < this.dashboard.tiles.length; i++) { if (this.dashboard.tiles[i].title === tile.title) { - this.dashboard.tiles[i].rows = 2 + this.dashboard.tiles[i].rows = 2; this.dashboard.tiles[i].columns = 3; this.expanded = true; } else { diff --git a/web/src/app/pages/exchange-grid/exchange-grid.component.ts b/web/src/app/pages/exchange-grid/exchange-grid.component.ts index 27492620..7cd1c7f0 100644 --- a/web/src/app/pages/exchange-grid/exchange-grid.component.ts +++ b/web/src/app/pages/exchange-grid/exchange-grid.component.ts @@ -12,14 +12,14 @@ import { EnabledCurrenciesPipe, IterateMapPipe} from './../../shared/classes/p export class ExchangeGridComponent implements OnInit { public settings: Config = new Config(); private ws: WebsocketResponseHandlerService; - public selectedCurrency :string; - public selectedExchange :string; + public selectedCurrency: string; + public selectedExchange: string; public exchangeCurrencies: Map < string, CurrencyPairRedux[] > = new Map < string, CurrencyPairRedux[] > (); - constructor(private websocketHandler: WebsocketResponseHandlerService) { - this.selectedExchange = window.localStorage["selectedExchange"]; - this.selectedCurrency = window.localStorage["selectedCurrency"]; + constructor(private websocketHandler: WebsocketResponseHandlerService) { + this.selectedExchange = window.localStorage['selectedExchange']; + this.selectedCurrency = window.localStorage['selectedCurrency']; this.ws = websocketHandler; this.ws.shared.subscribe(msg => { if (msg.event === WebSocketMessageType.GetConfig) { @@ -34,17 +34,17 @@ export class ExchangeGridComponent implements OnInit { } - public selectCurrency(exchange:string,currency:string) { - window.localStorage["selectedExchange"] = exchange; - window.localStorage["selectedCurrency"] = currency; - this.selectedExchange = window.localStorage["selectedExchange"]; - this.selectedCurrency = window.localStorage["selectedCurrency"]; + public selectCurrency(exchange: string, currency: string) { + window.localStorage['selectedExchange'] = exchange; + window.localStorage['selectedCurrency'] = currency; + this.selectedExchange = window.localStorage['selectedExchange']; + this.selectedCurrency = window.localStorage['selectedCurrency']; } public getExchangeCurrencies(): void { - for (var i = 0; i < this.settings.Exchanges.length; i++) { + for (let i = 0; i < this.settings.Exchanges.length; i++) { if (this.settings.Exchanges[i].Enabled === true) { - this.exchangeCurrencies.set(this.settings.Exchanges[i].Name, this.settings.Exchanges[i].Pairs) + this.exchangeCurrencies.set(this.settings.Exchanges[i].Name, this.settings.Exchanges[i].Pairs); } } this.exchangeCurrencies.forEach((value: CurrencyPairRedux[], key: string) => {}); @@ -52,7 +52,7 @@ export class ExchangeGridComponent implements OnInit { private getSettings(): void { if (this.settings.isConfigCacheValid()) { - this.settings.setConfig(JSON.parse(window.localStorage['config'])) + this.settings.setConfig(JSON.parse(window.localStorage['config'])); this.getExchangeCurrencies(); } else { this.ws.messages.next(WebSocketMessage.GetSettingsMessage()); diff --git a/web/src/app/pages/settings/settings.component.ts b/web/src/app/pages/settings/settings.component.ts index 48cd8a10..e10ce2f4 100644 --- a/web/src/app/pages/settings/settings.component.ts +++ b/web/src/app/pages/settings/settings.component.ts @@ -11,10 +11,10 @@ import { WalletComponent } from '../wallet/wallet.component'; styleUrls: ['./settings.component.scss'], }) -export class SettingsComponent { +export class SettingsComponent implements OnInit { public settings: Config = new Config(); private ws: WebsocketResponseHandlerService; - public ready: boolean = false; + public ready = false; private snackBar: MatSnackBar; private dialogue; @@ -28,34 +28,34 @@ export class SettingsComponent { this.settings.setConfig(msg.data); this.ready = true; } else if (msg.event === WebSocketMessageType.SaveConfig) { - if(msg.error !== null || msg.error.length > 0) { + if (msg.error !== null || msg.error.length > 0) { this.snackBar.open(msg.error, '', { duration: 4000, }); - } + } if (msg.error === null || msg.error === '') { this.settings.clearCache(); this.getSettings(); this.snackBar.open('Success', msg.data, { duration: 1000, }); - } + } } }); this.getSettings(); } - public addWallet() :void { + public addWallet(): void { this.settings.PortfolioAddresses.Addresses.push({}); } - public removeWallet(wallet:any) { + public removeWallet(wallet: any) { this.settings.PortfolioAddresses.Addresses.splice(this.settings.PortfolioAddresses.Addresses.indexOf(wallet), 1); } public openModal(pairs: any): void { - let dialogRef = this.dialog.open(EnabledCurrenciesDialogueComponent, { + const dialogRef = this.dialog.open(EnabledCurrenciesDialogueComponent, { width: '20%', height: '40%', data: { pairs: pairs } @@ -63,9 +63,9 @@ export class SettingsComponent { } private getSettings(): void { - if(this.settings.isConfigCacheValid()) { - this.settings.setConfig(JSON.parse(window.localStorage['config'])) - this.ready = true; + if (this.settings.isConfigCacheValid()) { + this.settings.setConfig(JSON.parse(window.localStorage['config'])); + this.ready = true; } else { this.settings.clearCache(); this.ws.messages.next(WebSocketMessage.GetSettingsMessage()); @@ -73,17 +73,17 @@ export class SettingsComponent { } private saveSettings(): void { - this.settings.fromReduxToArray() - var settingsSave = { + this.settings.fromReduxToArray(); + const settingsSave = { Event: 'SaveConfig', data: this.settings, - } + }; this.ws.messages.next(settingsSave); } } @Component({ - selector: 'dialog-overview-example-dialog', + selector: 'app-dialog-overview-example-dialog', template: '

Enabled Currencies

{{currency.Name}}
', }) export class EnabledCurrenciesDialogueComponent { @@ -98,7 +98,7 @@ export class EnabledCurrenciesDialogueComponent { public close(): void { this.dialogRef.close(); - + } } diff --git a/web/src/app/pages/wallet/wallet.component.ts b/web/src/app/pages/wallet/wallet.component.ts index e97f3179..b0faec12 100644 --- a/web/src/app/pages/wallet/wallet.component.ts +++ b/web/src/app/pages/wallet/wallet.component.ts @@ -23,7 +23,7 @@ export class WalletComponent implements OnInit { }; constructor(private websocketHandler: WebsocketResponseHandlerService) { - this.wallet= null; + this.wallet = null; this.ws = websocketHandler; this.ws.shared.subscribe(msg => { if (msg.event === WebSocketMessageType.GetPortfolio) { @@ -32,11 +32,11 @@ export class WalletComponent implements OnInit { this.attachIcon(this.wallet.coin_totals); this.attachIcon(this.wallet.coins_offline); this.attachIcon(this.wallet.coins_online); - + this.attachIcon(this.wallet.offline_summary.BTC); this.attachIcon(this.wallet.offline_summary.ETH); this.attachIcon(this.wallet.offline_summary.LTC); - + this.attachIcon(this.wallet.online_summary.BTC); this.attachIcon(this.wallet.online_summary.ETH); this.attachIcon(this.wallet.online_summary.LTC); @@ -47,25 +47,25 @@ export class WalletComponent implements OnInit { ngOnInit() { this.setWallet(); } - - private setWallet():void { + + private setWallet(): void { this.ws.messages.next(this.getWalletMessage); } - public coinIcon(coin:string) :string { - switch(coin) { - case "BTC": return "cc BTC"; - case "LTC": return "cc LTC"; - case "ETH": return "cc ETH"; + public coinIcon(coin: string): string { + switch (coin) { + case 'BTC': return 'cc BTC'; + case 'LTC': return 'cc LTC'; + case 'ETH': return 'cc ETH'; } } public attachIcon(items: CoinTotal[]): void { if (items) { - for (var i = 0; i < items.length; i++) { + for (let i = 0; i < items.length; i++) { items[i].icon = this.coinIcon(items[i].coin); } - } + } } diff --git a/web/src/app/services/sidebar/sidebar.service.ts b/web/src/app/services/sidebar/sidebar.service.ts index 3309d1e1..2f6fc591 100644 --- a/web/src/app/services/sidebar/sidebar.service.ts +++ b/web/src/app/services/sidebar/sidebar.service.ts @@ -21,7 +21,7 @@ export class SidebarService { */ public open(): Promise { this.sidenav.open(); - + return; } @@ -46,4 +46,4 @@ export class SidebarService { this.sidenav.toggle(isOpen); return; } -} \ No newline at end of file +} diff --git a/web/src/app/services/style-manager/style-manager.service.spec.ts b/web/src/app/services/style-manager/style-manager.service.spec.ts index 8a6304a4..8d94ac01 100644 --- a/web/src/app/services/style-manager/style-manager.service.spec.ts +++ b/web/src/app/services/style-manager/style-manager.service.spec.ts @@ -1,7 +1,7 @@ import {inject, TestBed} from '@angular/core/testing'; import {HttpModule} from '@angular/http'; import {StyleManagerComponent} from './style-manager.component'; - + describe('StyleManager', () => { let styleManager: StyleManagerComponent; @@ -16,8 +16,8 @@ describe('StyleManager', () => { })); afterEach(() => { - let links = document.head.querySelectorAll('link'); - for (let link of Array.prototype.slice.call(links)) { + const links = document.head.querySelectorAll('link'); + for (const link of Array.prototype.slice.call(links)) { if (link.className.includes('style-manager-')) { document.head.removeChild(link); } @@ -26,14 +26,14 @@ describe('StyleManager', () => { it('should add stylesheet to head', () => { styleManager.setStyle('test', 'test.css'); - let styleEl = document.head.querySelector('.style-manager-test') as HTMLLinkElement; + const styleEl = document.head.querySelector('.style-manager-test') as HTMLLinkElement; expect(styleEl).not.toBeNull(); expect(styleEl.href.endsWith('test.css')).toBe(true); }); it('should change existing stylesheet', () => { styleManager.setStyle('test', 'test.css'); - let styleEl = document.head.querySelector('.style-manager-test') as HTMLLinkElement; + const styleEl = document.head.querySelector('.style-manager-test') as HTMLLinkElement; expect(styleEl).not.toBeNull(); expect(styleEl.href.endsWith('test.css')).toBe(true); @@ -51,4 +51,4 @@ describe('StyleManager', () => { styleEl = document.head.querySelector('.style-manager-test') as HTMLLinkElement; expect(styleEl).toBeNull(); }); -}); \ No newline at end of file +}); diff --git a/web/src/app/services/style-manager/style-manager.service.ts b/web/src/app/services/style-manager/style-manager.service.ts index e4843c71..cc91b449 100644 --- a/web/src/app/services/style-manager/style-manager.service.ts +++ b/web/src/app/services/style-manager/style-manager.service.ts @@ -2,7 +2,7 @@ import {Injectable} from '@angular/core'; /** * Class for managing stylesheets. Stylesheets are loaded into named slots so that they can be * removed or changed later. - */ + */ @Injectable() export class StyleManagerService { /** @@ -41,4 +41,4 @@ function createLinkElementWithKey(key: string) { function getClassNameForKey(key: string) { return `style-manager-${key}`; -} \ No newline at end of file +} diff --git a/web/src/app/services/theme-storage/theme-storage.service.spec.ts b/web/src/app/services/theme-storage/theme-storage.service.spec.ts index 316a6460..3b8502e5 100644 --- a/web/src/app/services/theme-storage/theme-storage.service.spec.ts +++ b/web/src/app/services/theme-storage/theme-storage.service.spec.ts @@ -49,4 +49,4 @@ describe('ThemeStorage Service', () => { expect(service.onThemeUpdate.emit).toHaveBeenCalled(); expect(service.onThemeUpdate.emit).toHaveBeenCalledWith(secondTestTheme); }); -}); \ No newline at end of file +}); diff --git a/web/src/app/services/theme-storage/theme-storage.service.ts b/web/src/app/services/theme-storage/theme-storage.service.ts index deef5ddd..17773493 100644 --- a/web/src/app/services/theme-storage/theme-storage.service.ts +++ b/web/src/app/services/theme-storage/theme-storage.service.ts @@ -36,4 +36,4 @@ export class ThemeStorageService { window.localStorage.removeItem(ThemeStorageService.storageKey); } catch (e) { } } -} \ No newline at end of file +} diff --git a/web/src/app/services/websocket-response-handler/websocket-response-handler.service.ts b/web/src/app/services/websocket-response-handler/websocket-response-handler.service.ts index 8373738d..66aa1ba6 100644 --- a/web/src/app/services/websocket-response-handler/websocket-response-handler.service.ts +++ b/web/src/app/services/websocket-response-handler/websocket-response-handler.service.ts @@ -10,35 +10,35 @@ const WEBSOCKET_URL = 'ws://localhost:9050/ws'; @NgModule({ }) export class WebsocketResponseHandlerService { - public messages: Subject; - public shared: Observable; - public isConnected: boolean = false; - private ws: WebsocketService; + public messages: Subject; + public shared: Observable; + public isConnected = false; + private ws: WebsocketService; - constructor(@Optional() @SkipSelf() parentModule: WebsocketResponseHandlerService, wsService: WebsocketService) { - this.ws = wsService; - this.messages = >this.ws - .connect(WEBSOCKET_URL).pipe( + constructor(@Optional() @SkipSelf() parentModule: WebsocketResponseHandlerService, wsService: WebsocketService) { + this.ws = wsService; + this.messages = >this.ws + .connect(WEBSOCKET_URL).pipe( - map((response: MessageEvent): WebSocketMessage => { - var interval = setInterval(() => { - this.isConnected = this.ws.isConnected; - }, 2000); - let websocketResponseMessage = JSON.parse(response.data); - var websocketResponseData = websocketResponseMessage.Data === undefined ? websocketResponseMessage.data : websocketResponseMessage.Data; - var websocketResponseEvent = websocketResponseMessage.Event === undefined ? websocketResponseMessage.event : websocketResponseMessage.Event; - let responseMessage = new WebSocketMessage(); - - responseMessage.event = websocketResponseEvent; - responseMessage.data = websocketResponseData; - responseMessage.exchange = websocketResponseMessage.exchange; - responseMessage.assetType = websocketResponseMessage.assetType; - responseMessage.error = websocketResponseMessage.error; + map((response: MessageEvent): WebSocketMessage => { + const interval = setInterval(() => { + this.isConnected = this.ws.isConnected; + }, 2000); + const websocketResponseMessage = JSON.parse(response.data); + const websocketResponseData = websocketResponseMessage.Data === undefined ? websocketResponseMessage.data : websocketResponseMessage.Data; + const websocketResponseEvent = websocketResponseMessage.Event === undefined ? websocketResponseMessage.event : websocketResponseMessage.Event; + const responseMessage = new WebSocketMessage(); - return responseMessage; - })); - this.isConnected = this.ws.isConnected; - - this.shared = this.messages.pipe(share()); //multicast - } -} \ No newline at end of file + responseMessage.event = websocketResponseEvent; + responseMessage.data = websocketResponseData; + responseMessage.exchange = websocketResponseMessage.exchange; + responseMessage.assetType = websocketResponseMessage.assetType; + responseMessage.error = websocketResponseMessage.error; + + return responseMessage; + })); + this.isConnected = this.ws.isConnected; + + this.shared = this.messages.pipe(share()); // multicast + } +} diff --git a/web/src/app/services/websocket/websocket.service.ts b/web/src/app/services/websocket/websocket.service.ts index d309a39b..00538942 100644 --- a/web/src/app/services/websocket/websocket.service.ts +++ b/web/src/app/services/websocket/websocket.service.ts @@ -4,7 +4,7 @@ import { WebSocketMessage } from './../../shared/classes/websocket'; @NgModule() export class WebsocketService { - public isConnected :boolean = false; + public isConnected = false; constructor (@Optional() @SkipSelf() parentModule: WebsocketService) { if (parentModule) { throw new Error( @@ -22,25 +22,25 @@ export class WebsocketService { } private create(url): Subject { - let ws = new WebSocket(url); - let observable = Observable.create( + const ws = new WebSocket(url); + const observable = Observable.create( (obs: Observer) => { ws.onmessage = obs.next.bind(obs); ws.onerror = obs.error.bind(obs); ws.onclose = () => { this.isConnected = false; - obs.complete.bind(obs) }; + obs.complete.bind(obs); }; ws.onopen = () => { this.isConnected = true; ws.send(JSON.stringify(WebSocketMessage.CreateAuthenticationMessage())); }; return ws.close.bind(ws); - }) - let observer = { + }); + const observer = { next: (data: any) => { - var counter = 0; - var interval = setInterval(() => { - if (counter == 10) { + let counter = 0; + const interval = setInterval(() => { + if (counter === 10) { clearInterval(interval); } if (ws.readyState === WebSocket.OPEN) { @@ -50,13 +50,13 @@ export class WebsocketService { } counter++; }, 400); - + if (ws.readyState !== WebSocket.OPEN) { - new Error("Failed to send message to websocket after 10 attempts"); + new Error('Failed to send message to websocket after 10 attempts'); this.isConnected = false; } } - } + }; return Subject.create(observer, observable); } -} \ No newline at end of file +} diff --git a/web/src/app/shared/all-updates-ticker/all-updates-ticker.component.ts b/web/src/app/shared/all-updates-ticker/all-updates-ticker.component.ts index 41b8279f..e76738ee 100644 --- a/web/src/app/shared/all-updates-ticker/all-updates-ticker.component.ts +++ b/web/src/app/shared/all-updates-ticker/all-updates-ticker.component.ts @@ -9,36 +9,36 @@ import { ExchangeCurrency, TickerUpdate } from './../../shared/classes/ticker'; styleUrls: ['./all-updates-ticker.component.scss'], }) export class AllEnabledCurrencyTickersComponent implements OnInit { - allCurrencies: ExchangeCurrency[] = < ExchangeCurrency[] > [];; + allCurrencies: ExchangeCurrency[] = < ExchangeCurrency[] > []; private ws: WebsocketResponseHandlerService; tickerCard: TickerUpdate = new TickerUpdate(); constructor(private websocketHandler: WebsocketResponseHandlerService) { - this.tickerCard.Exchange = "Loading"; - this.tickerCard.CurrencyPair = "..."; + this.tickerCard.Exchange = 'Loading'; + this.tickerCard.CurrencyPair = '...'; this.tickerCard.Last = -1; this.ws = websocketHandler; this.ws.shared.subscribe(msg => { if (msg.event === WebSocketMessageType.TickerUpdate) { - if (window.localStorage["selectedExchange"] !== undefined && - window.localStorage["selectedCurrency"] !== undefined) { - - this.tickerCard.Exchange = window.localStorage["selectedExchange"]; - this.tickerCard.CurrencyPair = window.localStorage["selectedCurrency"]; - - if (msg.exchange == this.tickerCard.Exchange && - this.stripCurrencyCharacters(msg.data.CurrencyPair) == this.tickerCard.CurrencyPair) { - this.updateTicker(msg) + if (window.localStorage['selectedExchange'] !== undefined && + window.localStorage['selectedCurrency'] !== undefined) { + + this.tickerCard.Exchange = window.localStorage['selectedExchange']; + this.tickerCard.CurrencyPair = window.localStorage['selectedCurrency']; + + if (msg.exchange === this.tickerCard.Exchange && + this.stripCurrencyCharacters(msg.data.CurrencyPair) === this.tickerCard.CurrencyPair) { + this.updateTicker(msg); } } else { - this.updateTicker(msg) + this.updateTicker(msg); } } }); } private updateTicker(msg: any): void { - var ticker = msg.data; + const ticker = msg.data; this.tickerCard = ticker; this.tickerCard.Exchange = msg.exchange; } @@ -53,4 +53,4 @@ export class AllEnabledCurrencyTickersComponent implements OnInit { name = name.toLocaleUpperCase(); return name; } -} \ No newline at end of file +} diff --git a/web/src/app/shared/buy-form/buy-form.component.ts b/web/src/app/shared/buy-form/buy-form.component.ts index 75fb57a6..08217518 100644 --- a/web/src/app/shared/buy-form/buy-form.component.ts +++ b/web/src/app/shared/buy-form/buy-form.component.ts @@ -6,18 +6,18 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./buy-form.component.scss'] }) export class BuyFormComponent implements OnInit { - public exchangeName :string; -public currencyName :string; -public chooseCurrencyMessage :string = "Please select a currency"; -public showErrorMessage :boolean; + public exchangeName: string; +public currencyName: string; +public chooseCurrencyMessage = 'Please select a currency'; +public showErrorMessage: boolean; constructor() { } ngOnInit() { - if (window.localStorage["selectedExchange"] !== undefined && - window.localStorage["selectedCurrency"] !== undefined) { - this.exchangeName = window.localStorage["selectedExchange"]; - this.currencyName = window.localStorage["selectedCurrency"]; + if (window.localStorage['selectedExchange'] !== undefined && + window.localStorage['selectedCurrency'] !== undefined) { + this.exchangeName = window.localStorage['selectedExchange']; + this.currencyName = window.localStorage['selectedCurrency']; } else { this.showErrorMessage = true; } diff --git a/web/src/app/shared/buy-sell/buy-sell.component.ts b/web/src/app/shared/buy-sell/buy-sell.component.ts index 628842a2..2b817788 100644 --- a/web/src/app/shared/buy-sell/buy-sell.component.ts +++ b/web/src/app/shared/buy-sell/buy-sell.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit,Directive, ViewContainerRef } from '@angular/core'; +import { Component, OnInit, Directive, ViewContainerRef } from '@angular/core'; @Component({ selector: 'app-buy-sell', diff --git a/web/src/app/shared/classes/config.ts b/web/src/app/shared/classes/config.ts index 5bedd701..e007312a 100644 --- a/web/src/app/shared/classes/config.ts +++ b/web/src/app/shared/classes/config.ts @@ -1,4 +1,4 @@ -import { inherits } from "util"; +import { inherits } from 'util'; export class Config { Name: string; @@ -12,23 +12,21 @@ export class Config { Communications: Communcations; CurrencyConfig: CurrencyConfig; - public isConfigCacheValid() : boolean { - let dateStored = +new Date(window.localStorage['configDate']); - let dateNow = +new Date(); - var dateDifference = Math.abs(dateNow - dateStored) - var diffMins = Math.floor((dateDifference / 1000) / 60); - (diffMins) - - if(isNaN(new Date(dateStored).getTime()) || diffMins > 15) { + public isConfigCacheValid(): boolean { + const dateStored = +new Date(window.localStorage['configDate']); + const dateNow = +new Date(); + const dateDifference = Math.abs(dateNow - dateStored); + const diffMins = Math.floor((dateDifference / 1000) / 60); + + if (isNaN(new Date(dateStored).getTime()) || diffMins > 15) { return false; - } - else { - return true + } else { + return true; } } public setConfig(data: any): void { - var configData = data; + const configData = data; this.Cryptocurrencies = configData.Cryptocurrencies; this.CurrencyExchangeProvider = configData.CurrencyExchangeProvider; this.Exchanges = configData.Exchanges; @@ -47,28 +45,28 @@ export class Config { return; } this.fromArrayToRedux(); - //Rewrite to cache on parsing to redux array + // Rewrite to cache on parsing to redux array this.saveToCache(); } - public saveToCache() : void { - window.localStorage['config'] = JSON.stringify(this); + public saveToCache(): void { + window.localStorage['config'] = JSON.stringify(this); window.localStorage['configDate'] = new Date().toString(); } - public clearCache() : void { + public clearCache(): void { window.localStorage['config'] = null; window.localStorage['configDate'] = null; } - public fromArrayToRedux() : void { - for (var i = 0; i < this.Exchanges.length; i++) { + public fromArrayToRedux(): void { + for (let i = 0; i < this.Exchanges.length; i++) { this.Exchanges[i].Pairs = new Array(); - var avail = this.Exchanges[i].AvailablePairs.split(','); - var enabled = this.Exchanges[i].EnabledPairs.split(','); - for (var j = 0; j < avail.length; j++) { - var currencyPair = new CurrencyPairRedux(); - currencyPair.Name = avail[j] + const avail = this.Exchanges[i].AvailablePairs.split(','); + const enabled = this.Exchanges[i].EnabledPairs.split(','); + for (let j = 0; j < avail.length; j++) { + const currencyPair = new CurrencyPairRedux(); + currencyPair.Name = avail[j]; currencyPair.ParsedName = this.stripCurrencyCharacters(avail[j]); if (enabled.indexOf(avail[j]) > 0) { currencyPair.Enabled = true; @@ -81,11 +79,11 @@ export class Config { } - public parseSettings() : void { + public parseSettings(): void { } - private stripCurrencyCharacters(name:string) :string { + private stripCurrencyCharacters(name: string): string { name = name.replace('_', ''); name = name.replace('-', ''); name = name.replace(' ', ''); @@ -93,23 +91,23 @@ export class Config { return name; } - public fromReduxToArray() : void { - for (var i = 0; i < this.Exchanges.length; i++) { + public fromReduxToArray(): void { + for (let i = 0; i < this.Exchanges.length; i++) { // Step 1, iterate over the Pairs - var enabled = this.Exchanges[i].EnabledPairs.split(','); - for (var j = 0; j < this.Exchanges[i].Pairs.length; j++) { + const enabled = this.Exchanges[i].EnabledPairs.split(','); + for (let j = 0; j < this.Exchanges[i].Pairs.length; j++) { if (this.Exchanges[i].Pairs[j].Enabled) { - if (enabled.indexOf(this.Exchanges[i].Pairs[j].Name) == -1) { + if (enabled.indexOf(this.Exchanges[i].Pairs[j].Name) === -1) { // Step 3 if its not in the enabled list, add it enabled.push(this.Exchanges[i].Pairs[j].Name); - } + } } else { if (enabled.indexOf(this.Exchanges[i].Pairs[j].Name) > -1) { enabled.splice(enabled.indexOf(this.Exchanges[i].Pairs[j].Name), 1); } } } - //Step 4 JSONifiy the enabled list and set it to the this.settings.Exchanges[i].EnabledPairs + // Step 4 JSONifiy the enabled list and set it to the this.settings.Exchanges[i].EnabledPairs this.Exchanges[i].EnabledPairs = enabled.join(); } } @@ -120,31 +118,31 @@ export class CurrencyPairRedux { ParsedName: string; Enabled: boolean; } - + export interface CurrencyPairFormat { Uppercase: boolean; Delimiter: string; } - + export interface PortfolioAddresses { Addresses?: Wallet[]; } export interface Wallet { - Address:string; - CoinType:string; - Balance:number; - Description:string + Address: string; + CoinType: string; + Balance: number; + Description: string; } - + export class SMSGlobalContact { Name: string; Number: string; Enabled: boolean; } - - + + export interface Webserver { Enabled: boolean; AdminUsername: string; @@ -153,20 +151,20 @@ export class CurrencyPairRedux { WebsocketConnectionLimit: number; WebsocketAllowInsecureOrigin: boolean; } - + export interface ConfigCurrencyPairFormat { Uppercase: boolean; Index: string; Delimiter: string; } - + export interface RequestCurrencyPairFormat { Uppercase: boolean; Index: string; Delimiter: string; Separator: string; } - + export interface Exchange { Name: string; Enabled: boolean; @@ -185,14 +183,14 @@ export class CurrencyPairRedux { ClientID: string; Pairs: CurrencyPairRedux[]; } - + export class Communcations { Slack: SlackCommunication; SMSGlobal: SMSGlobalCommunication; SMTP: SMTPCommunication; Telegram: TelegramCommunication; -} +} export class SlackCommunication { @@ -250,7 +248,7 @@ export class CurrencyPairFormat { Uppercase: boolean; Delimiter: string; } - - - - \ No newline at end of file + + + + diff --git a/web/src/app/shared/classes/pipes.ts b/web/src/app/shared/classes/pipes.ts index 34bb544a..11e33005 100644 --- a/web/src/app/shared/classes/pipes.ts +++ b/web/src/app/shared/classes/pipes.ts @@ -1,14 +1,14 @@ import { Component, OnInit, OnDestroy, Pipe, PipeTransform } from '@angular/core'; import { CurrencyPairRedux } from './../../shared/classes/config'; - + @Pipe({ name: 'iterateMap' }) export class IterateMapPipe implements PipeTransform { transform(iterable: any, args: any[]): any { - let result = []; - + const result = []; + if (iterable.entries) { iterable.forEach((key, value) => { result.push({ @@ -17,7 +17,7 @@ import { CurrencyPairRedux } from './../../shared/classes/config'; }); }); } else { - for (let key in iterable) { + for (const key in iterable) { if (iterable.hasOwnProperty(key)) { result.push({ key, @@ -26,11 +26,11 @@ import { CurrencyPairRedux } from './../../shared/classes/config'; } } } - + return result; } } - + @Pipe({ name: 'enabledCurrencies' }) @@ -42,4 +42,4 @@ import { CurrencyPairRedux } from './../../shared/classes/config'; return items.filter(item => item.Enabled === true); } } - \ No newline at end of file + diff --git a/web/src/app/shared/classes/ticker.ts b/web/src/app/shared/classes/ticker.ts index 56a9dd17..f7050f59 100644 --- a/web/src/app/shared/classes/ticker.ts +++ b/web/src/app/shared/classes/ticker.ts @@ -2,13 +2,13 @@ export interface ExchangeCurrency { currencyPair: string; exchangeName: string; } - + export interface CurrencyPair { delimiter: string; first_currency: string; second_currency: string; } - + export class TickerUpdate { Pair: CurrencyPair; CurrencyPair: string; @@ -21,4 +21,4 @@ export interface ExchangeCurrency { PriceATH: number; Exchange: string; } - \ No newline at end of file + diff --git a/web/src/app/shared/classes/wallet.ts b/web/src/app/shared/classes/wallet.ts index 5efa4f4a..6956f896 100644 --- a/web/src/app/shared/classes/wallet.ts +++ b/web/src/app/shared/classes/wallet.ts @@ -4,19 +4,19 @@ export interface CoinTotal { balance: number; percentage: number; address: string; - icon:string; + icon: string; } - + export interface Summary { BTC: CoinTotal[]; ETH: CoinTotal[]; LTC: CoinTotal[]; } - + export interface Wallet { coin_totals: CoinTotal[]; coins_offline: CoinTotal[]; offline_summary: Summary; coins_online: CoinTotal[]; online_summary: Summary; - } \ No newline at end of file + } diff --git a/web/src/app/shared/classes/websocket.ts b/web/src/app/shared/classes/websocket.ts index 57d94da5..12bee94a 100644 --- a/web/src/app/shared/classes/websocket.ts +++ b/web/src/app/shared/classes/websocket.ts @@ -6,16 +6,16 @@ export class WebSocketMessage { public error: string; public static CreateAuthenticationMessage(): WebSocketMessage { - var response = new WebSocketMessage(); - + const response = new WebSocketMessage(); + response.event = WebSocketMessageType.Auth; - response.data = { "username": window.sessionStorage["username"], "password": window.sessionStorage["password"] }; + response.data = { 'username': window.sessionStorage['username'], 'password': window.sessionStorage['password'] }; return response; - }; + } - public static GetSettingsMessage() : WebSocketMessage { - var response = new WebSocketMessage(); + public static GetSettingsMessage(): WebSocketMessage { + const response = new WebSocketMessage(); response.event = WebSocketMessageType.GetConfig; response.data = null; @@ -25,9 +25,9 @@ export class WebSocketMessage { } export class WebSocketMessageType { - public static Auth: string = "auth"; - public static GetConfig: string = "GetConfig"; - public static SaveConfig: string = "SaveConfig"; - public static GetPortfolio: string = "GetPortfolio"; - public static TickerUpdate: string = "ticker_update"; + public static Auth = 'auth'; + public static GetConfig = 'GetConfig'; + public static SaveConfig = 'SaveConfig'; + public static GetPortfolio = 'GetPortfolio'; + public static TickerUpdate = 'ticker_update'; } diff --git a/web/src/app/shared/my-orders/my-orders.component.ts b/web/src/app/shared/my-orders/my-orders.component.ts index b05aeb89..b8e9be63 100644 --- a/web/src/app/shared/my-orders/my-orders.component.ts +++ b/web/src/app/shared/my-orders/my-orders.component.ts @@ -6,12 +6,12 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./my-orders.component.scss'] }) export class MyOrdersComponent implements OnInit { - public orders:MyOrders[] = []; - + public orders: MyOrders[] = []; + constructor() { } ngOnInit() { - var item = new MyOrders(); + const item = new MyOrders(); item.amount = 1234; item.price = 423; item.total = 2; @@ -28,8 +28,8 @@ export class MyOrdersComponent implements OnInit { export class MyOrders { - public count:number; - public total:number; - public price:number; - public amount:number; + public count: number; + public total: number; + public price: number; + public amount: number; } diff --git a/web/src/app/shared/navbar/navbar.component.ts b/web/src/app/shared/navbar/navbar.component.ts index 7e01d4e0..669c0867 100644 --- a/web/src/app/shared/navbar/navbar.component.ts +++ b/web/src/app/shared/navbar/navbar.component.ts @@ -7,7 +7,7 @@ import { SidebarService } from './../../services/sidebar/sidebar.service'; styleUrls: ['./navbar.component.scss'] }) export class NavbarComponent implements OnInit { - sidebarService: SidebarService + sidebarService: SidebarService; constructor(something: SidebarService) { this.sidebarService = something; } diff --git a/web/src/app/shared/orders/orders.component.ts b/web/src/app/shared/orders/orders.component.ts index e392b2d5..ab95e237 100644 --- a/web/src/app/shared/orders/orders.component.ts +++ b/web/src/app/shared/orders/orders.component.ts @@ -6,11 +6,11 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./orders.component.scss'] }) export class OrdersComponent implements OnInit { - public orders:Order[] = []; + public orders: Order[] = []; constructor() { } ngOnInit() { - var item = new Order(); + const item = new Order(); item.amount = 12; item.price = 23; item.total = 3; @@ -45,15 +45,15 @@ export class OrdersComponent implements OnInit { this.orders.push(item); this.orders.push(item); this.orders.push(item); - + } } export class Order { - public count:number; - public total:number; - public price:number; - public amount:number; -} \ No newline at end of file + public count: number; + public total: number; + public price: number; + public amount: number; +} diff --git a/web/src/app/shared/price-history/price-history.component.ts b/web/src/app/shared/price-history/price-history.component.ts index f3f26bdb..2712cd37 100644 --- a/web/src/app/shared/price-history/price-history.component.ts +++ b/web/src/app/shared/price-history/price-history.component.ts @@ -1,465 +1,461 @@ -import { Component, OnInit } from '@angular/core'; -import { AmChartsService, AmChart } from "@amcharts/amcharts3-angular"; +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { AmChartsService, AmChart } from '@amcharts/amcharts3-angular'; @Component({ selector: 'app-price-history', templateUrl: './price-history.component.html', styleUrls: ['./price-history.component.scss'] }) -export class PriceHistoryComponent implements OnInit { +export class PriceHistoryComponent implements OnInit, OnDestroy { private chart: AmChart; public chartData = [ { - "country": "USA", - "visits": 4252 + 'country': 'USA', + 'visits': 4252 }, { - "country": "China", - "visits": 1882 + 'country': 'China', + 'visits': 1882 }, { - "country": "Japan", - "visits": 1809 + 'country': 'Japan', + 'visits': 1809 }, { - "country": "Germany", - "visits": 1322 + 'country': 'Germany', + 'visits': 1322 }, { - "country": "UK", - "visits": 1122 + 'country': 'UK', + 'visits': 1122 }, { - "country": "France", - "visits": 1114 + 'country': 'France', + 'visits': 1114 }, { - "country": "India", - "visits": 984 + 'country': 'India', + 'visits': 984 }, { - "country": "Spain", - "visits": 711 + 'country': 'Spain', + 'visits': 711 }, { - "country": "Netherlands", - "visits": 665 + 'country': 'Netherlands', + 'visits': 665 }, { - "country": "Russia", - "visits": 580 + 'country': 'Russia', + 'visits': 580 }, { - "country": "South Korea", - "visits": 443 + 'country': 'South Korea', + 'visits': 443 }, { - "country": "Canada", - "visits": 441 + 'country': 'Canada', + 'visits': 441 }, { - "country": "Brazil", - "visits": 395 + 'country': 'Brazil', + 'visits': 395 }, { - "country": "Italy", - "visits": 386 + 'country': 'Italy', + 'visits': 386 }, { - "country": "Australia", - "visits": 384 + 'country': 'Australia', + 'visits': 384 }, { - "country": "Taiwan", - "visits": 338 + 'country': 'Taiwan', + 'visits': 338 }, { - "country": "Poland", - "visits": 328 + 'country': 'Poland', + 'visits': 328 } ]; public options = { - "type": "serial", - "theme": "dark", - "dataDateFormat": "YYYY-MM-DD", - "zoomOutOnDataUpdate": false, - "valueAxes": [{ - "position": "left" + 'type': 'serial', + 'theme': 'dark', + 'dataDateFormat': 'YYYY-MM-DD', + 'zoomOutOnDataUpdate': false, + 'valueAxes': [{ + 'position': 'left' }], - "graphs": [{ - "id": "g1", - "balloonText": "Open:[[open]]
Low:[[low]]
High:[[high]]
Close:[[close]]
", - "closeField": "close", - "fillColors": "#7f8da9", - "highField": "high", - "lineColor": "#7f8da9", - "lineAlpha": 1, - "lowField": "low", - "fillAlphas": 0.9, - "negativeFillColors": "#db4c3c", - "negativeLineColor": "#db4c3c", - "openField": "open", - "title": "Price:", - "type": "candlestick", - "valueField": "close" + 'graphs': [{ + 'id': 'g1', + 'balloonText': 'Open:[[open]]
Low:[[low]]
High:[[high]]
Close:[[close]]
', + 'closeField': 'close', + 'fillColors': '#7f8da9', + 'highField': 'high', + 'lineColor': '#7f8da9', + 'lineAlpha': 1, + 'lowField': 'low', + 'fillAlphas': 0.9, + 'negativeFillColors': '#db4c3c', + 'negativeLineColor': '#db4c3c', + 'openField': 'open', + 'title': 'Price:', + 'type': 'candlestick', + 'valueField': 'close' }, { - "valueField": "open", - "bullet": "round", - "bulletColor": "#0c0", - "bulletAlpha": 0, - "alphaField": "openAlpha", - "lineAlpha": 0, - "showBalloon": false, - "visibleInLegend": false + 'valueField': 'open', + 'bullet': 'round', + 'bulletColor': '#0c0', + 'bulletAlpha': 0, + 'alphaField': 'openAlpha', + 'lineAlpha': 0, + 'showBalloon': false, + 'visibleInLegend': false }, { - "valueField": "high", - "bullet": "round", - "bulletColor": "#0c0", - "bulletAlpha": 0, - "alphaField": "highAlpha", - "lineAlpha": 0, - "showBalloon": false, - "visibleInLegend": false + 'valueField': 'high', + 'bullet': 'round', + 'bulletColor': '#0c0', + 'bulletAlpha': 0, + 'alphaField': 'highAlpha', + 'lineAlpha': 0, + 'showBalloon': false, + 'visibleInLegend': false }, { - "valueField": "low", - "bullet": "round", - "bulletColor": "#0c0", - "bulletAlpha": 0, - "alphaField": "lowAlpha", - "lineAlpha": 0, - "showBalloon": false, - "visibleInLegend": false + 'valueField': 'low', + 'bullet': 'round', + 'bulletColor': '#0c0', + 'bulletAlpha': 0, + 'alphaField': 'lowAlpha', + 'lineAlpha': 0, + 'showBalloon': false, + 'visibleInLegend': false }, { - "valueField": "close", - "bullet": "round", - "bulletColor": "#0c0", - "bulletAlpha": 0, - "alphaField": "closeAlpha", - "lineAlpha": 0, - "showBalloon": false, - "visibleInLegend": false + 'valueField': 'close', + 'bullet': 'round', + 'bulletColor': '#0c0', + 'bulletAlpha': 0, + 'alphaField': 'closeAlpha', + 'lineAlpha': 0, + 'showBalloon': false, + 'visibleInLegend': false }], - "chartScrollbar": { - "graph": "g1", - "graphType": "line", - "scrollbarHeight": 30 + 'chartScrollbar': { + 'graph': 'g1', + 'graphType': 'line', + 'scrollbarHeight': 30 }, - "chartCursor": { - "valueLineEnabled": true, - "valueLineBalloonEnabled": true + 'chartCursor': { + 'valueLineEnabled': true, + 'valueLineBalloonEnabled': true }, - "categoryField": "date", - "categoryAxis": { - "parseDates": true + 'categoryField': 'date', + 'categoryAxis': { + 'parseDates': true }, - "listeners": [{ - "event": "clickGraphItem", - "method": function(e) { - + 'listeners': [{ + 'event': 'clickGraphItem', + 'method': function(e) { + // does previous bullet exist? if (e.chart.firstPoint !== undefined) { // reset e.item.dataContext[e.graph.alphaField] = 1; e.chart.firstPoint = undefined; - } - // is this the same bullet that is already selected? - else if( e.item.dataContext[e.graph.alphaField] === 1 ) { + } else if ( e.item.dataContext[e.graph.alphaField] === 1 ) { // unselect it e.item.dataContext[e.graph.alphaField] = undefined; e.chart.firstPoint = undefined; - } - // first click - else { + } else { e.item.dataContext[e.graph.alphaField] = 1; e.chart.firstPoint = e.item; } - + e.chart.validateData(); } }], - "dataProvider": [{ - "date": "2011-08-01", - "open": "136.65", - "high": "136.96", - "low": "134.15", - "close": "136.49" + 'dataProvider': [{ + 'date': '2011-08-01', + 'open': '136.65', + 'high': '136.96', + 'low': '134.15', + 'close': '136.49' }, { - "date": "2011-08-02", - "open": "135.26", - "high": "135.95", - "low": "131.50", - "close": "131.85" + 'date': '2011-08-02', + 'open': '135.26', + 'high': '135.95', + 'low': '131.50', + 'close': '131.85' }, { - "date": "2011-08-05", - "open": "132.90", - "high": "135.27", - "low": "128.30", - "close": "135.25" + 'date': '2011-08-05', + 'open': '132.90', + 'high': '135.27', + 'low': '128.30', + 'close': '135.25' }, { - "date": "2011-08-06", - "open": "134.94", - "high": "137.24", - "low": "132.63", - "close": "135.03" + 'date': '2011-08-06', + 'open': '134.94', + 'high': '137.24', + 'low': '132.63', + 'close': '135.03' }, { - "date": "2011-08-07", - "open": "136.76", - "high": "136.86", - "low": "132.00", - "close": "134.01" + 'date': '2011-08-07', + 'open': '136.76', + 'high': '136.86', + 'low': '132.00', + 'close': '134.01' }, { - "date": "2011-08-08", - "open": "131.11", - "high": "133.00", - "low": "125.09", - "close": "126.39" + 'date': '2011-08-08', + 'open': '131.11', + 'high': '133.00', + 'low': '125.09', + 'close': '126.39' }, { - "date": "2011-08-09", - "open": "123.12", - "high": "127.75", - "low": "120.30", - "close": "125.00" + 'date': '2011-08-09', + 'open': '123.12', + 'high': '127.75', + 'low': '120.30', + 'close': '125.00' }, { - "date": "2011-08-12", - "open": "128.32", - "high": "129.35", - "low": "126.50", - "close": "127.79" + 'date': '2011-08-12', + 'open': '128.32', + 'high': '129.35', + 'low': '126.50', + 'close': '127.79' }, { - "date": "2011-08-13", - "open": "128.29", - "high": "128.30", - "low": "123.71", - "close": "124.03" + 'date': '2011-08-13', + 'open': '128.29', + 'high': '128.30', + 'low': '123.71', + 'close': '124.03' }, { - "date": "2011-08-14", - "open": "122.74", - "high": "124.86", - "low": "119.65", - "close": "119.90" + 'date': '2011-08-14', + 'open': '122.74', + 'high': '124.86', + 'low': '119.65', + 'close': '119.90' }, { - "date": "2011-08-15", - "open": "117.01", - "high": "118.50", - "low": "111.62", - "close": "117.05" + 'date': '2011-08-15', + 'open': '117.01', + 'high': '118.50', + 'low': '111.62', + 'close': '117.05' }, { - "date": "2011-08-16", - "open": "122.01", - "high": "123.50", - "low": "119.82", - "close": "122.06" + 'date': '2011-08-16', + 'open': '122.01', + 'high': '123.50', + 'low': '119.82', + 'close': '122.06' }, { - "date": "2011-08-19", - "open": "123.96", - "high": "124.50", - "low": "120.50", - "close": "122.22" + 'date': '2011-08-19', + 'open': '123.96', + 'high': '124.50', + 'low': '120.50', + 'close': '122.22' }, { - "date": "2011-08-20", - "open": "122.21", - "high": "128.96", - "low": "121.00", - "close": "127.57" + 'date': '2011-08-20', + 'open': '122.21', + 'high': '128.96', + 'low': '121.00', + 'close': '127.57' }, { - "date": "2011-08-21", - "open": "131.22", - "high": "132.75", - "low": "130.33", - "close": "132.51" + 'date': '2011-08-21', + 'open': '131.22', + 'high': '132.75', + 'low': '130.33', + 'close': '132.51' }, { - "date": "2011-08-22", - "open": "133.09", - "high": "133.34", - "low": "129.76", - "close": "131.07" + 'date': '2011-08-22', + 'open': '133.09', + 'high': '133.34', + 'low': '129.76', + 'close': '131.07' }, { - "date": "2011-08-23", - "open": "130.53", - "high": "135.37", - "low": "129.81", - "close": "135.30" + 'date': '2011-08-23', + 'open': '130.53', + 'high': '135.37', + 'low': '129.81', + 'close': '135.30' }, { - "date": "2011-08-26", - "open": "133.39", - "high": "134.66", - "low": "132.10", - "close": "132.25" + 'date': '2011-08-26', + 'open': '133.39', + 'high': '134.66', + 'low': '132.10', + 'close': '132.25' }, { - "date": "2011-08-27", - "open": "130.99", - "high": "132.41", - "low": "126.63", - "close": "126.82" + 'date': '2011-08-27', + 'open': '130.99', + 'high': '132.41', + 'low': '126.63', + 'close': '126.82' }, { - "date": "2011-08-28", - "open": "129.88", - "high": "134.18", - "low": "129.54", - "close": "134.08" + 'date': '2011-08-28', + 'open': '129.88', + 'high': '134.18', + 'low': '129.54', + 'close': '134.08' }, { - "date": "2011-08-29", - "open": "132.67", - "high": "138.25", - "low": "132.30", - "close": "136.25" + 'date': '2011-08-29', + 'open': '132.67', + 'high': '138.25', + 'low': '132.30', + 'close': '136.25' }, { - "date": "2011-08-30", - "open": "139.49", - "high": "139.65", - "low": "137.41", - "close": "138.48" + 'date': '2011-08-30', + 'open': '139.49', + 'high': '139.65', + 'low': '137.41', + 'close': '138.48' }, { - "date": "2011-09-03", - "open": "139.94", - "high": "145.73", - "low": "139.84", - "close": "144.16" + 'date': '2011-09-03', + 'open': '139.94', + 'high': '145.73', + 'low': '139.84', + 'close': '144.16' }, { - "date": "2011-09-04", - "open": "144.97", - "high": "145.84", - "low": "136.10", - "close": "136.76" + 'date': '2011-09-04', + 'open': '144.97', + 'high': '145.84', + 'low': '136.10', + 'close': '136.76' }, { - "date": "2011-09-05", - "open": "135.56", - "high": "137.57", - "low": "132.71", - "close": "135.01" + 'date': '2011-09-05', + 'open': '135.56', + 'high': '137.57', + 'low': '132.71', + 'close': '135.01' }, { - "date": "2011-09-06", - "open": "132.01", - "high": "132.30", - "low": "130.00", - "close": "131.77" + 'date': '2011-09-06', + 'open': '132.01', + 'high': '132.30', + 'low': '130.00', + 'close': '131.77' }, { - "date": "2011-09-09", - "open": "136.99", - "high": "138.04", - "low": "133.95", - "close": "136.71" + 'date': '2011-09-09', + 'open': '136.99', + 'high': '138.04', + 'low': '133.95', + 'close': '136.71' }, { - "date": "2011-09-10", - "open": "137.90", - "high": "138.30", - "low": "133.75", - "close": "135.49" + 'date': '2011-09-10', + 'open': '137.90', + 'high': '138.30', + 'low': '133.75', + 'close': '135.49' }, { - "date": "2011-09-11", - "open": "135.99", - "high": "139.40", - "low": "135.75", - "close": "136.85" + 'date': '2011-09-11', + 'open': '135.99', + 'high': '139.40', + 'low': '135.75', + 'close': '136.85' }, { - "date": "2011-09-12", - "open": "138.83", - "high": "139.00", - "low": "136.65", - "close": "137.20" + 'date': '2011-09-12', + 'open': '138.83', + 'high': '139.00', + 'low': '136.65', + 'close': '137.20' }, { - "date": "2011-09-13", - "open": "136.57", - "high": "138.98", - "low": "136.20", - "close": "138.81" + 'date': '2011-09-13', + 'open': '136.57', + 'high': '138.98', + 'low': '136.20', + 'close': '138.81' }, { - "date": "2011-09-16", - "open": "138.99", - "high": "140.59", - "low": "137.60", - "close": "138.41" + 'date': '2011-09-16', + 'open': '138.99', + 'high': '140.59', + 'low': '137.60', + 'close': '138.41' }, { - "date": "2011-09-17", - "open": "139.06", - "high": "142.85", - "low": "137.83", - "close": "140.92" + 'date': '2011-09-17', + 'open': '139.06', + 'high': '142.85', + 'low': '137.83', + 'close': '140.92' }, { - "date": "2011-09-18", - "open": "143.02", - "high": "143.16", - "low": "139.40", - "close": "140.77" + 'date': '2011-09-18', + 'open': '143.02', + 'high': '143.16', + 'low': '139.40', + 'close': '140.77' }, { - "date": "2011-09-19", - "open": "140.15", - "high": "141.79", - "low": "139.32", - "close": "140.31" + 'date': '2011-09-19', + 'open': '140.15', + 'high': '141.79', + 'low': '139.32', + 'close': '140.31' }, { - "date": "2011-09-20", - "open": "141.14", - "high": "144.65", - "low": "140.31", - "close": "144.15" + 'date': '2011-09-20', + 'open': '141.14', + 'high': '144.65', + 'low': '140.31', + 'close': '144.15' }, { - "date": "2011-09-23", - "open": "146.73", - "high": "149.85", - "low": "146.65", - "close": "148.28" + 'date': '2011-09-23', + 'open': '146.73', + 'high': '149.85', + 'low': '146.65', + 'close': '148.28' }, { - "date": "2011-09-24", - "open": "146.84", - "high": "153.22", - "low": "146.82", - "close": "153.18" + 'date': '2011-09-24', + 'open': '146.84', + 'high': '153.22', + 'low': '146.82', + 'close': '153.18' }, { - "date": "2011-09-25", - "open": "154.47", - "high": "155.00", - "low": "151.25", - "close": "152.77" + 'date': '2011-09-25', + 'open': '154.47', + 'high': '155.00', + 'low': '151.25', + 'close': '152.77' }, { - "date": "2011-09-26", - "open": "153.77", - "high": "154.52", - "low": "152.32", - "close": "154.50" + 'date': '2011-09-26', + 'open': '153.77', + 'high': '154.52', + 'low': '152.32', + 'close': '154.50' }, { - "date": "2011-09-27", - "open": "153.44", - "high": "154.60", - "low": "152.75", - "close": "153.47" + 'date': '2011-09-27', + 'open': '153.44', + 'high': '154.60', + 'low': '152.75', + 'close': '153.47' }, { - "date": "2011-09-30", - "open": "154.63", - "high": "157.41", - "low": "152.93", - "close": "156.34" + 'date': '2011-09-30', + 'open': '154.63', + 'high': '157.41', + 'low': '152.93', + 'close': '156.34' }, { - "date": "2011-10-01", - "open": "156.55", - "high": "158.59", - "low": "155.89", - "close": "158.45" + 'date': '2011-10-01', + 'open': '156.55', + 'high': '158.59', + 'low': '155.89', + 'close': '158.45' }, { - "date": "2011-10-02", - "open": "157.78", - "high": "159.18", - "low": "157.01", - "close": "157.92" + 'date': '2011-10-02', + 'open': '157.78', + 'high': '159.18', + 'low': '157.01', + 'close': '157.92' }, { - "date": "2011-10-03", - "open": "158.00", - "high": "158.08", - "low": "153.50", - "close": "156.24" + 'date': '2011-10-03', + 'open': '158.00', + 'high': '158.08', + 'low': '153.50', + 'close': '156.24' }, { - "date": "2011-10-04", - "open": "158.37", - "high": "161.58", - "low": "157.70", - "close": "161.45" + 'date': '2011-10-04', + 'open': '158.37', + 'high': '161.58', + 'low': '157.70', + 'close': '161.45' }, { - "date": "2011-10-07", - "open": "163.49", - "high": "167.91", - "low": "162.97", - "close": "167.91" + 'date': '2011-10-07', + 'open': '163.49', + 'high': '167.91', + 'low': '162.97', + 'close': '167.91' }, { - "date": "2011-10-08", - "open": "170.20", - "high": "171.11", - "low": "166.68", - "close": "167.86" + 'date': '2011-10-08', + 'open': '170.20', + 'high': '171.11', + 'low': '166.68', + 'close': '167.86' }, { - "date": "2011-10-09", - "open": "167.55", - "high": "167.88", - "low": "165.60", - "close": "166.79" + 'date': '2011-10-09', + 'open': '167.55', + 'high': '167.88', + 'low': '165.60', + 'close': '166.79' }] }; - + constructor(private AmCharts: AmChartsService) { } diff --git a/web/src/app/shared/sell-form/sell-form.component.ts b/web/src/app/shared/sell-form/sell-form.component.ts index 6d5c7863..31d536aa 100644 --- a/web/src/app/shared/sell-form/sell-form.component.ts +++ b/web/src/app/shared/sell-form/sell-form.component.ts @@ -6,18 +6,18 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./sell-form.component.scss'] }) export class SellFormComponent implements OnInit { - public exchangeName :string; - public currencyName :string; - public chooseCurrencyMessage :string = "Please select a currency"; - public showErrorMessage :boolean; - + public exchangeName: string; + public currencyName: string; + public chooseCurrencyMessage = 'Please select a currency'; + public showErrorMessage: boolean; + constructor() { } - + ngOnInit() { - if (window.localStorage["selectedExchange"] !== undefined && - window.localStorage["selectedCurrency"] !== undefined) { - this.exchangeName = window.localStorage["selectedExchange"]; - this.currencyName = window.localStorage["selectedCurrency"]; + if (window.localStorage['selectedExchange'] !== undefined && + window.localStorage['selectedCurrency'] !== undefined) { + this.exchangeName = window.localStorage['selectedExchange']; + this.currencyName = window.localStorage['selectedCurrency']; } else { this.showErrorMessage = true; } diff --git a/web/src/app/shared/theme-picker/theme-picker.ts b/web/src/app/shared/theme-picker/theme-picker.ts index 8dbab4fd..7f18e6b3 100644 --- a/web/src/app/shared/theme-picker/theme-picker.ts +++ b/web/src/app/shared/theme-picker/theme-picker.ts @@ -1,12 +1,12 @@ import {Component, ViewEncapsulation, ChangeDetectionStrategy, NgModule} from '@angular/core'; import { StyleManagerService } from './../../services/style-manager/style-manager.service'; -import { ThemeStorageService,DocsSiteTheme } from './../../services/theme-storage/theme-storage.service'; +import { ThemeStorageService, DocsSiteTheme } from './../../services/theme-storage/theme-storage.service'; import {CommonModule} from '@angular/common'; @Component({ - selector: 'theme-picker', + selector: 'app-theme-picker', templateUrl: 'theme-picker.html', styleUrls: ['theme-picker.scss'], changeDetection: ChangeDetectionStrategy.OnPush, @@ -54,7 +54,7 @@ export class ThemePickerComponent { href: 'green-gold.css', isDark: false, }, - + ]; constructor( @@ -84,4 +84,4 @@ export class ThemePickerComponent { private _getCurrentThemeFromHref(href: string): DocsSiteTheme { return this.themes.find(theme => theme.href === href); } -} \ No newline at end of file +} diff --git a/web/src/app/shared/trade-history/trade-history.component.ts b/web/src/app/shared/trade-history/trade-history.component.ts index ab572fb4..a6032c15 100644 --- a/web/src/app/shared/trade-history/trade-history.component.ts +++ b/web/src/app/shared/trade-history/trade-history.component.ts @@ -6,14 +6,14 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./trade-history.component.scss'] }) export class TradeHistoryComponent implements OnInit { - public orders:TradeHistoryOrder[] = []; + public orders: TradeHistoryOrder[] = []; constructor() { } ngOnInit() { - var item = new TradeHistoryOrder(); + const item = new TradeHistoryOrder(); item.amount = 1, item.price = 1, - item.time = new Date() + item.time = new Date(); this.orders.push(item); this.orders.push(item); this.orders.push(item); @@ -50,7 +50,7 @@ export class TradeHistoryComponent implements OnInit { } export class TradeHistoryOrder { - public price:number; - public time:Date; - public amount:number; -} \ No newline at end of file + public price: number; + public time: Date; + public amount: number; +} diff --git a/web/tslint.json b/web/tslint.json index 6d998136..eef4395e 100644 --- a/web/tslint.json +++ b/web/tslint.json @@ -1,7 +1,7 @@ { "rulesDirectory": [ "node_modules/codelyzer", - "node_modules/rxjs-tslint" + "node_modules/rxjs-tslint" ], "rules": { "rxjs-collapse-imports": true, diff --git a/websocket.go b/websocket.go index 3d0901cc..6d2de95f 100644 --- a/websocket.go +++ b/websocket.go @@ -26,16 +26,16 @@ type wsCommandHandler struct { } var wsHandlers = map[string]wsCommandHandler{ - "auth": wsCommandHandler{authRequired: false, handler: wsAuth}, - "getconfig": wsCommandHandler{authRequired: true, handler: wsGetConfig}, - "saveconfig": wsCommandHandler{authRequired: true, handler: wsSaveConfig}, - "getaccountinfo": wsCommandHandler{authRequired: true, handler: wsGetAccountInfo}, - "gettickers": wsCommandHandler{authRequired: false, handler: wsGetTickers}, - "getticker": wsCommandHandler{authRequired: false, handler: wsGetTicker}, - "getorderbooks": wsCommandHandler{authRequired: false, handler: wsGetOrderbooks}, - "getorderbook": wsCommandHandler{authRequired: false, handler: wsGetOrderbook}, - "getexchangerates": wsCommandHandler{authRequired: false, handler: wsGetExchangeRates}, - "getportfolio": wsCommandHandler{authRequired: true, handler: wsGetPortfolio}, + "auth": {authRequired: false, handler: wsAuth}, + "getconfig": {authRequired: true, handler: wsGetConfig}, + "saveconfig": {authRequired: true, handler: wsSaveConfig}, + "getaccountinfo": {authRequired: true, handler: wsGetAccountInfo}, + "gettickers": {authRequired: false, handler: wsGetTickers}, + "getticker": {authRequired: false, handler: wsGetTicker}, + "getorderbooks": {authRequired: false, handler: wsGetOrderbooks}, + "getorderbook": {authRequired: false, handler: wsGetOrderbook}, + "getexchangerates": {authRequired: false, handler: wsGetExchangeRates}, + "getportfolio": {authRequired: true, handler: wsGetPortfolio}, } // WebsocketClient stores information related to the websocket client @@ -306,21 +306,21 @@ func wsAuth(client *WebsocketClient, data interface{}) error { wsResp.Data = WebsocketResponseSuccess log.Println("websocket: client authenticated successfully") return client.SendWebsocketMessage(wsResp) - } else { - wsResp.Error = "invalid username/password" - client.authFailures++ - client.SendWebsocketMessage(wsResp) - if client.authFailures >= bot.config.Webserver.WebsocketMaxAuthFailures { - log.Printf("websocket: disconnecting client, maximum auth failures threshold reached (failures: %d limit: %d)", - client.authFailures, bot.config.Webserver.WebsocketMaxAuthFailures) - wsHub.Unregister <- client - return nil - } + } - log.Printf("websocket: client sent wrong username/password (failures: %d limit: %d)", + wsResp.Error = "invalid username/password" + client.authFailures++ + client.SendWebsocketMessage(wsResp) + if client.authFailures >= bot.config.Webserver.WebsocketMaxAuthFailures { + log.Printf("websocket: disconnecting client, maximum auth failures threshold reached (failures: %d limit: %d)", client.authFailures, bot.config.Webserver.WebsocketMaxAuthFailures) + wsHub.Unregister <- client return nil } + + log.Printf("websocket: client sent wrong username/password (failures: %d limit: %d)", + client.authFailures, bot.config.Webserver.WebsocketMaxAuthFailures) + return nil } func wsGetConfig(client *WebsocketClient, data interface{}) error {