Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2202 from vhpoet/pr/150206132802
Browse files Browse the repository at this point in the history
[FIX] Trade: Allow adding offers in empty orderbook (RT-3171)
  • Loading branch information
Anna Tong committed Feb 6, 2015
2 parents bf13f39 + c8fca96 commit 67c4e02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/jade/tabs/trade.jade
Original file line number Diff line number Diff line change
Expand Up @@ -581,14 +581,14 @@ section.col-xs-12.content(ng-controller="TradeCtrl")
.emptyMessage(ng-show="isEmpty(offers) && ! editOrder.replacing")
p.rp-base(l10n) No current orders.
a(l10n, href="", ng-click="view_orders_history()") View orders history
.row.row-padding-small.orderbookupdate(ng-show="lastUpdate")
.row.row-padding-small.orderbookupdate
.col-xs-12.col-sm-6
div.orderbook-title(l10n)
| Orderbook
small.toggle.orderbook-hide(ng-click="visualState.hideOrderBook = !visualState.hideOrderBook")
span(ng-show="visualState.hideOrderBook", l10n) show
span(ng-hide="visualState.hideOrderBook", l10n) hide
.col-xs-12.col-sm-6.last-update(l10n) Last updated
.col-xs-12.col-sm-6.last-update(l10n, ng-show="lastUpdate") Last updated
span {{lastUpdate}}
span(ng-show="lastUpdate > '1'", l10n-inc) seconds
span(ng-show="lastUpdate == '1'", l10n-inc) second
Expand Down
10 changes: 8 additions & 2 deletions src/js/tabs/trade.js
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,10 @@ TradeTab.prototype.angular = function(module)
};

$scope.fatFingerCheck = function(type, price) {
// Skip the fat finger check if there's no book
if (type === 'buy' && !$scope.bookShow.bids[0]) return;
else if (type === 'sell' && !$scope.bookShow.asks[0]) return;

var fatFingerMarginMultiplier = 1.1; // i.e. 10%
var bestPrice;

Expand Down Expand Up @@ -1351,6 +1355,10 @@ TradeTab.prototype.angular = function(module)
};

var updateTypeBook = function (type) {
if ($scope.book && $scope.book[type + 'LastUpdate']) {
$scope.load_orderbook = false;
}

if (!$scope.book || !$scope.book[type] || !$scope.book[type].length) return;

$scope.bookShow[type] = jQuery.extend(true, [], $scope.book[type]);
Expand All @@ -1375,8 +1383,6 @@ TradeTab.prototype.angular = function(module)
$scope.bookShow[type][i]['show' + showValue] = rpamountFilter($scope.bookShow[type][i][showValue], OrderbookFilterOpts);
}

$scope.load_orderbook = false;

$scope.priceTicker[type.substring(0, 3)] = rpamountFilter($scope.bookShow[type][0].price, OrderbookTickerFilterOpts);

if ($scope.book.ready) {
Expand Down

0 comments on commit 67c4e02

Please sign in to comment.