diff --git a/web/app/components/buy/buy.js b/web/app/components/buy/buy.js
index 7af228b1..e522e462 100644
--- a/web/app/components/buy/buy.js
+++ b/web/app/components/buy/buy.js
@@ -2,15 +2,24 @@
angular.module('myApp.buy',[]).component('buy', {
templateUrl: '/components/buy/buy.html',
controller:'BuyController',
- bindings: {
- exchange: '=',
- currency:'='
- }, controller: function ($scope, $http, Notification) {
-
- $scope.GetLatestDataFromExchangeCurrency = function () {
+ controller: function ($scope, $http, Notification, $rootScope) {
+ $scope.currency = {};
+ $scope.exchange = {};
+
+ $rootScope.$on('CurrencyChanged', function (event, args) {
+ $scope.currency = args.Currency;
+ $scope.exchange = args.Exchange;
+ console.log($scope.currency);
+ $scope.GetLatestDataFromExchangeCurrency();
+ $scope.price = $scope.currency.Ask;
+ });
+
+ $scope.GetLatestDataFromExchangeCurrency = function () {
$http.get('/GetLatestDataFromExchangeCurrency?exhange=' + $scope.exchange.exchangeName + '¤cy='+ $scope.currency.CryptoCurrency).success(function (data) {
$scope.currency.Last = data.Last;
$scope.currency.Volume = data.Volume;
+ $scope.currency.Ask = data.Ask;
+ $scope.price = $scope.currency.Ask;
});
}
@@ -20,8 +29,7 @@ angular.module('myApp.buy',[]).component('buy', {
obj.Currency = $scope.currency;
obj.Price = $scope.price;
obj.Amount = $scope.amount;
- obj.Amount = $scope.amount;
- $http.post('/Command/', obj).success(function (response) {
+ $http.post('/Command/PlaceBuyOrder', obj).success(function (response) {
Notification.success("Successfully placed order");
});
};
diff --git a/web/app/components/filters/stringUtils.js b/web/app/components/filters/stringUtils.js
deleted file mode 100644
index ea4ead34..00000000
--- a/web/app/components/filters/stringUtils.js
+++ /dev/null
@@ -1,9 +0,0 @@
-angular.module('myApp.stringUtils', [])
- .filter('removeSpaces', [function () {
- return function (string) {
- if (!angular.isString(string)) {
- return string;
- }
- return string.replace(/[\s]/g, '');
- };
- }]);
\ No newline at end of file
diff --git a/web/app/components/helpers/stringUtils.js b/web/app/components/helpers/stringUtils.js
new file mode 100644
index 00000000..8f10d6b0
--- /dev/null
+++ b/web/app/components/helpers/stringUtils.js
@@ -0,0 +1,25 @@
+angular.module('myApp.stringUtils', [])
+ .filter('removeSpaces', [function () {
+ return function (string) {
+ if (!angular.isString(string)) {
+ return string;
+ }
+ return string.replace(/[\s]/g, '');
+ };
+ }]);
+/*
+ angular.module('myApp.currenctExchangeFactory', []).factory('currentExchangeCurrency', function() {
+ var currentExchangeAndCurrency = {};
+ var exchangeService = {};
+
+ exchangeService.get = function() {
+ return currentExchangeAndCurrency;
+ };
+ exchangeService.update = function(exchange, currency) {
+ currentExchangeAndCurrency.Exchange = exchange;
+ currentExchangeAndCurrency.Currency = currency;
+ };
+
+ return exchangeService;
+});
+*/
diff --git a/web/app/components/sell/sell.html b/web/app/components/sell/sell.html
new file mode 100644
index 00000000..5df31c2e
--- /dev/null
+++ b/web/app/components/sell/sell.html
@@ -0,0 +1,25 @@
+
+
+
\ No newline at end of file
diff --git a/web/app/components/sell/sell.js b/web/app/components/sell/sell.js
new file mode 100644
index 00000000..d8c2095d
--- /dev/null
+++ b/web/app/components/sell/sell.js
@@ -0,0 +1,40 @@
+
+angular.module('myApp.sell',[]).component('sell', {
+ templateUrl: '/components/sell/sell.html',
+ controller:'SellController',
+ controller: function ($scope, $http, Notification, $rootScope) {
+ $scope.currency = {};
+ $scope.exchange = {};
+
+ $rootScope.$on('CurrencyChanged', function (event, args) {
+ $scope.currency = args.Currency;
+ $scope.exchange = args.Exchange;
+ console.log($scope.currency);
+ $scope.GetLatestDataFromExchangeCurrency();
+ $scope.price = $scope.currency.Bid;
+ });
+
+ $scope.GetLatestDataFromExchangeCurrency = function () {
+ $http.get('/GetLatestDataFromExchangeCurrency?exhange=' + $scope.exchange.exchangeName + '¤cy='+ $scope.currency.CryptoCurrency).success(function (data) {
+ $scope.currency.Last = data.Last;
+ $scope.currency.Volume = data.Volume;
+ $scope.currency.Bid = data.Bid;
+ $scope.price = $scope.currency.Bid;
+ });
+ }
+
+ $scope.placeOrder = function () {
+ var obj = {};
+ obj.ExchangeName = $scope.exchange.exchangeName;
+ obj.Currency = $scope.currency;
+ obj.Price = $scope.price;
+ obj.Amount = $scope.amount;
+ $http.post('/Command/PlaceSellOrder', obj).success(function (response) {
+ Notification.success("Successfully placed order");
+ });
+ };
+ }
+});
+
+
+
diff --git a/web/app/index.html b/web/app/index.html
index 8b1f80ff..7f60ea37 100644
--- a/web/app/index.html
+++ b/web/app/index.html
@@ -61,9 +61,10 @@
+
-
+