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

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