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
This commit is contained in:
Marco Franssen
2018-07-18 07:46:47 +02:00
committed by Adrian Gallagher
parent a5f51328d4
commit 0f209165d5
71 changed files with 970 additions and 916 deletions

View File

@@ -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)

View File

@@ -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}

View File

@@ -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())

View File

@@ -386,7 +386,7 @@ func (c *Config) CheckCommunicationsConfig() error {
Password: "test",
Contacts: []SMSContact{
SMSContact{
{
Name: "bob",
Number: "1234",
Enabled: false,

View File

@@ -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)

View File

@@ -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
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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{}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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)
}
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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",

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")
}

View File

@@ -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")

1
web/.gitignore vendored
View File

@@ -34,7 +34,6 @@ main.js
npm-debug.log
testem.log
/typings
package-lock.json
# e2e
/e2e/*.js

View File

@@ -1,8 +0,0 @@
language: node_js
node_js:
- "7"
- "6"
install:
- npm install
script:
- npm run build

134
web/package-lock.json generated
View File

@@ -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"
}
}
}
},

View File

@@ -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",

View File

@@ -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

View File

@@ -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';
}
}

View File

@@ -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 {
}
}

View File

@@ -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 <string, string[] > = 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<string>();
const exchangeArray = new Array<string>();
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());

View File

@@ -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 {

View File

@@ -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());

View File

@@ -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(<Wallet>{});
}
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: '<h4>Enabled Currencies</h4><div *ngFor="let currency of data.pairs"><mat-checkbox name="{{currency.Name}}2" [(ngModel)]="currency.Enabled">{{currency.Name}}</mat-checkbox></div><button mat-raised-button color="primary" (click)="close()">DONE</button>',
})
export class EnabledCurrenciesDialogueComponent {
@@ -98,7 +98,7 @@ export class EnabledCurrenciesDialogueComponent {
public close(): void {
this.dialogRef.close();
}
}

View File

@@ -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);
}
}
}
}

View File

@@ -21,7 +21,7 @@ export class SidebarService {
*/
public open(): Promise<MatDrawerToggleResult> {
this.sidenav.open();
return;
}
@@ -46,4 +46,4 @@ export class SidebarService {
this.sidenav.toggle(isOpen);
return;
}
}
}

View File

@@ -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();
});
});
});

View File

@@ -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}`;
}
}

View File

@@ -49,4 +49,4 @@ describe('ThemeStorage Service', () => {
expect(service.onThemeUpdate.emit).toHaveBeenCalled();
expect(service.onThemeUpdate.emit).toHaveBeenCalledWith(secondTestTheme);
});
});
});

View File

@@ -36,4 +36,4 @@ export class ThemeStorageService {
window.localStorage.removeItem(ThemeStorageService.storageKey);
} catch (e) { }
}
}
}

View File

@@ -10,35 +10,35 @@ const WEBSOCKET_URL = 'ws://localhost:9050/ws';
@NgModule({
})
export class WebsocketResponseHandlerService {
public messages: Subject<any>;
public shared: Observable<WebSocketMessage>;
public isConnected: boolean = false;
private ws: WebsocketService;
public messages: Subject<any>;
public shared: Observable<WebSocketMessage>;
public isConnected = false;
private ws: WebsocketService;
constructor(@Optional() @SkipSelf() parentModule: WebsocketResponseHandlerService, wsService: WebsocketService) {
this.ws = wsService;
this.messages = <Subject<WebSocketMessage>>this.ws
.connect(WEBSOCKET_URL).pipe(
constructor(@Optional() @SkipSelf() parentModule: WebsocketResponseHandlerService, wsService: WebsocketService) {
this.ws = wsService;
this.messages = <Subject<WebSocketMessage>>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
}
}
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
}
}

View File

@@ -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<MessageEvent> {
let ws = new WebSocket(url);
let observable = Observable.create(
const ws = new WebSocket(url);
const observable = Observable.create(
(obs: Observer<MessageEvent>) => {
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);
}
}
}

View File

@@ -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 = <TickerUpdate> msg.data;
const ticker = <TickerUpdate> msg.data;
this.tickerCard = ticker;
this.tickerCard.Exchange = msg.exchange;
}
@@ -53,4 +53,4 @@ export class AllEnabledCurrencyTickersComponent implements OnInit {
name = name.toLocaleUpperCase();
return name;
}
}
}

View File

@@ -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;
}

View File

@@ -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',

View File

@@ -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 = <Config>data;
const configData = <Config>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<CurrencyPairRedux>();
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;
}

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -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';
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}
public count: number;
public total: number;
public price: number;
public amount: number;
}

View File

@@ -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:<b>[[open]]</b><br>Low:<b>[[low]]</b><br>High:<b>[[high]]</b><br>Close:<b>[[close]]</b><br>",
"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:<b>[[open]]</b><br>Low:<b>[[low]]</b><br>High:<b>[[high]]</b><br>Close:<b>[[close]]</b><br>',
'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) { }

View File

@@ -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;
}

View File

@@ -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);
}
}
}

View File

@@ -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;
}
public price: number;
public time: Date;
public amount: number;
}

View File

@@ -1,7 +1,7 @@
{
"rulesDirectory": [
"node_modules/codelyzer",
"node_modules/rxjs-tslint"
"node_modules/rxjs-tslint"
],
"rules": {
"rxjs-collapse-imports": true,

View File

@@ -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 {