Adds webserver with dashboard that gets all enabled exchanges and currencies

This commit is contained in:
Scott
2016-07-26 20:47:06 +10:00
parent 5176a10b45
commit 22f3739e8c
51 changed files with 601 additions and 911 deletions

3
web/.bowerrc Normal file
View File

@@ -0,0 +1,3 @@
{
"directory": "app/bower_components"
}

7
web/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
logs/*
!.gitkeep
node_modules/
bower_components/
tmp
.DS_Store
.idea

24
web/.jshintrc Normal file
View File

@@ -0,0 +1,24 @@
{
"strict": "global",
"globals": {
// Angular
"angular": false,
// Angular mocks
"module": false,
"inject": false,
// Jasmine
"jasmine": false,
"describe": false,
"beforeEach": false,
"afterEach": false,
"it": false,
"expect": false,
// Protractor
"browser": false,
"element": false,
"by": false
}
}

14
web/.travis.yml Normal file
View File

@@ -0,0 +1,14 @@
language: node_js
node_js:
- '4.4'
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm start > /dev/null &
- npm run update-webdriver
- sleep 1 # give server time to start
script:
- node_modules/.bin/karma start karma.conf.js --no-auto-watch --single-run --reporters=dots --browsers=Firefox
- node_modules/.bin/protractor e2e-tests/protractor.conf.js --browser=firefox

22
web/LICENSE Normal file
View File

@@ -0,0 +1,22 @@
The MIT License
Copyright (c) 2010-2016 Google, Inc. http://angularjs.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

24
web/README.md Normal file
View File

@@ -0,0 +1,24 @@
### Prerequisites
You need git to clone the angular-seed repository. You can get git from
[http://git-scm.com/](http://git-scm.com/).
We also use a number of node.js tools to initialize and test angular-seed. You must have node.js and
its package manager (npm) installed. You can get them from [http://nodejs.org/](http://nodejs.org/).
### Install Dependencies
```
npm install
```
### Run the Application
The simplest way to start this server is:
```
npm start
```
Now browse to the app at `http://localhost/`.

30
web/app/app.css Normal file
View File

@@ -0,0 +1,30 @@
/* app css stylesheet */
.menu {
list-style: none;
border-bottom: 0.1em solid black;
margin-bottom: 2em;
padding: 0 0 0.5em;
}
.menu:before {
content: "[";
}
.menu:after {
content: "]";
}
.menu > li {
display: inline;
}
.menu > li:before {
content: "|";
padding-right: 0.3em;
}
.menu > li:nth-child(1):before {
content: "";
padding: 0;
}

View File

@@ -1,12 +1,14 @@
'use strict';
// Declare app level module which depends on views, and components
angular.module('gocryptoweb', [
angular.module('myApp', [
'ngRoute',
'gocryptoweb.controllers'
'myApp.home',
'myApp.about',
'myApp.version'
]).
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
$locationProvider.hashPrefix('!');
$routeProvider.otherwise({redirectTo: '/view1'});
$routeProvider.otherwise({redirectTo: '/'});
}]);

View File

@@ -0,0 +1,9 @@
'use strict';
angular.module('myApp.version.interpolate-filter', [])
.filter('interpolate', ['version', function(version) {
return function(text) {
return String(text).replace(/\%VERSION\%/mg, version);
};
}]);

View File

@@ -0,0 +1,15 @@
'use strict';
describe('myApp.version module', function() {
beforeEach(module('myApp.version'));
describe('interpolate filter', function() {
beforeEach(module(function($provide) {
$provide.value('version', 'TEST_VER');
}));
it('should replace VERSION', inject(function(interpolateFilter) {
expect(interpolateFilter('before %VERSION% after')).toEqual('before TEST_VER after');
}));
});
});

View File

@@ -0,0 +1,9 @@
'use strict';
angular.module('myApp.version.version-directive', [])
.directive('appVersion', ['version', function(version) {
return function(scope, elm, attrs) {
elm.text(version);
};
}]);

View File

@@ -0,0 +1,17 @@
'use strict';
describe('myApp.version module', function() {
beforeEach(module('myApp.version'));
describe('app-version directive', function() {
it('should print current version', function() {
module(function($provide) {
$provide.value('version', 'TEST_VER');
});
inject(function($compile, $rootScope) {
var element = $compile('<span app-version></span>')($rootScope);
expect(element.text()).toEqual('TEST_VER');
});
});
});
});

View File

@@ -0,0 +1,8 @@
'use strict';
angular.module('myApp.version', [
'myApp.version.interpolate-filter',
'myApp.version.version-directive'
])
.value('version', '0.1');

View File

@@ -0,0 +1,11 @@
'use strict';
describe('myApp.version module', function() {
beforeEach(module('myApp.version'));
describe('version service', function() {
it('should return current version', inject(function(version) {
expect(version).toEqual('0.1');
}));
});
});

58
web/app/index-async.html Normal file
View File

@@ -0,0 +1,58 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="bower_components/html5-boilerplate/css/normalize.css">
<link rel="stylesheet" href="bower_components/html5-boilerplate/css/main.css">
<style>
[ng-cloak] {
display: none;
}
</style>
<script src="bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js"></script>
<script>
// include angular loader, which allows the files to load in any order
//@@NG_LOADER_START@@
// You need to run `npm run update-index-async` to inject the angular async code here
//@@NG_LOADER_END@@
// include a third-party async loader library
/*!
* $script.js v1.3
* https://github.com/ded/script.js
* Copyright: @ded & @fat - Dustin Diaz, Jacob Thornton 2011
* Follow our software http://twitter.com/dedfat
* License: MIT
*/
!function(a,b,c){function t(a,c){var e=b.createElement("script"),f=j;e.onload=e.onerror=e[o]=function(){e[m]&&!/^c|loade/.test(e[m])||f||(e.onload=e[o]=null,f=1,c())},e.async=1,e.src=a,d.insertBefore(e,d.firstChild)}function q(a,b){p(a,function(a){return!b(a)})}var d=b.getElementsByTagName("head")[0],e={},f={},g={},h={},i="string",j=!1,k="push",l="DOMContentLoaded",m="readyState",n="addEventListener",o="onreadystatechange",p=function(a,b){for(var c=0,d=a.length;c<d;++c)if(!b(a[c]))return j;return 1};!b[m]&&b[n]&&(b[n](l,function r(){b.removeEventListener(l,r,j),b[m]="complete"},j),b[m]="loading");var s=function(a,b,d){function o(){if(!--m){e[l]=1,j&&j();for(var a in g)p(a.split("|"),n)&&!q(g[a],n)&&(g[a]=[])}}function n(a){return a.call?a():e[a]}a=a[k]?a:[a];var i=b&&b.call,j=i?b:d,l=i?a.join(""):b,m=a.length;c(function(){q(a,function(a){h[a]?(l&&(f[l]=1),o()):(h[a]=1,l&&(f[l]=1),t(s.path?s.path+a+".js":a,o))})},0);return s};s.get=t,s.ready=function(a,b,c){a=a[k]?a:[a];var d=[];!q(a,function(a){e[a]||d[k](a)})&&p(a,function(a){return e[a]})?b():!function(a){g[a]=g[a]||[],g[a][k](b),c&&c(d)}(a.join("|"));return s};var u=a.$script;s.noConflict=function(){a.$script=u;return this},typeof module!="undefined"&&module.exports?module.exports=s:a.$script=s}(this,document,setTimeout)
// load all of the dependencies asynchronously.
$script([
'bower_components/angular/angular.js',
'bower_components/angular-route/angular-route.js',
'app.js',
'view1/view1.js',
'view2/view2.js',
'components/version/version.js',
'components/version/version-directive.js',
'components/version/interpolate-filter.js'
], function() {
// when all is done, execute bootstrap angular application
angular.bootstrap(document, ['myApp']);
});
</script>
<title>My AngularJS App</title>
<link rel="stylesheet" href="app.css">
</head>
<body ng-cloak>
<ul class="menu">
<li><a href="#!/view1">view1</a></li>
<li><a href="#!/view2">view2</a></li>
</ul>
<div ng-view></div>
<div>Angular seed app: v<span app-version></span></div>
</body>
</html>

63
web/app/index.html Normal file
View File

@@ -0,0 +1,63 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="en" ng-app="myApp" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en" ng-app="myApp" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>GoCrpto Trader</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/bower_components/html5-boilerplate/dist/css/normalize.css">
<link rel="stylesheet" href="/bower_components/html5-boilerplate/dist/css/main.css">
<link rel="stylesheet" href="/app.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script src="bower_components/html5-boilerplate/dist/js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/">
GoCrypto Trader
</a>
</div>
<ul class="nav navbar-nav">
<li><a href="#!/">Dashboard</a></li>
<li><a href="#!/about">About</a></li>
</ul>
<ul class="nav navbar-nav pull-right">
<li class=""><a href="#!/settings">Settings</a></li>
</ul>
</div>
</nav>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div ng-view></div>
<p class="text-center text-muted">Copyright 2016 GoCrypto Trader</p>
<!-- In production use:
<script src="//ajax.googleapis.com/ajax/libs/angularjs/x.x.x/angular.min.js"></script>
-->
<script src="/bower_components/angular/angular.js"></script>
<script src="/bower_components/angular-route/angular-route.js"></script>
<script src="/app.js"></script>
<script src="/views/home/home.js"></script>
<script src="/views/about/about.js"></script>
<script src="/components/version/version.js"></script>
<script src="/components/version/version-directive.js"></script>
<script src="/components/version/interpolate-filter.js"></script>
</body>
</html>

View File

@@ -1,18 +1,4 @@
<!-- views/pages/about.ejs -->
<!DOCTYPE html>
<html lang="en">
<head>
<% include ../partials/head %>
</head>
<body class="container">
<header>
<% include ../partials/header %>
</header>
<main>
<div class="row">
<div class="row">
<div class="col-sm-8">
<div class="jumbotron">
@@ -190,11 +176,4 @@ Run the application! </p>
</div>
</div>
</main>
<footer>
<% include ../partials/footer %>
</footer>
</body>
</html>
</main>

View File

@@ -0,0 +1,14 @@
'use strict';
angular.module('myApp.about', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/about', {
templateUrl: '/views/about/about.html',
controller: 'AboutController'
});
}])
.controller('AboutController', [function() {
}]);

View File

@@ -0,0 +1,16 @@
'use strict';
describe('myApp.view2 module', function() {
beforeEach(module('myApp.view2'));
describe('view2 controller', function(){
it('should ....', inject(function($controller) {
//spec body
var view2Ctrl = $controller('View2Ctrl');
expect(view2Ctrl).toBeDefined();
}));
});
});

View File

@@ -0,0 +1,28 @@
<h2>Dashboard</h2>
<h3>All enabled currencies</h3>
<div ng-repeat="exchange in exchanges">
<h4>{{exchange.exchangeName}}</h4>
<table class="table table-striped">
<tr>
<th>Currency</th>
<th>Last</th>
<th>High</th>
<th>Low</th>
<th>Volume</th>
<th>Bid</th>
<th>Ask</th>
</tr>
<tr ng-repeat="value in exchange.exchangeValues">
<td>{{value.CryptoCurrency}}</td>
<td>{{value.Last}}</td>
<td>{{value.High}}</td>
<td>{{value.Low}}</td>
<td>{{value.Volume}}</td>
<td>{{value.Bid}}</td>
<td>{{value.Ask}}</td>
</tr>
</table>
<div ng-repeat="value in exchange.exchangeValues">
</div>
</div>

View File

@@ -0,0 +1,28 @@
'use strict';
angular.module('myApp.home', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/', {
templateUrl: '/views/home/home.html',
controller: 'HomeController'
});
}])
.controller('HomeController', function ($scope, $http) {
$scope.getDashboardData = function() {
$http({
method: 'GET',
url: '/data/all-enabled-currencies'
}).
success(function (data, status, headers, config) {
$scope.exchanges = data.data;
}).
error(function (data, status, headers, config) {
console.log('error');
});
};
$scope.getDashboardData();
});

View File

@@ -0,0 +1,16 @@
'use strict';
describe('myApp.view1 module', function() {
beforeEach(module('myApp.view1'));
describe('view1 controller', function(){
it('should ....', inject(function($controller) {
//spec body
var view1Ctrl = $controller('View1Ctrl');
expect(view1Ctrl).toBeDefined();
}));
});
});

15
web/bower.json Normal file
View File

@@ -0,0 +1,15 @@
{
"name": "angular-seed",
"description": "A starter project for AngularJS",
"version": "0.0.0",
"homepage": "https://github.com/angular/angular-seed",
"license": "MIT",
"private": true,
"dependencies": {
"angular": "~1.5.0",
"angular-route": "~1.5.0",
"angular-loader": "~1.5.0",
"angular-mocks": "~1.5.0",
"html5-boilerplate": "^5.3.0"
}
}

View File

@@ -1,49 +0,0 @@
{{template "header" .}}
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/dashboard-marketdepth">Template Trading Platform v0.0</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="/logout">Logout</a></li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li><a href="/dashboard-marketdepth">Market Depth</a></li>
<li><a href="/dashboard-ordermanagement">Order Management</a></li>
<li><a href="/dashboard-reports">Reports</li>
<li><a href="/dashboard-settings">Settings</a></li>
<li class="active"><a href="/dashboard-contact">Contact<span class="sr-only">(current)</span></a></li>
</ul>
<ul class="nav nav-sidebar">
</ul>
<ul class="nav nav-sidebar">
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header">Contact Us</h1>
<h2 class="sub-header">Contact us @ https://github.com/thrasher-/gocryptotrader</h2>
<div>
<p>
</p>
</div>
</div>
</div>
</div>
{{template "footer" .}}

View File

@@ -1,89 +0,0 @@
{{template "header" .}}
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/dashboard-marketdepth">Template Trading Platform v0.0</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="/logout">Logout</a></li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li class="active"><a href="/dashboard-marketdepth">Market Depth<span class="sr-only">(current)</span></a></li>
<li><a href="/dashboard-ordermanagement">Order Management</a></li>
<li><a href="/dashboard-reports">Reports</a></li>
<li><a href="/dashboard-settings">Settings</a></li>
<li><a href="/dashboard-contact">Contact</a></li>
</ul>
<ul class="nav nav-sidebar">
</ul>
<ul class="nav nav-sidebar">
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header">Current Market Depth & Analysis</h1>
<div class="row placeholders">
<div class="col-xs-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail">
<h4>Asset Allocation Pie Graph</h4>
<span class="text-muted">Currencies owned and tracked.</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail">
<h4>Profit/Loss/Initial Pie Graph</h4>
<span class="text-muted">Current portfolio health.</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail">
<h4>Exchanges Pie Graph</h4>
<span class="text-muted">Based on current daily volume and analysis.</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail">
<h4>Market Capitalisation Pie Graph</h4>
<span class="text-muted">In USD terms per deemed weighted currencies.</span>
</div>
</div>
<h2 class="sub-header">Tickers table</h2>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Exchange</th>
<th>LAST - BTC/USD</th>
<th>LAST - LTC/USD</th>
<th>LAST - BTC/LTC</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>SOMETHING HERE</td>
<td>SOMETHING HERE</td>
<td>SOMETHING HERE</td>
<td>SOMETHING HERE</td>
<td>SOMETHING HERE</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
{{template "footer" .}}

View File

@@ -1,70 +0,0 @@
{{template "header" .}}
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/dashboard-marketdepth">Template Trading Platform v0.0</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="/logout">Logout</a></li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li><a href="/dashboard-marketdepth">Market Depth</a></li>
<li class="active"><a href="/dashboard-ordermanagement">Order Management<span class="sr-only">(current)</span></a></li>
<li><a href="/dashboard-reports">Reports</a></li>
<li><a href="/dashboard-settings">Settings</a></li>
<li><a href="/dashboard-contact">Contact</a></li>
</ul>
<ul class="nav nav-sidebar">
</ul>
<ul class="nav nav-sidebar">
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header">Order Management</h1>
<p>
<h3>Order Management Tools Go Here.</h3>
</p>
<h2 class="sub-header">Prior Trades</h2>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>DATE/TIME</th>
<th>EXCHANGE</th>
<th>CURRENCIES USED</th>
<th>PROFIT LOSS</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>SOMETHING HERE</td>
<td>SOMETHING HERE</td>
<td>SOMETHING HERE</td>
<td>SOMETHING HERE</td>
<td>SOMETHING HERE</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
{{template "footer" .}}

View File

@@ -1,89 +0,0 @@
{{template "header" .}}
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/dashboard-marketdepth">Template Trading Platform v0.0</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="/logout">Logout</a></li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li><a href="/dashboard-marketdepth">Market Depth</a></li>
<li><a href="/dashboard-ordermanagement">Order Management</a></li>
<li class="active"><a href="/dashboard-reports">Reports<span class="sr-only">(current)</span></a></li>
<li><a href="/dashboard-settings">Settings</a></li>
<li><a href="/dashboard-contact">Contact</a></li>
</ul>
<ul class="nav nav-sidebar">
</ul>
<ul class="nav nav-sidebar">
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header">Reports</h1>
<div class="row placeholders">
<div class="col-xs-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail">
<h4>Asset Allocation Pie Graph</h4>
<span class="text-muted">Currencies owned and tracked.</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail">
<h4>Profit/Loss/Initial Pie Graph</h4>
<span class="text-muted">Current portfolio health.</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail">
<h4>Exchanges Pie Graph</h4>
<span class="text-muted">Based on current daily volume and analysis.</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail">
<h4>Market Capitalisation Pie Graph</h4>
<span class="text-muted">In USD terms per deemed weighted currencies.</span>
</div>
</div>
<h2 class="sub-header">Running Report. Subdivided in monthly/yearly/quarter</h2>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Trade Execution date</th>
<th>Trade Exchange</th>
<th>Trade Type</th>
<th>Initial Investment</th>
<th>PROFIT/LOSS</th>
</tr>
</thead>
<tbody>
<tr>
<td>SOMETHING HERE</td>
<td>SOMETHING HERE</td>
<td>SOMETHING HERE</td>
<td>SOMETHING HERE</td>
<td>SOMETHING HERE</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
{{template "footer" .}}

View File

@@ -1,44 +0,0 @@
{{template "header" .}}
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/dashboard-marketdepth">Template Trading Platform v0.0</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="/logout">Logout</a></li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li><a href="/dashboard-marketdepth">Market Depth</a></li>
<li><a href="/dashboard-ordermanagement">Order Management</a></li>
<li><a href="/dashboard-reports">Reports</a></li>
<li class="active"><a href="/dashboard-settings">Settings<span class="sr-only">(current)</span></a></li>
<li><a href="/dashboard-contact">Contact</a></li>
</ul>
<ul class="nav nav-sidebar">
</ul>
<ul class="nav nav-sidebar">
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header">Settings</h1>
<h2 class="sub-header">Settings Table</h2>
</div>
</div>
</div>
{{template "footer" .}}

View File

@@ -0,0 +1,22 @@
//jshint strict: false
exports.config = {
allScriptsTimeout: 11000,
specs: [
'*.js'
],
capabilities: {
'browserName': 'chrome'
},
baseUrl: 'http://localhost:8000/',
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};

View File

@@ -0,0 +1,42 @@
'use strict';
/* https://github.com/angular/protractor/blob/master/docs/toc.md */
describe('my app', function() {
it('should automatically redirect to /view1 when location hash/fragment is empty', function() {
browser.get('index.html');
expect(browser.getLocationAbsUrl()).toMatch("/view1");
});
describe('view1', function() {
beforeEach(function() {
browser.get('index.html#!/view1');
});
it('should render view1 when user navigates to /view1', function() {
expect(element.all(by.css('[ng-view] p')).first().getText()).
toMatch(/partial for view 1/);
});
});
describe('view2', function() {
beforeEach(function() {
browser.get('index.html#!/view2');
});
it('should render view2 when user navigates to /view2', function() {
expect(element.all(by.css('[ng-view] p')).first().getText()).
toMatch(/partial for view 2/);
});
});
});

View File

@@ -1,37 +0,0 @@
{{template "header" .}}
<div class="site-wrapper">
<div class="site-wrapper-inner">
<div class="cover-container">
<div class="masthead clearfix">
<div class="inner">
<nav>
<ul class="nav masthead-nav">
</ul>
</nav>
</div>
</div>
<div class="inner cover">
<h1 class="cover-heading">ERROR</h1>
<p class="lead">The error {{.Error}} has occured.</p>
<p class="lead">
</p>
</div>
<div class="mastfoot">
<div class="inner">
</div>
</div>
</div>
</div>
</div>
{{template "footer" .}}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

View File

@@ -1,4 +0,0 @@
{{define "footer"}}
</body>
</html>
{{end}}

View File

@@ -1,39 +0,0 @@
var express = require('express');
var routes = require('./routes');
var app = express();
// set the view engine to ejs
app.set('view engine', 'ejs');
// use res.render to load up an ejs view file
// index page
app.get('/', function(req, res) {
res.render('pages/index', {
});
});
// setting page
app.get('/settings', function(req, res) {
res.render('pages/settings', {
});
});
// about page
app.get('/about', function(req, res) {
res.render('pages/about');
});
app.get('/data/all-enabled-currencies', function (req, res) {
request({
url :'http://localhost:9050/exchanges/enabled/latest/all'
},function(err, resp, body){
res.send(body);
})
});
app.listen(80, function(){
console.log('CORS-enabled web server listening on port 80');
});

View File

@@ -1,23 +0,0 @@
'use strict';
/* Controllers */
angular.module('gocryptoweb.controllers', []).
controller('HomeController', function ($scope, $http) {
$scope.working = true;
$http({
method: 'GET',
url: '/data/all-enabled-currencies'
}).
success(function (data, status, headers, config) {
$scope.exchanges = data.data.exchanges;
}).
error(function (data, status, headers, config) {
console.log('error');
});
}).
controller('MyCtrl1', function ($scope) {
// write Ctrl here
});

View File

@@ -1,9 +0,0 @@
exports.index = function(req, res){
res.render('index');
};
exports.partials = function (req, res) {
var name = req.params.name;
res.render('partials/' + name);
};

View File

@@ -1,11 +0,0 @@
{
"name" : "gocryptotrader-website",
"version" : "0.0.1",
"scripts" : {
"start" : "node Server.js"
},
"dependencies" : {
"express" : "latest",
"ejs":"latest"
}
}

View File

@@ -1,3 +0,0 @@
exports.index = function(req, res){
res.render('layout');
};

View File

@@ -1,26 +0,0 @@
<!-- views/pages/index.ejs -->
<!DOCTYPE html>
<html lang="en" ng-app="gocryptoweb">
<head>
<% include ../partials/head %>
</head>
<body class="container">
<header>
<% include ../partials/header %>
</header>
<main>
<div class="jumbotron" ng-controller="HomeController">
{{working}}
</div>
</main>
<footer>
<% include ../partials/footer %>
</footer>
</body>
</html>

View File

@@ -1,27 +0,0 @@
<!-- views/pages/index.ejs -->
<!DOCTYPE html>
<html lang="en">
<head>
<% include ../partials/head %>
</head>
<body class="container">
<header>
<% include ../partials/header %>
</header>
<main>
<div class="jumbotron">
<h1>Settings</h1>
<p>This will be a visiual interface to edit the config file</p>
<p>Things like enabling exchanges, currencies and setting excahnge account settings</p>
</div>
</main>
<footer>
<% include ../partials/footer %>
</footer>
</body>
</html>

View File

@@ -1,3 +0,0 @@
<!-- views/partials/footer.ejs -->
<p class="text-center text-muted">Copyright 2016 GoCrypto Trader</p>

View File

@@ -1,11 +0,0 @@
<!-- views/partials/head.ejs -->
<meta charset="UTF-8">
<title>GoCrpto Trader</title>
<!-- CSS (load bootstrap from a CDN) -->
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.3/angular-route.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>

View File

@@ -1,21 +0,0 @@
<!-- views/partials/header.ejs -->
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/">
GoCrypto Trader
</a>
</div>
<ul class="nav navbar-nav">
<li><a href="/">Dashboard</a></li>
<li><a href="/about">About</a></li>
</ul>
<ul class="nav navbar-nav pull-right">
<li class=""><a href="/settings">Settings</a></li>
</ul>
</div>
</nav>

View File

@@ -1,19 +0,0 @@
{{define "header"}}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{{.Title}}</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Latest compiled and minified jquery -->
<script src="https://code.jquery.com/jquery-2.2.2.min.js" integrity="sha256-36cp2Co+/62rEAAYHLmRCPIych47CvdM+uTBJwSzWjI=" crossorigin="anonymous"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<!-- Static internal stylesheets -->
{{.StaticStylesheet}}
<!-- Favourite Icon.ico -->
<link rel="icon" href="web/favicon.ico">
</head>
<body>
{{end}}

View File

@@ -1,37 +0,0 @@
{{template "header" .}}
<div class="site-wrapper">
<div class="site-wrapper-inner">
<div class="cover-container">
<div class="masthead clearfix">
<div class="inner">
<nav>
<ul class="nav masthead-nav">
</ul>
</nav>
</div>
</div>
<div class="inner cover">
<h1 class="cover-heading">Template Trading Platform v0.0</h1>
<p class="lead">Login Test</p>
<p class="lead">
<a href="/login" class="btn btn-lg btn-default">Login Test Page</a>
</p>
</div>
<div class="mastfoot">
<div class="inner">
</div>
</div>
</div>
</div>
</div>
{{template "footer" .}}

34
web/karma.conf.js Normal file
View File

@@ -0,0 +1,34 @@
//jshint strict: false
module.exports = function(config) {
config.set({
basePath: './app',
files: [
'bower_components/angular/angular.js',
'bower_components/angular-route/angular-route.js',
'bower_components/angular-mocks/angular-mocks.js',
'components/**/*.js',
'view*/**/*.js'
],
autoWatch: true,
frameworks: ['jasmine'],
browsers: ['Chrome'],
plugins: [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-jasmine',
'karma-junit-reporter'
],
junitReporter: {
outputFile: 'test_out/unit.xml',
suite: 'unit'
}
});
};

View File

@@ -1,6 +0,0 @@
{{template "header" .}}
<p>
This is the login page....
</p>
<a href="/dashboard-marketdepth" class="btn btn-lg btn-default">goto dashboard</a>
{{template "footer" .}}

38
web/package.json Normal file
View File

@@ -0,0 +1,38 @@
{
"name": "angular-seed",
"private": true,
"version": "0.0.0",
"description": "A starter project for AngularJS",
"repository": "https://github.com/angular/angular-seed",
"license": "MIT",
"devDependencies": {
"bower": "^1.7.7",
"http-server": "^0.9.0",
"jasmine-core": "^2.4.1",
"karma": "^0.13.22",
"karma-chrome-launcher": "^0.2.3",
"karma-firefox-launcher": "^0.1.7",
"karma-jasmine": "^0.3.8",
"karma-junit-reporter": "^0.4.1",
"protractor": "^3.2.2",
"express" : "latest"
},
"scripts": {
"postinstall": "bower install",
"prestart": "npm install",
"start": "node server.js",
"pretest": "npm install",
"test": "karma start karma.conf.js",
"test-single-run": "karma start karma.conf.js --single-run",
"preupdate-webdriver": "npm install",
"update-webdriver": "webdriver-manager update",
"preprotractor": "npm run update-webdriver",
"protractor": "protractor e2e-tests/protractor.conf.js",
"update-index-async": "node -e \"var fs=require('fs'),indexFile='app/index-async.html',loaderFile='app/bower_components/angular-loader/angular-loader.min.js',loaderText=fs.readFileSync(loaderFile,'utf-8').split(/sourceMappingURL=angular-loader.min.js.map/).join('sourceMappingURL=bower_components/angular-loader/angular-loader.min.js.map'),indexText=fs.readFileSync(indexFile,'utf-8').split(/\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/).join('//@@NG_LOADER_START@@\\n'+loaderText+' //@@NG_LOADER_END@@');fs.writeFileSync(indexFile,indexText);\""
}
}

27
web/server.js Normal file
View File

@@ -0,0 +1,27 @@
var express = require('express')
, app = express();
var request = require('request');
var path = __dirname + '/app/';
app.use("/bower_components", express.static(path + '/bower_components'));
app.get("/",function(req,res){
res.sendFile(path + "index.html");
});
app.use("/", express.static(path + '/'));
app.get('/data/all-enabled-currencies', function (req, res) {
request({
url :'http://localhost:9050/exchanges/enabled/latest/all'
},function(err, resp, body){
res.send(body);
})
});
app.listen(80, function(){
console.log('CORS-enabled web server listening on port 80');
});

View File

@@ -1,163 +0,0 @@
/*
* Globals
*/
/* Links */
a,
a:focus,
a:hover {
color: #fff;
}
/* Custom default button */
.btn-default,
.btn-default:hover,
.btn-default:focus {
color: #333;
text-shadow: none; /* Prevent inheritence from `body` */
background-color: #fff;
border: 1px solid #fff;
}
/*
* Base structure
*/
html,
body {
height: 100%;
background-color: #333;
}
body {
color: #fff;
text-align: center;
text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
/* Extra markup and styles for table-esque vertical and horizontal centering */
.site-wrapper {
display: table;
width: 100%;
height: 100%; /* For at least Firefox */
min-height: 100%;
-webkit-box-shadow: inset 0 0 100px rgba(0,0,0,.5);
box-shadow: inset 0 0 100px rgba(0,0,0,.5);
}
.site-wrapper-inner {
display: table-cell;
vertical-align: top;
}
.cover-container {
margin-right: auto;
margin-left: auto;
}
/* Padding for spacing */
.inner {
padding: 30px;
}
/*
* Header
*/
.masthead-brand {
margin-top: 10px;
margin-bottom: 10px;
}
.masthead-nav > li {
display: inline-block;
}
.masthead-nav > li + li {
margin-left: 20px;
}
.masthead-nav > li > a {
padding-right: 0;
padding-left: 0;
font-size: 16px;
font-weight: bold;
color: #fff; /* IE8 proofing */
color: rgba(255,255,255,.75);
border-bottom: 2px solid transparent;
}
.masthead-nav > li > a:hover,
.masthead-nav > li > a:focus {
background-color: transparent;
border-bottom-color: #a9a9a9;
border-bottom-color: rgba(255,255,255,.25);
}
.masthead-nav > .active > a,
.masthead-nav > .active > a:hover,
.masthead-nav > .active > a:focus {
color: #fff;
border-bottom-color: #fff;
}
@media (min-width: 768px) {
.masthead-brand {
float: left;
}
.masthead-nav {
float: right;
}
}
/*
* Cover
*/
.cover {
padding: 0 20px;
}
.cover .btn-lg {
padding: 10px 20px;
font-weight: bold;
}
/*
* Footer
*/
.mastfoot {
color: #999; /* IE8 proofing */
color: rgba(255,255,255,.5);
}
/*
* Affix and center
*/
@media (min-width: 768px) {
/* Pull out the header and footer */
.masthead {
position: fixed;
top: 0;
}
.mastfoot {
position: fixed;
bottom: 0;
}
/* Start the vertical centering */
.site-wrapper-inner {
vertical-align: middle;
}
/* Handle the widths */
.masthead,
.mastfoot,
.cover-container {
width: 100%; /* Must be percentage or pixels for horizontal alignment */
}
}
@media (min-width: 992px) {
.masthead,
.mastfoot,
.cover-container {
width: 700px;
}
}

View File

@@ -1,105 +0,0 @@
/*
* Base structure
*/
/* Move down content because we have a fixed navbar that is 50px tall */
body {
padding-top: 50px;
}
/*
* Global add-ons
*/
.sub-header {
padding-bottom: 10px;
border-bottom: 1px solid #eee;
}
/*
* Top navigation
* Hide default border to remove 1px line.
*/
.navbar-fixed-top {
border: 0;
}
/*
* Sidebar
*/
/* Hide for mobile, show later */
.sidebar {
display: none;
}
@media (min-width: 768px) {
.sidebar {
position: fixed;
top: 51px;
bottom: 0;
left: 0;
z-index: 1000;
display: block;
padding: 20px;
overflow-x: hidden;
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
background-color: #f5f5f5;
border-right: 1px solid #eee;
}
}
/* Sidebar navigation */
.nav-sidebar {
margin-right: -21px; /* 20px padding + 1px border */
margin-bottom: 20px;
margin-left: -20px;
}
.nav-sidebar > li > a {
padding-right: 20px;
padding-left: 20px;
}
.nav-sidebar > .active > a,
.nav-sidebar > .active > a:hover,
.nav-sidebar > .active > a:focus {
color: #fff;
background-color: #428bca;
}
/*
* Main content
*/
.main {
padding: 20px;
}
@media (min-width: 768px) {
.main {
padding-right: 40px;
padding-left: 40px;
}
}
.main .page-header {
margin-top: 0;
}
/*
* Placeholder dashboard ideas
*/
.placeholders {
margin-bottom: 30px;
text-align: center;
}
.placeholders h4 {
margin-bottom: 0;
}
.placeholder {
margin-bottom: 20px;
}
.placeholder img {
display: inline-block;
border-radius: 50%;
}