Quick basic wallet interface implementation

This commit is contained in:
GloriousCode
2016-09-13 17:38:37 +10:00
parent fcab6df787
commit 01a599f571
6 changed files with 27 additions and 38 deletions

View File

@@ -1037,7 +1037,7 @@ func (e *Poloniex) GetExchangeAccountInfo() (ExchangeAccountInfo, error) {
if err != nil {
return response, err
}
currencies := e.GetEnabledCurrencies()
currencies := e.AvailablePairs
for i := 0; i < len(currencies); i++ {
var exchangeCurrency ExchangeAccountCurrencyInfo
exchangeCurrency.CurrencyName = currencies[i]

View File

@@ -5,6 +5,7 @@ angular.module('myApp', [
'ngRoute',
'ui-notification',
'myApp.home',
'myApp.wallets',
'myApp.about',
'myApp.settings',
'myApp.version'

View File

@@ -32,6 +32,7 @@
<ul class="nav navbar-nav">
<li><a href="#!/">Dashboard</a></li>
<li><a href="#!/wallets">Wallets</a></li>
<li><a href="#!/about">About</a></li>
</ul>
<ul class="nav navbar-nav pull-right">

View File

@@ -1,28 +1,17 @@
<h2>Dashboard</h2>
<h3>Your current standings</h3>
<div ng-repeat="exchange in exchanges">
<h4>{{exchange.exchangeName}}</h4>
<h2>Wallets</h2>
<h3>All your currency, all in one place</h3>
<div ng-repeat="wallet in wallets">
<h4>{{wallet.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>
<th>Currency Name</th>
<th>Total</th>
<th>Hold</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 ng-repeat="value in wallet.Currencies">
<td>{{value.CurrencyName}}</td>
<td>{{value.TotalValue}}</td>
<td>{{value.Hold}}</td>
</tr>
</table>
<div ng-repeat="value in exchange.exchangeValues">
</div>
</div>

View File

@@ -1,23 +1,23 @@
'use strict';
angular.module('myApp.home', ['ngRoute'])
angular.module('myApp.wallets', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/', {
templateUrl: '/views/home/home.html',
controller: 'HomeController'
templateUrl: '/views/wallets/wallets.html',
controller: 'WalletsController'
});
}])
.controller('HomeController', function ($scope, $http, Notification) {
.controller('WalletsController', function ($scope, $http, Notification) {
$scope.getDashboardData = function() {
$http({
method: 'GET',
url: '/data/all-enabled-currencies'
url: '/data/all-enabled-exchange-account-info'
}).
success(function (data, status, headers, config) {
$scope.exchanges = data.data;
Notification.info("Retrieved latest data");
$scope.wallets = data.data;
Notification.info("Got your wallet!");
}).
error(function (data, status, headers, config) {
console.log('error');

View File

@@ -15,26 +15,24 @@
"karma-jasmine": "^0.3.8",
"karma-junit-reporter": "^0.4.1",
"protractor": "^3.2.2",
"express" : "latest",
"requestify":"latest",
"body-parser":"latest"
"express": "latest",
"requestify": "latest",
"body-parser": "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);\""
},
"dependencies": {
"request": "^2.74.0"
}
}