...
 
Commits (6)
## ChangeLog ## ChangeLog
### 0.4.1 - 2019-07-25
- Fix limit sell by price to respect Binance tick size. Reported by
user in Telegram.
- Fix issue where clicking on a symbol changes the trade view back to
the default.
- Push down notification are so the tool icon can be clicked.
[Full Changelog](https://gitlab.com/crankykernel/maker/compare/0.4.0...0.4.1)
### 0.4.0 - 2019-04-06 ### 0.4.0 - 2019-04-06
- New command line option to set the data directory where the - New command line option to set the data directory where the
maker.yaml, maker.db and log files are stored. This replaces the maker.yaml, maker.db and log files are stored. This replaces the
......
...@@ -781,12 +781,24 @@ func (s *TradeService) limitSellByPrice(trade *types.Trade, price float64) error ...@@ -781,12 +781,24 @@ func (s *TradeService) limitSellByPrice(trade *types.Trade, price float64) error
} }
s.addClientOrderId(trade, clientOrderId) s.addClientOrderId(trade, clientOrderId)
log.WithFields(log.Fields{ tickSize, err := s.binanceExchangeInfo.GetTickSize(trade.State.Symbol)
"price": fmt.Sprintf("%.8f", price), if err != nil {
"symbol": trade.State.Symbol, log.WithError(err).WithFields(log.Fields{
"tradeId": trade.State.TradeID, "symbol": trade.State.Symbol,
"quantity": trade.State.SellableQuantity, }).Errorf("Limit sell by price failed, no tick size for symbol")
}).Debugf("Posting limit sell order at price.") return err
}
// Adjust price for tick size.
fixedPrice := util.Roundx(price, 1/tickSize)
logFields := log.Fields{
"price": fmt.Sprintf("%.8f", price),
"symbol": trade.State.Symbol,
"tradeId": trade.State.TradeID,
"quantity": trade.State.SellableQuantity,
"tickSizeAdjustedPrice": fmt.Sprintf("%.8f", fixedPrice),
}
order := binanceapi.OrderParameters{ order := binanceapi.OrderParameters{
Symbol: trade.State.Symbol, Symbol: trade.State.Symbol,
...@@ -794,19 +806,17 @@ func (s *TradeService) limitSellByPrice(trade *types.Trade, price float64) error ...@@ -794,19 +806,17 @@ func (s *TradeService) limitSellByPrice(trade *types.Trade, price float64) error
Type: binanceapi.OrderTypeLimit, Type: binanceapi.OrderTypeLimit,
TimeInForce: binanceapi.TimeInForceGTC, TimeInForce: binanceapi.TimeInForceGTC,
Quantity: trade.State.SellableQuantity, Quantity: trade.State.SellableQuantity,
Price: price, Price: fixedPrice,
NewClientOrderId: clientOrderId, NewClientOrderId: clientOrderId,
} }
_, err = binanceex.GetBinanceRestClient().PostOrder(order) _, err = binanceex.GetBinanceRestClient().PostOrder(order)
if err != nil { if err != nil {
log.WithFields(log.Fields{}).WithError(err).Error("Failed to send sell order.") log.WithFields(logFields).WithError(err).Error("Failed to send sell order.")
return err return err
} }
log.WithFields(log.Fields{
"price": price, log.WithFields(logFields).Infof("Posting limit sell order at price")
"symbol": trade.State.Symbol,
"tradeId": trade.State.TradeID,
}).Info("Sell order posted.")
db.DbUpdateTrade(trade) db.DbUpdateTrade(trade)
return nil return nil
} }
......
...@@ -31,6 +31,7 @@ export interface ToastrOptions { ...@@ -31,6 +31,7 @@ export interface ToastrOptions {
export class ToastrService { export class ToastrService {
constructor() { constructor() {
toastr.options.toastClass = "toastr";
} }
success(msg: string, title?: string, options?: ToastrOptions) { success(msg: string, title?: string, options?: ToastrOptions) {
......
<td class="nowrap"> <td class="nowrap">
<a [routerLink]="['/trade', {symbol: trade.Symbol}]">{{trade.Symbol}}</a> <a [routerLink]="['/trade']" [queryParams]="{symbol: trade.Symbol}" queryParamsHandling="merge">{{trade.Symbol}}</a>
<br/> <br/>
{{trade.Status}} {{trade.Status}}
<br/> <br/>
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
<tr> <tr>
<td></td> <td></td>
<td> <td>
<b style="color: grey">-- Limit Sell--</b> <b style="color: grey">-- Limit Sell--</b>
</td> </td>
</tr> </tr>
......
...@@ -13,13 +13,7 @@ ...@@ -13,13 +13,7 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
import { import {AfterViewInit, Component, Input, OnDestroy, OnInit} from "@angular/core";
AfterViewInit,
Component,
Input,
OnDestroy,
OnInit
} from "@angular/core";
import {MakerService, TradeStatus} from "../maker.service"; import {MakerService, TradeStatus} from "../maker.service";
import {Logger, LoggerService} from "../logger.service"; import {Logger, LoggerService} from "../logger.service";
import {ToastrService} from "../toastr.service"; import {ToastrService} from "../toastr.service";
......
...@@ -113,13 +113,10 @@ export class TradeTableComponent implements OnInit, OnChanges { ...@@ -113,13 +113,10 @@ export class TradeTableComponent implements OnInit, OnChanges {
} }
switchTradeView(what) { switchTradeView(what) {
let params = Object.assign({}, this.route.snapshot.params); let params = Object.assign({}, this.route.snapshot.queryParams);
if (what === null) { params.viewTrades = what;
delete (params["viewTrades"]); this.router.navigate(["."], {
} else { queryParams: params,
params.viewTrades = what;
}
this.router.navigate([".", params], {
queryParamsHandling: "merge", queryParamsHandling: "merge",
}); });
} }
......
...@@ -219,7 +219,7 @@ export class TradeComponent implements OnInit, OnDestroy, AfterViewInit { ...@@ -219,7 +219,7 @@ export class TradeComponent implements OnInit, OnDestroy, AfterViewInit {
} }
this.binance.isReady$.subscribe(() => { this.binance.isReady$.subscribe(() => {
this.route.params.subscribe((params) => { let s = this.route.queryParams.subscribe((params) => {
const newSymbol = params.symbol; const newSymbol = params.symbol;
if (newSymbol && newSymbol != this.orderFormSettings.symbol) { if (newSymbol && newSymbol != this.orderFormSettings.symbol) {
this.changeSymbol(newSymbol); this.changeSymbol(newSymbol);
...@@ -236,7 +236,8 @@ export class TradeComponent implements OnInit, OnDestroy, AfterViewInit { ...@@ -236,7 +236,8 @@ export class TradeComponent implements OnInit, OnDestroy, AfterViewInit {
this.viewTrades = "all"; this.viewTrades = "all";
break; break;
} }
}) });
this.subs.push(s);
}); });
let s = this.maker.binanceAccountInfo$.subscribe((accountInfo) => { let s = this.maker.binanceAccountInfo$.subscribe((accountInfo) => {
...@@ -337,7 +338,12 @@ export class TradeComponent implements OnInit, OnDestroy, AfterViewInit { ...@@ -337,7 +338,12 @@ export class TradeComponent implements OnInit, OnDestroy, AfterViewInit {
symbol = this.orderFormSettings.symbol; symbol = this.orderFormSettings.symbol;
} }
this.router.navigate(["/trade", {symbol: symbol}]) this.router.navigate(["/trade"], {
queryParams: {
symbol: symbol,
},
queryParamsHandling: "merge",
});
if (!symbol) { if (!symbol) {
this.saveState(); this.saveState();
......
...@@ -45,3 +45,10 @@ html { ...@@ -45,3 +45,10 @@ html {
.toast { .toast {
opacity: 1 !important; opacity: 1 !important;
} }
// Shift the Toastr display down so the settings button in the navigation bar can
// still be pressed when displayed.
.toast-top-right {
top: 42px;
right: 12px;
}