mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-31 23:16:54 +00:00
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:
committed by
Adrian Gallagher
parent
a5f51328d4
commit
0f209165d5
@@ -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
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,4 +49,4 @@ describe('ThemeStorage Service', () => {
|
||||
expect(service.onThemeUpdate.emit).toHaveBeenCalled();
|
||||
expect(service.onThemeUpdate.emit).toHaveBeenCalledWith(secondTestTheme);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -36,4 +36,4 @@ export class ThemeStorageService {
|
||||
window.localStorage.removeItem(ThemeStorageService.storageKey);
|
||||
} catch (e) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) { }
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user