Skip to content

Commit

Permalink
Merge pull request knowm#1542 from douggie/develop
Browse files Browse the repository at this point in the history
Repair typo on existing place limt order functions and support shorts
  • Loading branch information
mmazi authored Jun 21, 2017
2 parents df87ae4 + 95bd889 commit 4f05ccc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
public class PoloniexUtils {

public static String toPairString(CurrencyPair currencyPair) {
return currencyPair.counter.getCurrencyCode().toUpperCase() + "_" + currencyPair.base.getCurrencyCode().toUpperCase();

String pairString = currencyPair.base.getCurrencyCode().toUpperCase() + "_" + currencyPair.counter.getCurrencyCode().toUpperCase();
return pairString;
}

public static CurrencyPair toCurrencyPair(String pair) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public String placeMarketOrder(MarketOrder marketOrder) throws IOException {
public String placeLimitOrder(LimitOrder limitOrder) throws IOException {

PoloniexTradeResponse response;
if (limitOrder.getType() == OrderType.BID) {
if (limitOrder.getType() == OrderType.BID || limitOrder.getType() == OrderType.EXIT_ASK) {
response = buy(limitOrder);
} else {
response = sell(limitOrder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ private PoloniexTradeResponse orderEntry(LimitOrder limitOrder, String name) thr
PoloniexUtils.toPairString(limitOrder.getCurrencyPair()), lendingRate);
return response;
} else {
Method method = PoloniexAuthenticated.class.getDeclaredMethod("margin" + name.toUpperCase(), String.class, ParamsDigest.class,
SynchronizedValueFactory.class, String.class, String.class, String.class, Integer.class, Integer.class, Integer.class);
Method method = PoloniexAuthenticated.class.getDeclaredMethod(name, String.class, ParamsDigest.class, SynchronizedValueFactory.class,
String.class, String.class, String.class, Integer.class, Integer.class, Integer.class);
PoloniexTradeResponse response = (PoloniexTradeResponse) method.invoke(poloniexAuthenticated, apiKey, signatureCreator,
exchange.getNonceFactory(), limitOrder.getTradableAmount().toPlainString(), limitOrder.getLimitPrice().toPlainString(),
PoloniexUtils.toPairString(limitOrder.getCurrencyPair()), fillOrKill, immediateOrCancel, postOnly);
Expand Down

0 comments on commit 4f05ccc

Please sign in to comment.